aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/ui
diff options
context:
space:
mode:
authorPeter Kohaut2019-04-13 01:03:48 +0200
committerPeter Kohaut2019-04-17 22:51:18 +0200
commite86ee33999f33ad66bb7c018b4d4b7604b48badb (patch)
treefbc44cf5d597c7aaed1ee230bad4e5918ee92b4b /engines/bladerunner/ui
parent955bf0c6694cca49e5031ec9866b343cc86f596d (diff)
downloadscummvm-rg350-e86ee33999f33ad66bb7c018b4d4b7604b48badb.tar.gz
scummvm-rg350-e86ee33999f33ad66bb7c018b4d4b7604b48badb.tar.bz2
scummvm-rg350-e86ee33999f33ad66bb7c018b4d4b7604b48badb.zip
BLADERUNNER: Abstraction from 555 pixel format
Removing hardcoded 555 pixel format to support Android
Diffstat (limited to 'engines/bladerunner/ui')
-rw-r--r--engines/bladerunner/ui/esper.cpp121
-rw-r--r--engines/bladerunner/ui/kia.cpp6
-rw-r--r--engines/bladerunner/ui/kia_section_clues.cpp18
-rw-r--r--engines/bladerunner/ui/kia_section_crimes.cpp26
-rw-r--r--engines/bladerunner/ui/kia_section_diagnostic.cpp21
-rw-r--r--engines/bladerunner/ui/kia_section_diagnostic.h5
-rw-r--r--engines/bladerunner/ui/kia_section_pogo.cpp23
-rw-r--r--engines/bladerunner/ui/kia_section_pogo.h9
-rw-r--r--engines/bladerunner/ui/kia_section_save.cpp16
-rw-r--r--engines/bladerunner/ui/kia_section_settings.cpp44
-rw-r--r--engines/bladerunner/ui/kia_section_suspects.cpp30
-rw-r--r--engines/bladerunner/ui/scores.cpp4
-rw-r--r--engines/bladerunner/ui/ui_image_picker.cpp10
-rw-r--r--engines/bladerunner/ui/ui_input_box.cpp4
-rw-r--r--engines/bladerunner/ui/ui_scroll_box.cpp79
-rw-r--r--engines/bladerunner/ui/ui_scroll_box.h13
-rw-r--r--engines/bladerunner/ui/ui_slider.cpp23
-rw-r--r--engines/bladerunner/ui/ui_slider.h3
-rw-r--r--engines/bladerunner/ui/vk.cpp49
19 files changed, 292 insertions, 212 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;
diff --git a/engines/bladerunner/ui/kia.cpp b/engines/bladerunner/ui/kia.cpp
index 4234f9f648..1991074a82 100644
--- a/engines/bladerunner/ui/kia.cpp
+++ b/engines/bladerunner/ui/kia.cpp
@@ -310,7 +310,7 @@ void KIA::tick() {
}
if (_currentSectionId != kKIASectionQuit && _transitionId != 14) {
if (_vm->_settings->getDifficulty() > 0) {
- _vm->_mainFont->drawColor(Common::String::format("%04d", _vm->_gameVars[kVariableChinyen]), _vm->_surfaceFront, 580, 341, 0x2991);
+ _vm->_mainFont->drawColor(Common::String::format("%04d", _vm->_gameVars[kVariableChinyen]), _vm->_surfaceFront, 580, 341, _vm->_surfaceFront.format.RGBToColor(80, 96, 136));
} else {
_shapes->get(39)->draw(_vm->_surfaceFront, 583, 342);
}
@@ -332,7 +332,7 @@ void KIA::tick() {
int height = _playerPhotograph->getHeight();
_playerPhotograph->draw(_vm->_surfaceFront, 590 - width / 2, 80 - height / 2);
} else if (_playerImage.getPixels() != nullptr) {
- _vm->_surfaceFront.fillRect(Common::Rect(549, 49, 631, 111), 0x7FFF);
+ _vm->_surfaceFront.fillRect(Common::Rect(549, 49, 631, 111), _vm->_surfaceFront.format.RGBToColor(255, 255, 255));
_vm->_surfaceFront.copyRectToSurface(_playerImage.getPixels(), _playerImage.pitch, 550, 50, _playerImage.w, _playerImage.h);
}
}
@@ -370,7 +370,7 @@ void KIA::tick() {
_shapes->get(47)->draw(_vm->_surfaceFront, 182, 446);
}
}
- _vm->_mainFont->drawColor("1.00", _vm->_surfaceFront, 438, 471, 0x1CE7); // 1.01 is DVD version, but only cd handling routines were changed, no game logic
+ _vm->_mainFont->drawColor("1.00", _vm->_surfaceFront, 438, 471, _vm->_surfaceFront.format.RGBToColor(56, 56, 56)); // 1.01 is DVD version, but only cd handling routines were changed, no game logic
if (!_transitionId) {
_buttons->drawTooltip(_vm->_surfaceFront, mouse.x, mouse.y);
}
diff --git a/engines/bladerunner/ui/kia_section_clues.cpp b/engines/bladerunner/ui/kia_section_clues.cpp
index 495458f7cd..35a4294dca 100644
--- a/engines/bladerunner/ui/kia_section_clues.cpp
+++ b/engines/bladerunner/ui/kia_section_clues.cpp
@@ -120,10 +120,10 @@ void KIASectionClues::close() {
void KIASectionClues::draw(Graphics::Surface &surface) {
_uiContainer->draw(surface);
- _vm->_mainFont->drawColor(_vm->_textKIA->getText(0), surface, 300, 162, 0x77DF);
- _vm->_mainFont->drawColor(_vm->_textKIA->getText(2), surface, 440, 426, 0x2991);
- _vm->_mainFont->drawColor(_vm->_textKIA->getText(1), surface, 440, 442, 0x2991);
- _vm->_mainFont->drawColor(_vm->_textKIA->getText(4), surface, 440, 458, 0x2991);
+ _vm->_mainFont->drawColor(_vm->_textKIA->getText(0), surface, 300, 162, surface.format.RGBToColor(232, 240, 255));
+ _vm->_mainFont->drawColor(_vm->_textKIA->getText(2), surface, 440, 426, surface.format.RGBToColor(80, 96, 136));
+ _vm->_mainFont->drawColor(_vm->_textKIA->getText(1), surface, 440, 442, surface.format.RGBToColor(80, 96, 136));
+ _vm->_mainFont->drawColor(_vm->_textKIA->getText(4), surface, 440, 458, surface.format.RGBToColor(80, 96, 136));
int clueId = _cluesScrollBox->getSelectedLineData();
if (clueId != -1) {
@@ -135,7 +135,7 @@ void KIASectionClues::draw(Graphics::Surface &surface) {
} else {
text.clear();
}
- _vm->_mainFont->drawColor(text, surface, 490, 426, 0x46BF);
+ _vm->_mainFont->drawColor(text, surface, 490, 426, surface.format.RGBToColor(136, 168, 255));
int crimeId = _vm->_crimesDatabase->getCrime(clueId);
if (crimeId != -1) {
@@ -143,7 +143,7 @@ void KIASectionClues::draw(Graphics::Surface &surface) {
} else {
text.clear();
}
- _vm->_mainFont->drawColor(text, surface, 490, 442, 0x46BF);
+ _vm->_mainFont->drawColor(text, surface, 490, 442, surface.format.RGBToColor(136, 168, 255));
int assetType = _vm->_crimesDatabase->getAssetType(clueId);
if (assetType != -1) {
@@ -151,17 +151,17 @@ void KIASectionClues::draw(Graphics::Surface &surface) {
} else {
text.clear();
}
- _vm->_mainFont->drawColor(text, surface, 490, 458, 0x46BF);
+ _vm->_mainFont->drawColor(text, surface, 490, 458, surface.format.RGBToColor(136, 168, 255));
}
_buttons->draw(surface);
_buttons->drawTooltip(surface, _mouseX, _mouseY);
if (_debugNop) {
- _vm->_mainFont->drawColor(Common::String::format("Debug display: %s", _vm->_textActorNames->getText(_debugNop)), surface, 120, 132, 0x7FE0);
+ _vm->_mainFont->drawColor(Common::String::format("Debug display: %s", _vm->_textActorNames->getText(_debugNop)), surface, 120, 132, surface.format.RGBToColor(255, 255, 0));
}
if (_debugIntangible) {
- _vm->_mainFont->drawColor("Debug Mode: Showing intangible clues.", surface, 220, 105, 0x7FE0);
+ _vm->_mainFont->drawColor("Debug Mode: Showing intangible clues.", surface, 220, 105, surface.format.RGBToColor(255, 255, 0));
}
}
diff --git a/engines/bladerunner/ui/kia_section_crimes.cpp b/engines/bladerunner/ui/kia_section_crimes.cpp
index f3452a8d3f..99372092a1 100644
--- a/engines/bladerunner/ui/kia_section_crimes.cpp
+++ b/engines/bladerunner/ui/kia_section_crimes.cpp
@@ -142,15 +142,15 @@ void KIASectionCrimes::draw(Graphics::Surface &surface) {
}
if (_suspectPhotoShapeId == 14 || _suspectPhotoShapeId == 13) {
text = _vm->_textKIA->getText(49);
- _vm->_mainFont->drawColor(text, surface, 201 - _vm->_mainFont->getTextWidth(text) / 2, 218, 0x7FFF);
+ _vm->_mainFont->drawColor(text, surface, 201 - _vm->_mainFont->getTextWidth(text) / 2, 218, surface.format.RGBToColor(255, 255, 255));
}
surface.fillRect(Common::Rect(120, 134, 250, 145), 0);
- surface.hLine(120, 133, 250, 0x18A5);
- surface.hLine(120, 146, 250, 0x2D4C);
- surface.vLine(119, 134, 145, 0x18A5);
- surface.vLine(251, 134, 145, 0x2D4C);
- surface.hLine(251, 146, 251, 0x2509);
+ surface.hLine(120, 133, 250, surface.format.RGBToColor(48, 40, 40));
+ surface.hLine(120, 146, 250, surface.format.RGBToColor(88, 80, 96));
+ surface.vLine(119, 134, 145, surface.format.RGBToColor(48, 40, 40));
+ surface.vLine(251, 134, 145, surface.format.RGBToColor(88, 80, 96));
+ surface.hLine(251, 146, 251, surface.format.RGBToColor(72, 64, 72));
if (_crimeSelected == -1) {
text = _vm->_textKIA->getText(49);
@@ -158,14 +158,14 @@ void KIASectionCrimes::draw(Graphics::Surface &surface) {
text = _vm->_textCrimes->getText(_crimeSelected);
}
- _vm->_mainFont->drawColor(text, surface, 185 - _vm->_mainFont->getTextWidth(text) / 2, 136, 0x46BF);
+ _vm->_mainFont->drawColor(text, surface, 185 - _vm->_mainFont->getTextWidth(text) / 2, 136, surface.format.RGBToColor(136, 168, 255));
surface.fillRect(Common::Rect(136, 304, 266, 315), 0);
- surface.hLine(136, 303, 266, 0x18A5);
- surface.hLine(136, 316, 266, 0x2D4C);
- surface.vLine(135, 304, 315, 0x18A5);
- surface.vLine(267, 304, 315, 0x2D4C);
- surface.hLine(267, 316, 267, 0x2509);
+ surface.hLine(136, 303, 266, surface.format.RGBToColor(48, 40, 40));
+ surface.hLine(136, 316, 266, surface.format.RGBToColor(88, 80, 96));
+ surface.vLine(135, 304, 315, surface.format.RGBToColor(48, 40, 40));
+ surface.vLine(267, 304, 315, surface.format.RGBToColor(88, 80, 96));
+ surface.hLine(267, 316, 267, surface.format.RGBToColor(72, 64, 72));
char generatedText[64];
if (_suspectSelected == -1) {
@@ -182,7 +182,7 @@ void KIASectionCrimes::draw(Graphics::Surface &surface) {
text = generatedText;
}
}
- _vm->_mainFont->drawColor(text, surface, 201 - _vm->_mainFont->getTextWidth(text) / 2, 306, 0x46BF);
+ _vm->_mainFont->drawColor(text, surface, 201 - _vm->_mainFont->getTextWidth(text) / 2, 306, surface.format.RGBToColor(136, 168, 255));
_uiContainer->draw(surface);
_buttons->draw(surface);
diff --git a/engines/bladerunner/ui/kia_section_diagnostic.cpp b/engines/bladerunner/ui/kia_section_diagnostic.cpp
index 333cf6389e..9c1f57d864 100644
--- a/engines/bladerunner/ui/kia_section_diagnostic.cpp
+++ b/engines/bladerunner/ui/kia_section_diagnostic.cpp
@@ -31,7 +31,24 @@
namespace BladeRunner {
-const int KIASectionDiagnostic::kTextColors[] = { 0x0000, 0x0821, 0x1061, 0x1C82, 0x24C2, 0x2CE3, 0x3524, 0x4145, 0x4586, 0x4DC7, 0x5609, 0x5E4B, 0x668C, 0x6EEE, 0x7730, 0x7B92 };
+const Color256 KIASectionDiagnostic::kTextColors[] = {
+ { 0, 0, 0 },
+ { 16, 8, 8 },
+ { 32, 24, 8 },
+ { 56, 32, 16 },
+ { 72, 48, 16 },
+ { 88, 56, 24 },
+ { 104, 72, 32 },
+ { 128, 80, 40 },
+ { 136, 96, 48 },
+ { 152, 112, 56 },
+ { 168, 128, 72 },
+ { 184, 144, 88 },
+ { 200, 160, 96 },
+ { 216, 184, 112 },
+ { 232, 200, 128 },
+ { 240, 224, 144 }
+};
KIASectionDiagnostic::KIASectionDiagnostic(BladeRunnerEngine *vm) : KIASectionBase(vm) {
_text = nullptr;
@@ -68,7 +85,7 @@ void KIASectionDiagnostic::draw(Graphics::Surface &surface) {
const char *text = _text->getText(i);
if (text) {
- _vm->_mainFont->drawColor(text, surface, 320 - _vm->_mainFont->getTextWidth(text) / 2, y, kTextColors[colorIndex]);
+ _vm->_mainFont->drawColor(text, surface, 320 - _vm->_mainFont->getTextWidth(text) / 2, y, surface.format.RGBToColor(kTextColors[colorIndex].r, kTextColors[colorIndex].g, kTextColors[colorIndex].b));
}
}
}
diff --git a/engines/bladerunner/ui/kia_section_diagnostic.h b/engines/bladerunner/ui/kia_section_diagnostic.h
index 1642586a54..0c518f2561 100644
--- a/engines/bladerunner/ui/kia_section_diagnostic.h
+++ b/engines/bladerunner/ui/kia_section_diagnostic.h
@@ -23,6 +23,7 @@
#ifndef BLADERUNNER_KIA_SECTION_DIAGNOSTIC_H
#define BLADERUNNER_KIA_SECTION_DIAGNOSTIC_H
+#include "bladerunner/color.h"
#include "bladerunner/ui/kia_section_base.h"
namespace BladeRunner {
@@ -30,8 +31,8 @@ namespace BladeRunner {
class TextResource;
class KIASectionDiagnostic : public KIASectionBase {
- static const int kTextColors[];
- static const int kLineHeight = 18;
+ static const Color256 kTextColors[];
+ static const int kLineHeight = 18;
TextResource *_text;
int _offset;
diff --git a/engines/bladerunner/ui/kia_section_pogo.cpp b/engines/bladerunner/ui/kia_section_pogo.cpp
index 4388c0f849..7b6022c432 100644
--- a/engines/bladerunner/ui/kia_section_pogo.cpp
+++ b/engines/bladerunner/ui/kia_section_pogo.cpp
@@ -32,7 +32,24 @@
namespace BladeRunner {
-const int KIASectionPogo::kTextColors[] = { 0x0000, 0x0821, 0x1061, 0x1C82, 0x24C2, 0x2CE3, 0x3524, 0x4145, 0x4586, 0x4DC7, 0x5609, 0x5E4B, 0x668C, 0x6EEE, 0x7730, 0x7B92 };
+const Color256 KIASectionPogo::kTextColors[] = {
+ { 0, 0, 0 },
+ { 16, 8, 8 },
+ { 32, 24, 8 },
+ { 56, 32, 16 },
+ { 72, 48, 16 },
+ { 88, 56, 24 },
+ { 104, 72, 32 },
+ { 128, 80, 40 },
+ { 136, 96, 48 },
+ { 152, 112, 56 },
+ { 168, 128, 72 },
+ { 184, 144, 88 },
+ { 200, 160, 96 },
+ { 216, 184, 112 },
+ { 232, 200, 128 },
+ { 240, 224, 144 }
+};
const char *KIASectionPogo::kStrings[] = {
"Air Conditioning",
@@ -242,7 +259,7 @@ void KIASectionPogo::draw(Graphics::Surface &surface) {
}
const char *title = "We 3 coders give special thanks to:";
- _vm->_mainFont->drawColor(title, surface, 313 - _vm->_mainFont->getTextWidth(title) / 2, 143, 0x7BB8);
+ _vm->_mainFont->drawColor(title, surface, 313 - _vm->_mainFont->getTextWidth(title) / 2, 143, surface.format.RGBToColor(240, 232, 192));
int y = 158;
for (int i = 0; i < kLineCount; ++i) {
@@ -264,7 +281,7 @@ void KIASectionPogo::draw(Graphics::Surface &surface) {
colorIndex = 63 - colorIndex;
}
colorIndex /= 2;
- _vm->_mainFont->drawColor(_lineTexts[i], surface, _lineOffsets[i], y, kTextColors[colorIndex]);
+ _vm->_mainFont->drawColor(_lineTexts[i], surface, _lineOffsets[i], y, surface.format.RGBToColor(kTextColors[colorIndex].r, kTextColors[colorIndex].g, kTextColors[colorIndex].b));
}
y += 10;
}
diff --git a/engines/bladerunner/ui/kia_section_pogo.h b/engines/bladerunner/ui/kia_section_pogo.h
index bcfd641c58..7392cde4cb 100644
--- a/engines/bladerunner/ui/kia_section_pogo.h
+++ b/engines/bladerunner/ui/kia_section_pogo.h
@@ -23,15 +23,16 @@
#ifndef BLADERUNNER_KIA_SECTION_POGO_H
#define BLADERUNNER_KIA_SECTION_POGO_H
+#include "bladerunner/color.h"
#include "bladerunner/ui/kia_section_base.h"
namespace BladeRunner {
class KIASectionPogo : public KIASectionBase {
- static const int kStringCount = 158;
- static const int kLineCount = 22;
- static const char *kStrings[];
- static const int kTextColors[];
+ static const int kStringCount = 158;
+ static const int kLineCount = 22;
+ static const char *kStrings[];
+ static const Color256 kTextColors[];
const char *_strings[kStringCount];
int _stringIndex;
diff --git a/engines/bladerunner/ui/kia_section_save.cpp b/engines/bladerunner/ui/kia_section_save.cpp
index b8fcd2e62d..17320c4e93 100644
--- a/engines/bladerunner/ui/kia_section_save.cpp
+++ b/engines/bladerunner/ui/kia_section_save.cpp
@@ -150,35 +150,35 @@ void KIASectionSave::draw(Graphics::Surface &surface){
if (_state == kStateNormal) {
const char *textChooseSlot = _vm->_textOptions->getText(24); // Choose a slot ...
int textChooseSlotWidth = _vm->_mainFont->getTextWidth(textChooseSlot);
- _vm->_mainFont->drawColor(textChooseSlot, surface, 308 - textChooseSlotWidth / 2, 143, 0x7BB8);
+ _vm->_mainFont->drawColor(textChooseSlot, surface, 308 - textChooseSlotWidth / 2, 143, surface.format.RGBToColor(240, 232, 192));
// Original game shows warnings/error here, but we don't have any
const char *textTypeName = _vm->_textOptions->getText(24); // Type a name ...
int textTypeNameWidth = _vm->_mainFont->getTextWidth(textTypeName);
- _vm->_mainFont->drawColor(textTypeName, surface, 308 - textTypeNameWidth / 2, 352, 0x7BB8);
+ _vm->_mainFont->drawColor(textTypeName, surface, 308 - textTypeNameWidth / 2, 352, surface.format.RGBToColor(240, 232, 192));
_uiContainer->draw(surface);
} else if (_state == kStateOverwrite) {
- surface.fillRect(Common::Rect(155, 230, 462, 239), 0x28E4);
+ surface.fillRect(Common::Rect(155, 230, 462, 239), surface.format.RGBToColor(80, 56, 32));
const Common::String &saveName = _saveList[_selectedLineId].getDescription();
int saveNameWidth = _vm->_mainFont->getTextWidth(saveName);
- _vm->_mainFont->drawColor(saveName, surface, 308 - saveNameWidth / 2, 230, 0x7751);
+ _vm->_mainFont->drawColor(saveName, surface, 308 - saveNameWidth / 2, 230, surface.format.RGBToColor(232, 208, 136));
const char *textOverwrite = _vm->_textOptions->getText(35); // Overwrite previously saved game?
int textOverwriteWidth = _vm->_mainFont->getTextWidth(textOverwrite);
- _vm->_mainFont->drawColor(textOverwrite, surface, 308 - textOverwriteWidth / 2, 240, 0x7BB8);
+ _vm->_mainFont->drawColor(textOverwrite, surface, 308 - textOverwriteWidth / 2, 240, surface.format.RGBToColor(240, 232, 192));
} else if (_state == kStateDelete) {
- surface.fillRect(Common::Rect(155, 230, 462, 239), 0x28E4);
+ surface.fillRect(Common::Rect(155, 230, 462, 239), surface.format.RGBToColor(80, 56, 32));
const Common::String &saveName = _saveList[_selectedLineId].getDescription();
int saveNameWidth = _vm->_mainFont->getTextWidth(saveName); // Delete this game?
- _vm->_mainFont->drawColor(saveName, surface, 308 - saveNameWidth / 2, 230, 0x7751);
+ _vm->_mainFont->drawColor(saveName, surface, 308 - saveNameWidth / 2, 230, surface.format.RGBToColor(232, 208, 136));
const char *textDelete = _vm->_textOptions->getText(40);
int textDeleteWidth = _vm->_mainFont->getTextWidth(textDelete);
- _vm->_mainFont->drawColor(textDelete, surface, 308 - textDeleteWidth / 2, 240, 0x7BB8);
+ _vm->_mainFont->drawColor(textDelete, surface, 308 - textDeleteWidth / 2, 240, surface.format.RGBToColor(240, 232, 192));
}
int selectedLineId = _scrollBox->getSelectedLineData();
diff --git a/engines/bladerunner/ui/kia_section_settings.cpp b/engines/bladerunner/ui/kia_section_settings.cpp
index 24c24acced..5492fbede8 100644
--- a/engines/bladerunner/ui/kia_section_settings.cpp
+++ b/engines/bladerunner/ui/kia_section_settings.cpp
@@ -167,35 +167,35 @@ void KIASectionSettings::draw(Graphics::Surface &surface) {
_uiContainer->draw(surface);
_playerAgendaSelector->draw(surface);
- _vm->_mainFont->drawColor(textConversationChoices, surface, posConversationChoices, 280, 0x7751);
+ _vm->_mainFont->drawColor(textConversationChoices, surface, posConversationChoices, 280, surface.format.RGBToColor(232, 208, 136));
- _vm->_mainFont->drawColor(textMusic, surface, posMusic, 150, 0x7751);
- _vm->_mainFont->drawColor(textSoft, surface, posSoft, 161, 0x6EEE);
- _vm->_mainFont->drawColor(textLoud, surface, 462, 161, 0x6EEE);
+ _vm->_mainFont->drawColor(textMusic, surface, posMusic, 150, surface.format.RGBToColor(232, 208, 136));
+ _vm->_mainFont->drawColor(textSoft, surface, posSoft, 161, surface.format.RGBToColor(216, 184, 112));
+ _vm->_mainFont->drawColor(textLoud, surface, 462, 161, surface.format.RGBToColor(216, 184, 112));
- _vm->_mainFont->drawColor(textSoundEffects, surface, posSoundEffects, 175, 0x7751);
- _vm->_mainFont->drawColor(textSoft, surface, posSoft, 186, 0x6EEE);
- _vm->_mainFont->drawColor(textLoud, surface, 462, 186, 0x6EEE);
+ _vm->_mainFont->drawColor(textSoundEffects, surface, posSoundEffects, 175, surface.format.RGBToColor(232, 208, 136));
+ _vm->_mainFont->drawColor(textSoft, surface, posSoft, 186, surface.format.RGBToColor(216, 184, 112));
+ _vm->_mainFont->drawColor(textLoud, surface, 462, 186, surface.format.RGBToColor(216, 184, 112));
#if BLADERUNNER_ORIGINAL_SETTINGS
- _vm->_mainFont->drawColor(textAmbientSound, surface, posAmbientSound, 200, 0x7751);
- _vm->_mainFont->drawColor(textSoft, surface, posSoft, 211, 0x6EEE);
- _vm->_mainFont->drawColor(textLoud, surface, 462, 211, 0x6EEE);
+ _vm->_mainFont->drawColor(textAmbientSound, surface, posAmbientSound, 200, surface.format.RGBToColor(232, 208, 136));
+ _vm->_mainFont->drawColor(textSoft, surface, posSoft, 211, surface.format.RGBToColor(216, 184, 112));
+ _vm->_mainFont->drawColor(textLoud, surface, 462, 211, surface.format.RGBToColor(216, 184, 112));
- _vm->_mainFont->drawColor(textSpeech, surface, posSpeech, 225, 0x7751);
- _vm->_mainFont->drawColor(textSoft, surface, posSoft, 236, 0x6EEE);
- _vm->_mainFont->drawColor(textLoud, surface, 462, 236, 0x6EEE);
+ _vm->_mainFont->drawColor(textSpeech, surface, posSpeech, 225, surface.format.RGBToColor(232, 208, 136));
+ _vm->_mainFont->drawColor(textSoft, surface, posSoft, 236, surface.format.RGBToColor(216, 184, 112));
+ _vm->_mainFont->drawColor(textLoud, surface, 462, 236, surface.format.RGBToColor(216, 184, 112));
- _vm->_mainFont->drawColor(textGammaCorrection, surface, posGammaCorrection, 250, 0x7751);
- _vm->_mainFont->drawColor(textDark, surface, posDark, 261, 0x6EEE);
- _vm->_mainFont->drawColor(textLight, surface, 462, 261, 0x6EEE);
+ _vm->_mainFont->drawColor(textGammaCorrection, surface, posGammaCorrection, 250, surface.format.RGBToColor(232, 208, 136));
+ _vm->_mainFont->drawColor(textDark, surface, posDark, 261, surface.format.RGBToColor(216, 184, 112));
+ _vm->_mainFont->drawColor(textLight, surface, 462, 261, surface.format.RGBToColor(216, 184, 112));
#else
- _vm->_mainFont->drawColor(textSpeech, surface, posSpeech, 200, 0x7751);
- _vm->_mainFont->drawColor(textSoft, surface, posSoft, 211, 0x6EEE);
- _vm->_mainFont->drawColor(textLoud, surface, 462, 211, 0x6EEE);
+ _vm->_mainFont->drawColor(textSpeech, surface, posSpeech, 200, surface.format.RGBToColor(232, 208, 136));
+ _vm->_mainFont->drawColor(textSoft, surface, posSoft, 211, surface.format.RGBToColor(216, 184, 112));
+ _vm->_mainFont->drawColor(textLoud, surface, 462, 211, surface.format.RGBToColor(216, 184, 112));
#endif
- _vm->_mainFont->drawColor(textDesignersCut, surface, 192, 365, 0x7751);
+ _vm->_mainFont->drawColor(textDesignersCut, surface, 192, 365, surface.format.RGBToColor(232, 208, 136));
if (_vm->_subtitles->isSystemActive()) {
// Allow this to be loading as an extra text item in the resource for text options
@@ -217,9 +217,9 @@ void KIASectionSettings::draw(Graphics::Surface &surface) {
const char *textSubtitles = strcmp(_vm->_textOptions->getText(42), "") == 0? subtitlesTranslation : _vm->_textOptions->getText(42); // +1 to the max of original index of textOptions which is 41
if (_vm->_language == Common::RU_RUS) {
- _vm->_mainFont->drawColor(textSubtitles, surface, 288, 376, 0x7751); // special case for Russian version, put the option in a new line to avoid overlap
+ _vm->_mainFont->drawColor(textSubtitles, surface, 288, 376, surface.format.RGBToColor(232, 208, 136)); // special case for Russian version, put the option in a new line to avoid overlap
} else {
- _vm->_mainFont->drawColor(textSubtitles, surface, 323, 365, 0x7751); // moved further to the right to avoid overlap with 'Designer's Cut' in some language versions (ESP)
+ _vm->_mainFont->drawColor(textSubtitles, surface, 323, 365, surface.format.RGBToColor(232, 208, 136)); // moved further to the right to avoid overlap with 'Designer's Cut' in some language versions (ESP)
}
}
diff --git a/engines/bladerunner/ui/kia_section_suspects.cpp b/engines/bladerunner/ui/kia_section_suspects.cpp
index bf397321fd..220b269f9d 100644
--- a/engines/bladerunner/ui/kia_section_suspects.cpp
+++ b/engines/bladerunner/ui/kia_section_suspects.cpp
@@ -175,7 +175,7 @@ void KIASectionSuspects::draw(Graphics::Surface &surface) {
}
if (_suspectPhotoShapeId == 14 || _suspectPhotoShapeId == 13) {
text = _vm->_textKIA->getText(49);
- _vm->_mainFont->drawColor(text, surface, 190 - _vm->_mainFont->getTextWidth(text) / 2, 201, 0x7FFF);
+ _vm->_mainFont->drawColor(text, surface, 190 - _vm->_mainFont->getTextWidth(text) / 2, 201, surface.format.RGBToColor(255, 255, 255));
}
_whereaboutsCheckBox->setChecked(_whereaboutsFilter);
@@ -186,22 +186,22 @@ void KIASectionSuspects::draw(Graphics::Surface &surface) {
_uiContainer->draw(surface);
- _vm->_mainFont->drawColor(_vm->_textKIA->getText(0), surface, 300, 162, 0x77DF);
- _vm->_mainFont->drawColor(_vm->_textKIA->getText(46), surface, 142, 248, 0x77DF);
- _vm->_mainFont->drawColor(_vm->_textKIA->getText(47), surface, 142, 308, 0x77DF);
- _vm->_mainFont->drawColor(_vm->_textKIA->getText(14), surface, 154, 319, 0x25B3);
- _vm->_mainFont->drawColor(_vm->_textKIA->getText(15), surface, 154, 329, 0x31F7);
- _vm->_mainFont->drawColor(_vm->_textKIA->getText(16), surface, 154, 339, 0x3A5B);
- _vm->_mainFont->drawColor(_vm->_textKIA->getText(17), surface, 154, 349, 0x31F7);
- _vm->_mainFont->drawColor(_vm->_textKIA->getText(48), surface, 154, 359, 0x25B3);
+ _vm->_mainFont->drawColor(_vm->_textKIA->getText(0), surface, 300, 162, surface.format.RGBToColor(232, 240, 248));
+ _vm->_mainFont->drawColor(_vm->_textKIA->getText(46), surface, 142, 248, surface.format.RGBToColor(232, 240, 248));
+ _vm->_mainFont->drawColor(_vm->_textKIA->getText(47), surface, 142, 308, surface.format.RGBToColor(232, 240, 248));
+ _vm->_mainFont->drawColor(_vm->_textKIA->getText(14), surface, 154, 319, surface.format.RGBToColor(72, 104, 152));
+ _vm->_mainFont->drawColor(_vm->_textKIA->getText(15), surface, 154, 329, surface.format.RGBToColor(96, 120, 184));
+ _vm->_mainFont->drawColor(_vm->_textKIA->getText(16), surface, 154, 339, surface.format.RGBToColor(112, 144, 216));
+ _vm->_mainFont->drawColor(_vm->_textKIA->getText(17), surface, 154, 349, surface.format.RGBToColor(96, 120, 184));
+ _vm->_mainFont->drawColor(_vm->_textKIA->getText(48), surface, 154, 359, surface.format.RGBToColor(72, 104, 152));
surface.fillRect(Common::Rect(120, 134, 250, 145), 0);
- surface.hLine(120, 133, 250, 0x18A5);
- surface.hLine(120, 146, 250, 0x2D4C);
- surface.vLine(119, 134, 145, 0x18A5);
- surface.vLine(251, 134, 145, 0x2D4C);
- surface.hLine(251, 146, 251, 0x2509);
+ surface.hLine(120, 133, 250, surface.format.RGBToColor(48, 40, 40));
+ surface.hLine(120, 146, 250, surface.format.RGBToColor(88, 80, 96));
+ surface.vLine(119, 134, 145, surface.format.RGBToColor(48, 40, 40));
+ surface.vLine(251, 134, 145, surface.format.RGBToColor(88, 80, 96));
+ surface.hLine(251, 146, 251, surface.format.RGBToColor(72, 64, 72));
char generatedText[64];
if (_suspectSelected == -1) {
@@ -219,7 +219,7 @@ void KIASectionSuspects::draw(Graphics::Surface &surface) {
}
}
- _vm->_mainFont->drawColor(text, surface, 185 - _vm->_mainFont->getTextWidth(text) / 2, 136, 0x46BF);
+ _vm->_mainFont->drawColor(text, surface, 185 - _vm->_mainFont->getTextWidth(text) / 2, 136, surface.format.RGBToColor(136, 168, 248));
_buttons->draw(surface);
_buttons->drawTooltip(surface, _mouseX, _mouseY);
diff --git a/engines/bladerunner/ui/scores.cpp b/engines/bladerunner/ui/scores.cpp
index 3134299a1d..4c4cb22d23 100644
--- a/engines/bladerunner/ui/scores.cpp
+++ b/engines/bladerunner/ui/scores.cpp
@@ -139,8 +139,8 @@ void Scores::tick() {
// vqaPlayer renders to _surfaceBack
blit(_vm->_surfaceBack, _vm->_surfaceFront);
- _vm->_surfaceFront.hLine(200, 139, 400, 0x3e0);
- _vm->_surfaceFront.hLine(200, 347, 400, 0x1f);
+ _vm->_surfaceFront.hLine(200, 139, 400, _vm->_surfaceFront.format.RGBToColor(0, 248, 0));
+ _vm->_surfaceFront.hLine(200, 347, 400, _vm->_surfaceFront.format.RGBToColor(0, 0, 248));
_font->draw(_txtScorers->getText(7), _vm->_surfaceFront, 200, 114);
diff --git a/engines/bladerunner/ui/ui_image_picker.cpp b/engines/bladerunner/ui/ui_image_picker.cpp
index cb7b61da8a..2a6d870512 100644
--- a/engines/bladerunner/ui/ui_image_picker.cpp
+++ b/engines/bladerunner/ui/ui_image_picker.cpp
@@ -216,8 +216,8 @@ void UIImagePicker::draw(Graphics::Surface &surface) {
}
if (_vm->_debugger->_viewUI) {
- surface.frameRect(img.rect, 0x7fff);
- _vm->_mainFont->drawColor(Common::String::format("%d", i), surface, (img.rect.left + img.rect.right) / 2, (img.rect.top + img.rect.bottom) / 2, 0x7fff);
+ surface.frameRect(img.rect, surface.format.RGBToColor(255, 255, 255));
+ _vm->_mainFont->drawColor(Common::String::format("%d", i), surface, (img.rect.left + img.rect.right) / 2, (img.rect.top + img.rect.bottom) / 2, surface.format.RGBToColor(255, 255, 255));
}
}
}
@@ -268,9 +268,9 @@ void UIImagePicker::drawTooltip(Graphics::Surface &surface, int x, int y) {
rect.top = 478 - height;
}
- surface.fillRect(rect, 0);
- surface.frameRect(rect, 0x7FFF);
- _vm->_mainFont->drawColor(tooltip, surface, rect.left + 2, rect.top, 0x7FFF);
+ surface.fillRect(rect, surface.format.RGBToColor(0, 0, 0));
+ surface.frameRect(rect, surface.format.RGBToColor(255, 255, 255));
+ _vm->_mainFont->drawColor(tooltip, surface, rect.left + 2, rect.top, surface.format.RGBToColor(255, 255, 255));
}
bool UIImagePicker::handleMouseAction(int x, int y, bool down, bool up, bool ignore) {
diff --git a/engines/bladerunner/ui/ui_input_box.cpp b/engines/bladerunner/ui/ui_input_box.cpp
index 6ad2db2578..e1b655ed89 100644
--- a/engines/bladerunner/ui/ui_input_box.cpp
+++ b/engines/bladerunner/ui/ui_input_box.cpp
@@ -55,10 +55,10 @@ void UIInputBox::draw(Graphics::Surface &surface) {
int rectHalfWidth = (_rect.right + _rect.left) / 2;
int textHalfWidth = _vm->_mainFont->getTextWidth(_text) / 2;
- _vm->_mainFont->drawColor(_text, surface, rectHalfWidth - textHalfWidth, _rect.top, 0x4DC7); // 10011 01110 00111
+ _vm->_mainFont->drawColor(_text, surface, rectHalfWidth - textHalfWidth, _rect.top, surface.format.RGBToColor(152, 112, 56));
if (_cursorIsVisible) {
- surface.vLine(textHalfWidth + rectHalfWidth + 2, _rect.top, _rect.bottom - 1, 0x7FDD); // 11111 11110 11101
+ surface.vLine(textHalfWidth + rectHalfWidth + 2, _rect.top, _rect.bottom - 1, surface.format.RGBToColor(248, 240, 232));
}
if (_vm->_time->currentSystem() - _timeLast > 500) {
diff --git a/engines/bladerunner/ui/ui_scroll_box.cpp b/engines/bladerunner/ui/ui_scroll_box.cpp
index 5bf96c77fe..0273803b24 100644
--- a/engines/bladerunner/ui/ui_scroll_box.cpp
+++ b/engines/bladerunner/ui/ui_scroll_box.cpp
@@ -34,12 +34,52 @@
namespace BladeRunner {
-const int UIScrollBox::k3DFrameColors[] = { 0x1083, 0x14A5, 0x14A6, 0x2508, 0x5230, 0x5230, 0x0000, 0x0000 };
-const int UIScrollBox::kTextBackgroundColors[] = { 0x14EA, 0x190C, 0x1D2E, 0x2570, 0x4F1F, 0x0000 };
-const int UIScrollBox::kTextColors1[] = { 0x25B3, 0x31F7, 0x3A5B, 0x46BF, 0x4F1F };
-const int UIScrollBox::kTextColors2[] = { 0x677F, 0x6F9F, 0x73BF, 0x77DF, 0x7FFF };
-const int UIScrollBox::kTextColors3[] = { 0x7BB8, 0x7BBA, 0x7BDB, 0x7FDD, 0x7FFF };
-const int UIScrollBox::kTextColors4[] = { 0x4DC7, 0x5E4B, 0x6EEE, 0x7751, 0x7F92 };
+const Color256 UIScrollBox::k3DFrameColors[] = {
+ { 32, 32, 24 },
+ { 40, 40, 40 },
+ { 40, 40, 48 },
+ { 72, 64, 64 },
+ { 160, 136, 128 },
+ { 160, 136, 128 },
+ { 0, 0, 0 },
+ { 0, 0, 0 }
+};
+const Color256 UIScrollBox::kTextBackgroundColors[] = {
+ { 40, 56, 80 },
+ { 48, 64, 96 },
+ { 56, 72, 112 },
+ { 72, 88, 128 },
+ { 152, 192, 248 },
+ { 0, 0, 0 }
+};
+const Color256 UIScrollBox::kTextColors1[] = {
+ { 72, 104, 152 },
+ { 96, 120, 184 },
+ { 112, 144, 216 },
+ { 136, 168, 248 },
+ { 152, 192, 248 }
+};
+const Color256 UIScrollBox::kTextColors2[] = {
+ { 200, 216, 248 },
+ { 216, 224, 248 },
+ { 224, 232, 248 },
+ { 232, 240, 248 },
+ { 248, 248, 248 }
+};
+const Color256 UIScrollBox::kTextColors3[] = {
+ { 240, 232, 192 },
+ { 240, 232, 208 },
+ { 240, 240, 216 },
+ { 248, 240, 232 },
+ { 248, 248, 248 }
+};
+const Color256 UIScrollBox::kTextColors4[] = {
+ { 152, 112, 56 },
+ { 184, 144, 88 },
+ { 216, 184, 112 },
+ { 232, 208, 136 },
+ { 248, 224, 144 }
+};
UIScrollBox::UIScrollBox(BladeRunnerEngine *vm, UIScrollBoxCallback *lineSelectedCallback, void *callbackData, int maxLineCount, int style, bool center, Common::Rect rect, Common::Rect scrollBarRect) : UIComponent(vm) {
_selectedLineState = 0;
@@ -438,16 +478,16 @@ void UIScrollBox::draw(Graphics::Surface &surface) {
if ((((_selectedLineState == 0 && i == _hoveredLine) || (_selectedLineState == 2 && i == _selectedLineIndex && _selectedLineIndex == _hoveredLine)) && _lines[i]->lineData != -1) || _lines[i]->flags & 0x04) {
v35 = true;
if (_style) {
- color = kTextColors2[colorIndex];
+ color = surface.format.RGBToColor(kTextColors2[colorIndex].r, kTextColors2[colorIndex].g, kTextColors2[colorIndex].b);
} else {
- color = kTextColors3[colorIndex];
+ color = surface.format.RGBToColor(kTextColors3[colorIndex].r, kTextColors3[colorIndex].g, kTextColors3[colorIndex].b);
}
}
else {
if (_style) {
- color = kTextColors1[colorIndex];
+ color = surface.format.RGBToColor(kTextColors1[colorIndex].r, kTextColors1[colorIndex].g, kTextColors1[colorIndex].b);
} else {
- color = kTextColors4[colorIndex];
+ color = surface.format.RGBToColor(kTextColors4[colorIndex].r, kTextColors4[colorIndex].g, kTextColors4[colorIndex].b);
}
}
@@ -492,9 +532,9 @@ void UIScrollBox::draw(Graphics::Surface &surface) {
if (_lines[i]->flags & 0x08) { // has background rectangle
int colorBackground = 0;
if (_style) {
- colorBackground = kTextBackgroundColors[colorIndex];
+ colorBackground = surface.format.RGBToColor(kTextBackgroundColors[colorIndex].r, kTextBackgroundColors[colorIndex].g, kTextBackgroundColors[colorIndex].b);
} else {
- colorBackground = 0x28E4;
+ colorBackground = surface.format.RGBToColor(80, 56, 32);
}
surface.fillRect(Common::Rect(x, y, _rect.right + 1, y1 + 1), colorBackground);
}
@@ -639,14 +679,15 @@ void UIScrollBox::draw3DFrame(Graphics::Surface &surface, Common::Rect rect, boo
int color1, color2;
if (pressed) {
- color1 = k3DFrameColors[style + 6];
- color2 = k3DFrameColors[style + 4];
+ color1 = surface.format.RGBToColor(k3DFrameColors[style + 6].r, k3DFrameColors[style + 6].g, k3DFrameColors[style + 6].b);
+ color2 = surface.format.RGBToColor(k3DFrameColors[style + 4].r, k3DFrameColors[style + 4].g, k3DFrameColors[style + 4].b);
} else {
- color1 = k3DFrameColors[style + 4];
- color2 = k3DFrameColors[style + 6];
+ color1 = surface.format.RGBToColor(k3DFrameColors[style + 4].r, k3DFrameColors[style + 4].g, k3DFrameColors[style + 4].b);
+ color2 = surface.format.RGBToColor(k3DFrameColors[style + 6].r, k3DFrameColors[style + 6].g, k3DFrameColors[style + 6].b);
}
- int fillColor = k3DFrameColors[style + 2];
+ int color3 = surface.format.RGBToColor(k3DFrameColors[style].r, k3DFrameColors[style].g, k3DFrameColors[style].b);
+ int fillColor = surface.format.RGBToColor(k3DFrameColors[style + 2].r, k3DFrameColors[style + 2].g, k3DFrameColors[style + 2].b);
surface.fillRect(Common::Rect(rect.left + 1, rect.top + 1, rect.right - 1, rect.bottom - 1), fillColor);
@@ -654,8 +695,8 @@ void UIScrollBox::draw3DFrame(Graphics::Surface &surface, Common::Rect rect, boo
surface.hLine(rect.left + 1, rect.bottom - 1, rect.right - 2, color2);
surface.vLine(rect.left, rect.top, rect.bottom - 2, color1);
surface.vLine(rect.right - 1, rect.top + 1, rect.bottom - 1, color2);
- surface.hLine(rect.right - 1, rect.top, rect.right - 1, k3DFrameColors[style]);
- surface.hLine(rect.left, rect.bottom - 1, rect.left, k3DFrameColors[style]);
+ surface.hLine(rect.right - 1, rect.top, rect.right - 1, color3);
+ surface.hLine(rect.left, rect.bottom - 1, rect.left, color3);
}
void UIScrollBox::scrollUp() {
diff --git a/engines/bladerunner/ui/ui_scroll_box.h b/engines/bladerunner/ui/ui_scroll_box.h
index f2b40a9936..1cd2913525 100644
--- a/engines/bladerunner/ui/ui_scroll_box.h
+++ b/engines/bladerunner/ui/ui_scroll_box.h
@@ -23,6 +23,7 @@
#ifndef BLADERUNNER_UI_SCROLLBOX_H
#define BLADERUNNER_UI_SCROLLBOX_H
+#include "bladerunner/color.h"
#include "bladerunner/ui/ui_component.h"
#include "common/array.h"
@@ -35,12 +36,12 @@ typedef void UIScrollBoxCallback(void *callbackData, void *source, int lineData,
class UIScrollBox : public UIComponent {
static const int kLineHeight = 10;
- static const int k3DFrameColors[];
- static const int kTextBackgroundColors[];
- static const int kTextColors1[];
- static const int kTextColors2[];
- static const int kTextColors3[];
- static const int kTextColors4[];
+ static const Color256 k3DFrameColors[];
+ static const Color256 kTextBackgroundColors[];
+ static const Color256 kTextColors1[];
+ static const Color256 kTextColors2[];
+ static const Color256 kTextColors3[];
+ static const Color256 kTextColors4[];
struct Line {
Common::String text;
diff --git a/engines/bladerunner/ui/ui_slider.cpp b/engines/bladerunner/ui/ui_slider.cpp
index c008331c82..c1a5d0ab2d 100644
--- a/engines/bladerunner/ui/ui_slider.cpp
+++ b/engines/bladerunner/ui/ui_slider.cpp
@@ -29,7 +29,24 @@
namespace BladeRunner {
-const uint16 UISlider::kColors[] = { 0x0000, 0x0821, 0x1061, 0x1C82, 0x24C2, 0x2CE3, 0x3524, 0x4145, 0x4586, 0x4DC7, 0x5609, 0x5E4B, 0x668C, 0x6EEE, 0x7730, 0x7B92 };
+const Color256 UISlider::kColors[] = {
+ { 0, 0, 0 },
+ { 16, 8, 8 },
+ { 32, 24, 8 },
+ { 56, 32, 16 },
+ { 72, 48, 16 },
+ { 88, 56, 24 },
+ { 104, 72, 32 },
+ { 128, 80, 40 },
+ { 136, 96, 48 },
+ { 152, 112, 56 },
+ { 168, 128, 72 },
+ { 184, 144, 88 },
+ { 200, 160, 96 },
+ { 216, 184, 112 },
+ { 232, 200, 128 },
+ { 240, 224, 144 }
+};
UISlider::UISlider(BladeRunnerEngine *vm, UIComponentCallback *valueChangedCallback, void *callbackData, Common::Rect rect, int maxValue, int value)
: UIComponent(vm) {
@@ -70,7 +87,7 @@ void UISlider::draw(Graphics::Surface &surface) {
--_currentFrameColor;
}
- surface.frameRect(_rect, kColors[_currentFrameColor]);
+ surface.frameRect(_rect, surface.format.RGBToColor(kColors[_currentFrameColor].r, kColors[_currentFrameColor].g, kColors[_currentFrameColor].b));
int sliderX = 0;
if (_maxValue <= 1) {
@@ -98,7 +115,7 @@ void UISlider::draw(Graphics::Surface &surface) {
colorIndex = 3;
}
- uint16 color = kColors[colorIndex];
+ uint16 color = surface.format.RGBToColor(kColors[colorIndex].r, kColors[colorIndex].g, kColors[colorIndex].b);
if ((striding + x) & 1 || x == sliderX) {
color = 0;
}
diff --git a/engines/bladerunner/ui/ui_slider.h b/engines/bladerunner/ui/ui_slider.h
index 2783cb03f1..146f63816c 100644
--- a/engines/bladerunner/ui/ui_slider.h
+++ b/engines/bladerunner/ui/ui_slider.h
@@ -23,6 +23,7 @@
#ifndef BLADERUNNER_UI_SLIDER_H
#define BLADERUNNER_UI_SLIDER_H
+#include "bladerunner/color.h"
#include "bladerunner/ui/ui_component.h"
#include "common/rect.h"
@@ -30,7 +31,7 @@
namespace BladeRunner {
class UISlider : public UIComponent {
- static const uint16 kColors[];
+ static const Color256 kColors[];
UIComponentCallback *_valueChangedCallback;
void *_callbackData;
diff --git a/engines/bladerunner/ui/vk.cpp b/engines/bladerunner/ui/vk.cpp
index d6055d5133..821cf26816 100644
--- a/engines/bladerunner/ui/vk.cpp
+++ b/engines/bladerunner/ui/vk.cpp
@@ -115,7 +115,7 @@ void VK::open(int actorId, int calibrationRatio) {
return;
}
- _surfaceEye.create(172, 116, createRGB555());
+ _surfaceEye.create(172, 116, screenPixelForrmat());
_vqaPlayerEye = new VQAPlayer(_vm, &_surfaceEye, eyeVqa);
if (!_vqaPlayerEye->open()) {
return;
@@ -683,16 +683,15 @@ void VK::drawNeedle(Graphics::Surface &surface) {
float colorIntensity = MIN(78.0f, _needleValue + 39.0f) / 78.0f;
- int r = 6 * colorIntensity;
- int g = 8 * colorIntensity;
- int b = 12 * colorIntensity;
+ uint16 color1 = surface.format.RGBToColor(56 - 48 * colorIntensity, 144 - 64 * colorIntensity, 184 - 96 * colorIntensity);
+ uint16 color2 = surface.format.RGBToColor(56 - 24 * colorIntensity, 144 - 32 * colorIntensity, 184 - 48 * colorIntensity);
- surface.drawLine(203, 324, x - 2, y, ((7 - r ) << 10) | ((18 - g ) << 5) | (23 - b ));
- surface.drawLine(203, 324, x + 2, y, ((7 - r ) << 10) | ((18 - g ) << 5) | (23 - b ));
- surface.drawLine(203, 324, x - 1, y, ((7 - r / 2) << 10) | ((18 - g / 2) << 5) | (23 - b / 2));
- surface.drawLine(203, 324, x + 1, y, ((7 - r / 2) << 10) | ((18 - g / 2) << 5) | (23 - b / 2));
- surface.drawLine(203, 324, x, y - 1, ((7 - r / 2) << 10) | ((18 - g / 2) << 5) | (23 - b / 2));
- surface.drawLine(203, 324, x, y, 0x1E57);
+ surface.drawLine(203, 324, x - 2, y, color1);
+ surface.drawLine(203, 324, x + 2, y, color1);
+ surface.drawLine(203, 324, x - 1, y, color2);
+ surface.drawLine(203, 324, x + 1, y, color2);
+ surface.drawLine(203, 324, x, y - 1, color2);
+ surface.drawLine(203, 324, x, y, surface.format.RGBToColor(56, 144, 184));
}
void VK::drawEye(Graphics::Surface &surface) {
@@ -701,24 +700,24 @@ void VK::drawEye(Graphics::Surface &surface) {
}
void VK::drawEyeCrosshair(Graphics::Surface &surface, int timeNow) {
- surface.drawLine(315, _eyeLineY, 486, _eyeLineY, 0x848u);
- surface.drawLine(315, _eyeLineY - 1, 486, _eyeLineY - 1, 0x848u);
- surface.drawLine(315, _eyeLineY, _vm->_rnd.getRandomNumberRng(10, 20) + 315, _eyeLineY, 0x84Au);
- surface.drawLine(486 - _vm->_rnd.getRandomNumberRng(10, 20), _eyeLineY, 486, _eyeLineY, 0x84Au);
- surface.drawLine(486 - _vm->_rnd.getRandomNumberRng(10, 20), _eyeLineY - 1, 486, _eyeLineY - 1, 0x846u);
- surface.drawLine(315, _eyeLineY - 1, _vm->_rnd.getRandomNumberRng(10, 20) + 315, _eyeLineY - 1, 0x846u);
-
- surface.drawLine(_eyeLineX, 281, _eyeLineX, 396, 0x848u);
- surface.drawLine(_eyeLineX - 1, 281, _eyeLineX - 1, 396, 0x848u);
- surface.drawLine(_eyeLineX, 281, _eyeLineX, _vm->_rnd.getRandomNumberRng(10, 20) + 281, 0x846u);
- surface.drawLine(_eyeLineX, 396 - _vm->_rnd.getRandomNumberRng(10, 20), _eyeLineX, 396, 0x846u);
- surface.drawLine(_eyeLineX - 1, 396 - _vm->_rnd.getRandomNumberRng(10, 20), _eyeLineX - 1, 396, 0x84Au);
- surface.drawLine(_eyeLineX - 1, 281, _eyeLineX - 1, _vm->_rnd.getRandomNumberRng(10, 20) + 281, 0x84Au);
+ surface.drawLine(315, _eyeLineY, 486, _eyeLineY, surface.format.RGBToColor(16, 16, 64));
+ surface.drawLine(315, _eyeLineY - 1, 486, _eyeLineY - 1, surface.format.RGBToColor(16, 16, 64));
+ surface.drawLine(315, _eyeLineY, _vm->_rnd.getRandomNumberRng(10, 20) + 315, _eyeLineY, surface.format.RGBToColor(16, 16, 80));
+ surface.drawLine(486 - _vm->_rnd.getRandomNumberRng(10, 20), _eyeLineY, 486, _eyeLineY, surface.format.RGBToColor(16, 16, 80));
+ surface.drawLine(486 - _vm->_rnd.getRandomNumberRng(10, 20), _eyeLineY - 1, 486, _eyeLineY - 1, surface.format.RGBToColor(16, 16, 48));
+ surface.drawLine(315, _eyeLineY - 1, _vm->_rnd.getRandomNumberRng(10, 20) + 315, _eyeLineY - 1, surface.format.RGBToColor(16, 16, 48));
+
+ surface.drawLine(_eyeLineX, 281, _eyeLineX, 396, surface.format.RGBToColor(16, 16, 64));
+ surface.drawLine(_eyeLineX - 1, 281, _eyeLineX - 1, 396, surface.format.RGBToColor(16, 16, 64));
+ surface.drawLine(_eyeLineX, 281, _eyeLineX, _vm->_rnd.getRandomNumberRng(10, 20) + 281, surface.format.RGBToColor(16, 16, 48));
+ surface.drawLine(_eyeLineX, 396 - _vm->_rnd.getRandomNumberRng(10, 20), _eyeLineX, 396, surface.format.RGBToColor(16, 16, 48));
+ surface.drawLine(_eyeLineX - 1, 396 - _vm->_rnd.getRandomNumberRng(10, 20), _eyeLineX - 1, 396, surface.format.RGBToColor(16, 16, 80));
+ surface.drawLine(_eyeLineX - 1, 281, _eyeLineX - 1, _vm->_rnd.getRandomNumberRng(10, 20) + 281, surface.format.RGBToColor(16, 16, 80));
if (timeNow >= _timeNextEyeLineStart) {
if (_eyeLineSelected) {
if (_eyeLineYLast != _eyeLineY) {
- surface.drawLine(315, _eyeLineYLast, 486, _eyeLineYLast, 0x844u);
+ surface.drawLine(315, _eyeLineYLast, 486, _eyeLineYLast, surface.format.RGBToColor(16, 16, 32));
}
_eyeLineYLast = _eyeLineY;
if (timeNow >= _timeNextEyeLineStep) {
@@ -738,7 +737,7 @@ void VK::drawEyeCrosshair(Graphics::Surface &surface, int timeNow) {
}
} else {
if (_eyeLineXLast != _eyeLineX) {
- surface.drawLine(_eyeLineXLast, 281, _eyeLineXLast, 396, 0x844u);
+ surface.drawLine(_eyeLineXLast, 281, _eyeLineXLast, 396, surface.format.RGBToColor(16, 16, 32));
}
_eyeLineXLast = _eyeLineX;
if (timeNow >= _timeNextEyeLineStep) {