aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/bladerunner/bladerunner.cpp13
-rw-r--r--engines/bladerunner/bladerunner.h11
-rw-r--r--engines/bladerunner/debugger.cpp51
-rw-r--r--engines/bladerunner/dialogue_menu.cpp13
-rw-r--r--engines/bladerunner/font.cpp35
-rw-r--r--engines/bladerunner/font.h2
-rw-r--r--engines/bladerunner/image.cpp4
-rw-r--r--engines/bladerunner/obstacles.cpp12
-rw-r--r--engines/bladerunner/outtake.cpp2
-rw-r--r--engines/bladerunner/savefile.cpp4
-rw-r--r--engines/bladerunner/shape.cpp20
-rw-r--r--engines/bladerunner/slice_animations.cpp6
-rw-r--r--engines/bladerunner/slice_renderer.cpp21
-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
-rw-r--r--engines/bladerunner/vqa_decoder.cpp45
33 files changed, 402 insertions, 341 deletions
diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp
index 31aae35823..e8a22a8c04 100644
--- a/engines/bladerunner/bladerunner.cpp
+++ b/engines/bladerunner/bladerunner.cpp
@@ -302,7 +302,7 @@ void BladeRunnerEngine::pauseEngineIntern(bool pause) {
}
Common::Error BladeRunnerEngine::run() {
- Graphics::PixelFormat format = createRGB555();
+ Graphics::PixelFormat format = screenPixelForrmat();
initGraphics(640, 480, &format);
_system->showMouse(true);
@@ -375,8 +375,8 @@ bool BladeRunnerEngine::startup(bool hasSavegames) {
// This is the original startup in the game
- _surfaceFront.create(640, 480, createRGB555());
- _surfaceBack.create(640, 480, createRGB555());
+ _surfaceFront.create(640, 480, screenPixelForrmat());
+ _surfaceBack.create(640, 480, screenPixelForrmat());
_time = new Time(this);
@@ -535,7 +535,7 @@ bool BladeRunnerEngine::startup(bool hasSavegames) {
_scores = new Scores(this);
_mainFont = new Font(this);
- _mainFont->open("KIA6PT.FON", 640, 480, -1, 0, 0x252D);
+ _mainFont->open("KIA6PT.FON", 640, 480, -1, 0, _surfaceFront.format.RGBToColor(72, 72, 104));
_mainFont->setSpacing(1, 0);
for (int i = 0; i != 43; ++i) {
@@ -1874,7 +1874,7 @@ void BladeRunnerEngine::playerDied() {
_kia->open(kKIASectionLoad);
}
-bool BladeRunnerEngine::saveGame(Common::WriteStream &stream, const Graphics::Surface &thumbnail) {
+bool BladeRunnerEngine::saveGame(Common::WriteStream &stream, Graphics::Surface &thumbnail) {
if ( !_gameIsAutoSaving
&& ( !playerHasControl() || _sceneScript->isInsideScript() || _aiScripts->isInsideScript())
){
@@ -1884,6 +1884,7 @@ bool BladeRunnerEngine::saveGame(Common::WriteStream &stream, const Graphics::Su
Common::MemoryWriteStreamDynamic memoryStream(DisposeAfterUse::YES);
SaveFileWriteStream s(memoryStream);
+ thumbnail.convertToInPlace(gameDataPixelFormat());
s.write(thumbnail.getPixels(), SaveFileManager::kThumbnailSize);
s.writeFloat(1.0f);
_settings->save(s);
@@ -2080,7 +2081,7 @@ void BladeRunnerEngine::blitToScreen(const Graphics::Surface &src) const {
Graphics::Surface BladeRunnerEngine::generateThumbnail() const {
Graphics::Surface thumbnail;
- thumbnail.create(640 / 8, 480 / 8, createRGB555());
+ thumbnail.create(640 / 8, 480 / 8, _surfaceFront.format);
for (int y = 0; y < thumbnail.h; ++y) {
for (int x = 0; x < thumbnail.w; ++x) {
diff --git a/engines/bladerunner/bladerunner.h b/engines/bladerunner/bladerunner.h
index c3e53eb7a5..fad396d831 100644
--- a/engines/bladerunner/bladerunner.h
+++ b/engines/bladerunner/bladerunner.h
@@ -294,7 +294,7 @@ public:
void playerGainsControl();
void playerDied();
- bool saveGame(Common::WriteStream &stream, const Graphics::Surface &thumbnail);
+ bool saveGame(Common::WriteStream &stream, Graphics::Surface &thumbnail);
bool loadGame(Common::SeekableReadStream &stream);
void newGame(int difficulty);
void autoSaveGame(int textId, bool endgame);
@@ -308,8 +308,13 @@ public:
Common::String getTargetName() const;
};
-static inline const Graphics::PixelFormat createRGB555() {
- return Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0);
+static inline const Graphics::PixelFormat gameDataPixelFormat() {
+ return Graphics::PixelFormat(2, 5, 5, 5, 1, 10, 5, 0, 15);
+}
+
+static inline const Graphics::PixelFormat screenPixelForrmat() {
+ // Should be a format supported by Android port
+ return Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0);
}
void blit(const Graphics::Surface &src, Graphics::Surface &dst);
diff --git a/engines/bladerunner/debugger.cpp b/engines/bladerunner/debugger.cpp
index 5a3aa245c8..9d31e5ea27 100644
--- a/engines/bladerunner/debugger.cpp
+++ b/engines/bladerunner/debugger.cpp
@@ -1129,13 +1129,13 @@ void Debugger::drawSceneObjects() {
case kSceneObjectTypeUnknown:
break;
case kSceneObjectTypeActor:
- color = 0x7C00; // 11111 00000 00000;
+ color = _vm->_surfaceFront.format.RGBToColor(255, 0, 0);
drawBBox(a, b, _vm->_view, &_vm->_surfaceFront, color);
_vm->_surfaceFront.frameRect(sceneObject->screenRectangle, color);
_vm->_mainFont->drawColor(_vm->_textActorNames->getText(sceneObject->id - kSceneObjectOffsetActors), _vm->_surfaceFront, pos.x, pos.y, color);
break;
case kSceneObjectTypeItem:
- color = 0x03E0; // 00000 11111 00000
+ color = _vm->_surfaceFront.format.RGBToColor(0, 255, 0);
char itemText[40];
drawBBox(a, b, _vm->_view, &_vm->_surfaceFront, color);
sprintf(itemText, "item %i", sceneObject->id - kSceneObjectOffsetItems);
@@ -1143,11 +1143,9 @@ void Debugger::drawSceneObjects() {
_vm->_mainFont->drawColor(itemText, _vm->_surfaceFront, pos.x, pos.y, color);
break;
case kSceneObjectTypeObject:
- color = 0x3DEF; //01111 01111 01111;
- //if (sceneObject->_isObstacle)
- // color += 0b100000000000000;
+ color = _vm->_surfaceFront.format.RGBToColor(127, 127, 127);
if (sceneObject->isClickable) {
- color = 0x03E0; // 00000 11111 00000;
+ color = _vm->_surfaceFront.format.RGBToColor(0, 255, 0);
}
drawBBox(a, b, _vm->_view, &_vm->_surfaceFront, color);
_vm->_surfaceFront.frameRect(sceneObject->screenRectangle, color);
@@ -1175,10 +1173,7 @@ void Debugger::drawLights() {
posTarget.z = -t;
Vector3 size = Vector3(5.0f, 5.0f, 5.0f);
- int colorR = (light->_color.r * 31.0f);
- int colorG = (light->_color.g * 31.0f);
- int colorB = (light->_color.b * 31.0f);
- int color = (colorR << 10) + (colorG << 5) + colorB;
+ int color = _vm->_surfaceFront.format.RGBToColor(light->_color.r * 255.0f, light->_color.g * 255.0f, light->_color.b * 255.0f);
drawBBox(posOrigin - size, posOrigin + size, _vm->_view, &_vm->_surfaceFront, color);
@@ -1209,10 +1204,7 @@ void Debugger::drawFogs() {
posTarget.z = -t;
Vector3 size = Vector3(5.0f, 5.0f, 5.0f);
- int colorR = (fog->_fogColor.r * 31.0f);
- int colorG = (fog->_fogColor.g * 31.0f);
- int colorB = (fog->_fogColor.b * 31.0f);
- int color = (colorR << 10) + (colorG << 5) + colorB;
+ int color = _vm->_surfaceFront.format.RGBToColor(fog->_fogColor.r * 255.0f, fog->_fogColor.g * 255.0f, fog->_fogColor.b * 255.0f);
drawBBox(posOrigin - size, posOrigin + size, _vm->_view, &_vm->_surfaceFront, color);
@@ -1231,14 +1223,14 @@ void Debugger::drawRegions() {
for (int i = 0; i < 10; i++) {
Regions::Region *region = &_vm->_scene->_regions->_regions[i];
if (!region->present) continue;
- _vm->_surfaceFront.frameRect(region->rectangle, 0x001F); // 00000 00000 11111
+ _vm->_surfaceFront.frameRect(region->rectangle, _vm->_surfaceFront.format.RGBToColor(0, 0, 255));
}
//draw exits
for (int i = 0; i < 10; i++) {
Regions::Region *region = &_vm->_scene->_exits->_regions[i];
if (!region->present) continue;
- _vm->_surfaceFront.frameRect(region->rectangle, 0x7FFF); // 11111 11111 11111
+ _vm->_surfaceFront.frameRect(region->rectangle, _vm->_surfaceFront.format.RGBToColor(255, 255, 255));
}
}
@@ -1251,7 +1243,7 @@ void Debugger::drawWaypoints() {
}
Vector3 pos = waypoint->position;
Vector3 size = Vector3(3.0f, 3.0f, 3.0f);
- int color = 0x7FFF; // 11111 11111 11111
+ int color = _vm->_surfaceFront.format.RGBToColor(255, 255, 255);
drawBBox(pos - size, pos + size, _vm->_view, &_vm->_surfaceFront, color);
Vector3 spos = _vm->_view->calculateScreenPosition(pos);
char waypointText[40];
@@ -1267,7 +1259,7 @@ void Debugger::drawWaypoints() {
}
Vector3 pos = cover->position;
Vector3 size = Vector3(3.0f, 3.0f, 3.0f);
- int color = 0x7C1F; // 11111 00000 11111
+ int color = _vm->_surfaceFront.format.RGBToColor(255, 0, 255);
drawBBox(pos - size, pos + size, _vm->_view, &_vm->_surfaceFront, color);
Vector3 spos = _vm->_view->calculateScreenPosition(pos);
char coverText[40];
@@ -1283,7 +1275,7 @@ void Debugger::drawWaypoints() {
}
Vector3 pos = flee->position;
Vector3 size = Vector3(3.0f, 3.0f, 3.0f);
- int color = 0x03FF; // 00000 11111 11111
+ int color = _vm->_surfaceFront.format.RGBToColor(0, 255, 255);
drawBBox(pos - size, pos + size, _vm->_view, &_vm->_surfaceFront, color);
Vector3 spos = _vm->_view->calculateScreenPosition(pos);
char fleeText[40];
@@ -1300,9 +1292,9 @@ void Debugger::drawWalkboxes() {
for (int j = 0; j < walkbox->vertexCount; j++) {
Vector3 start = _vm->_view->calculateScreenPosition(walkbox->vertices[j]);
Vector3 end = _vm->_view->calculateScreenPosition(walkbox->vertices[(j + 1) % walkbox->vertexCount]);
- _vm->_surfaceFront.drawLine(start.x, start.y, end.x, end.y, 0x7FE0); // 11111 11111 00000
+ _vm->_surfaceFront.drawLine(start.x, start.y, end.x, end.y, _vm->_surfaceFront.format.RGBToColor(255, 255, 0));
Vector3 pos = _vm->_view->calculateScreenPosition(0.5 * (start + end));
- _vm->_mainFont->drawColor(walkbox->name, _vm->_surfaceFront, pos.x, pos.y, 0x7FE0); // 11111 11111 00000
+ _vm->_mainFont->drawColor(walkbox->name, _vm->_surfaceFront, pos.x, pos.y, _vm->_surfaceFront.format.RGBToColor(255, 255, 0));
}
}
}
@@ -1317,19 +1309,16 @@ void Debugger::drawScreenEffects() {
Common::Rect r((entry.x + x) * 2, (entry.y + y) * 2, (entry.x + x) * 2 + 2, (entry.y + y) * 2 + 2);
int ec = entry.data[j++];
- Color256 color = entry.palette[ec];
- int bladeToScummVmConstant = 256 / 16;
-
- Graphics::PixelFormat _pixelFormat = createRGB555();
- int color555 = _pixelFormat.RGBToColor(
- CLIP(color.r * bladeToScummVmConstant, 0, 255),
- CLIP(color.g * bladeToScummVmConstant, 0, 255),
- CLIP(color.b * bladeToScummVmConstant, 0, 255));
- _vm->_surfaceFront.fillRect(r, color555);
+ const int bladeToScummVmConstant = 256 / 16;
+
+ int color = _vm->_surfaceFront.format.RGBToColor(
+ CLIP(entry.palette[ec].r * bladeToScummVmConstant, 0, 255),
+ CLIP(entry.palette[ec].g * bladeToScummVmConstant, 0, 255),
+ CLIP(entry.palette[ec].b * bladeToScummVmConstant, 0, 255));
+ _vm->_surfaceFront.fillRect(r, color);
}
}
}
}
-
} // End of namespace BladeRunner
diff --git a/engines/bladerunner/dialogue_menu.cpp b/engines/bladerunner/dialogue_menu.cpp
index 6339fa1ef6..fb777d958d 100644
--- a/engines/bladerunner/dialogue_menu.cpp
+++ b/engines/bladerunner/dialogue_menu.cpp
@@ -332,10 +332,10 @@ void DialogueMenu::draw(Graphics::Surface &s) {
Common::Point mouse = _vm->getMousePos();
if (mouse.x >= x && mouse.x < x2) {
- s.vLine(mouse.x, y1 + 8, y2 + 2, 0x2108);
+ s.vLine(mouse.x, y1 + 8, y2 + 2, s.format.RGBToColor(64, 64, 64));
}
if (mouse.y >= y && mouse.y < y2) {
- s.hLine(x1 + 8, mouse.y, x2 + 2, 0x2108);
+ s.hLine(x1 + 8, mouse.y, x2 + 2, s.format.RGBToColor(64, 64, 64));
}
_shapes[0].draw(s, x1, y1);
@@ -346,7 +346,7 @@ void DialogueMenu::draw(Graphics::Surface &s) {
for (int i = 0; i != _listSize; ++i) {
_shapes[1].draw(s, x1, y);
_shapes[4].draw(s, x2, y);
- uint16 color = ((_items[i].colorIntensity >> 1) << 10) | ((_items[i].colorIntensity >> 1) << 5) | _items[i].colorIntensity;
+ uint16 color = s.format.RGBToColor((_items[i].colorIntensity / 2) * (256 / 32), (_items[i].colorIntensity / 2) * (256 / 32), _items[i].colorIntensity * (256 / 32));
_vm->_mainFont->drawColor(_items[i].text, s, x, y, color);
y += kLineHeight;
}
@@ -519,7 +519,12 @@ void DialogueMenu::darkenRect(Graphics::Surface &s, int x1, int y1, int x2, int
for (int y = y1; y != y2; ++y) {
for (int x = x1; x != x2; ++x) {
uint16 *p = (uint16 *)s.getBasePtr(x, y);
- *p = (*p & 0x739C) >> 2; // 0 11100 11100 11100
+ uint8 r, g, b;
+ s.format.colorToRGB(*p, r, g, b);
+ r /= 4;
+ g /= 4;
+ b /= 4;
+ *p = s.format.RGBToColor(r, g, b);
}
}
}
diff --git a/engines/bladerunner/font.cpp b/engines/bladerunner/font.cpp
index 688bed1c45..6fa90e633d 100644
--- a/engines/bladerunner/font.cpp
+++ b/engines/bladerunner/font.cpp
@@ -44,6 +44,7 @@ bool Font::open(const Common::String &fileName, int screenWidth, int screenHeigh
_screenHeight = screenHeight;
_spacing1 = spacing1;
_spacing2 = spacing2;
+ _defaultColor = color;
_color = color;
Common::ScopedPtr<Common::SeekableReadStream> stream(_vm->getResourceStream(fileName));
@@ -69,9 +70,11 @@ bool Font::open(const Common::String &fileName, int screenWidth, int screenHeigh
_characters[i].height = stream->readUint32LE();
_characters[i].dataOffset = stream->readUint32LE();
}
+
for (int i = 0; i < _dataSize; i++) {
_data[i] = stream->readUint16LE();
}
+
return true;
}
@@ -90,10 +93,7 @@ void Font::setSpacing(int spacing1, int spacing2) {
}
void Font::setColor(uint16 color) {
- if (_data && _color != color) {
- replaceColor(_color, color);
- _color = color;
- }
+ _color = color;
}
void Font::draw(const Common::String &text, Graphics::Surface &surface, int x, int y) const {
@@ -114,9 +114,7 @@ void Font::draw(const Common::String &text, Graphics::Surface &surface, int x, i
}
void Font::drawColor(const Common::String &text, Graphics::Surface &surface, int x, int y, uint16 color) {
- if (_color != color) {
- setColor(color);
- }
+ setColor(color);
draw(text, surface, x, y);
}
@@ -159,23 +157,12 @@ void Font::reset() {
_screenHeight = 0;
_spacing1 = 0;
_spacing2 = 0;
- _color = 0x7FFF;
+ _color = screenPixelForrmat().RGBToColor(255, 255, 255);
_intersperse = 0;
memset(_characters, 0, 256 * sizeof(Character));
}
-void Font::replaceColor(uint16 oldColor, uint16 newColor) {
- if (!_data || !_dataSize) {
- return;
- }
- for (int i = 0; i < _dataSize; i++) {
- if (_data[i] == oldColor) {
- _data[i] = newColor;
- }
- }
-}
-
void Font::drawCharacter(const uint8 character, Graphics::Surface &surface, int x, int y) const {
uint8 characterIndex = character + 1;
if (x < 0 || x >= _screenWidth || y < 0 || y >= _screenHeight || !_data || characterIndex >= _characterCount) {
@@ -208,8 +195,14 @@ void Font::drawCharacter(const uint8 character, Graphics::Surface &surface, int
int currentX = x;
int endX = width + x - 1;
while (currentX <= endX && currentX < _screenWidth) {
- if ((*srcPtr & 0x8000) == 0) {
- *dstPtr = *srcPtr;
+ uint8 a, r, g, b;
+ gameDataPixelFormat().colorToARGB(*srcPtr, a, r, g, b);
+ if (!a) {
+ if (_color == _defaultColor) {
+ *dstPtr = surface.format.RGBToColor(r, g, b);
+ } else {
+ *dstPtr = _color;
+ }
}
dstPtr++;
srcPtr++;
diff --git a/engines/bladerunner/font.h b/engines/bladerunner/font.h
index 4af25468c6..ba5b32789d 100644
--- a/engines/bladerunner/font.h
+++ b/engines/bladerunner/font.h
@@ -54,6 +54,7 @@ class Font {
int _screenHeight;
int _spacing1;
int _spacing2;
+ uint16 _defaultColor;
uint16 _color;
int _intersperse;
@@ -76,7 +77,6 @@ public:
private:
void reset();
- void replaceColor(uint16 oldColor, uint16 newColor);
void drawCharacter(const uint8 character, Graphics::Surface &surface, int x, int y) const;
};
diff --git a/engines/bladerunner/image.cpp b/engines/bladerunner/image.cpp
index 19f9f0087d..bdd952b5c0 100644
--- a/engines/bladerunner/image.cpp
+++ b/engines/bladerunner/image.cpp
@@ -73,8 +73,8 @@ bool Image::open(const Common::String &name) {
#endif
}
- const Graphics::PixelFormat pixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0);
- _surface.init(width, height, 2*width, data, pixelFormat);
+ _surface.init(width, height, 2*width, data, gameDataPixelFormat());
+ _surface.convertToInPlace(screenPixelForrmat());
delete[] buf;
delete stream;
diff --git a/engines/bladerunner/obstacles.cpp b/engines/bladerunner/obstacles.cpp
index 1886de324d..c94f271e2d 100644
--- a/engines/bladerunner/obstacles.cpp
+++ b/engines/bladerunner/obstacles.cpp
@@ -950,7 +950,7 @@ void Obstacles::draw() {
_polygons[i].vertices[j].y
));
- _vm->_surfaceFront.drawLine(p0.x, p0.y, p1.x, p1.y, 0x7FFF);
+ _vm->_surfaceFront.drawLine(p0.x, p0.y, p1.x, p1.y, _vm->_surfaceFront.format.RGBToColor(255, 255, 255));
p0 = p1;
}
@@ -964,17 +964,17 @@ void Obstacles::draw() {
Vector3 p2 = _vm->_view->calculateScreenPosition(playerPos + Vector3( 12.0f, 0.0f, 12.0f));
Vector3 p3 = _vm->_view->calculateScreenPosition(playerPos + Vector3(-12.0f, 0.0f, 12.0f));
- _vm->_surfaceFront.drawLine(p0.x, p0.y, p1.x, p1.y, 0x7C00);
- _vm->_surfaceFront.drawLine(p1.x, p1.y, p2.x, p2.y, 0x7C00);
- _vm->_surfaceFront.drawLine(p2.x, p2.y, p3.x, p3.y, 0x7C00);
- _vm->_surfaceFront.drawLine(p3.x, p3.y, p0.x, p0.y, 0x7C00);
+ _vm->_surfaceFront.drawLine(p0.x, p0.y, p1.x, p1.y, _vm->_surfaceFront.format.RGBToColor(255, 0, 0));
+ _vm->_surfaceFront.drawLine(p1.x, p1.y, p2.x, p2.y, _vm->_surfaceFront.format.RGBToColor(255, 0, 0));
+ _vm->_surfaceFront.drawLine(p2.x, p2.y, p3.x, p3.y, _vm->_surfaceFront.format.RGBToColor(255, 0, 0));
+ _vm->_surfaceFront.drawLine(p3.x, p3.y, p0.x, p0.y, _vm->_surfaceFront.format.RGBToColor(255, 0, 0));
}
// draw path along polygons
for (int i = 1; i < _pathSize; ++i) {
Vector3 p0 = _vm->_view->calculateScreenPosition(Vector3(_path[i - 1].x, y, _path[i - 1].y));
Vector3 p1 = _vm->_view->calculateScreenPosition(Vector3(_path[i].x, y, _path[i].y));
- _vm->_surfaceFront.drawLine(p0.x, p0.y, p1.x, p1.y, 0x7C00);
+ _vm->_surfaceFront.drawLine(p0.x, p0.y, p1.x, p1.y, _vm->_surfaceFront.format.RGBToColor(255, 0, 0));
}
// draw "next" vertex
diff --git a/engines/bladerunner/outtake.cpp b/engines/bladerunner/outtake.cpp
index 986f6fc527..e38dff14a9 100644
--- a/engines/bladerunner/outtake.cpp
+++ b/engines/bladerunner/outtake.cpp
@@ -35,7 +35,7 @@ namespace BladeRunner {
OuttakePlayer::OuttakePlayer(BladeRunnerEngine *vm) {
_vm = vm;
- _surfaceVideo.create(_vm->_surfaceBack.w, _vm->_surfaceBack.h, createRGB555());
+ _surfaceVideo.create(_vm->_surfaceBack.w, _vm->_surfaceBack.h, screenPixelForrmat());
}
OuttakePlayer::~OuttakePlayer() {
diff --git a/engines/bladerunner/savefile.cpp b/engines/bladerunner/savefile.cpp
index b1e5aa3136..0a20f50e47 100644
--- a/engines/bladerunner/savefile.cpp
+++ b/engines/bladerunner/savefile.cpp
@@ -143,8 +143,8 @@ bool SaveFileManager::readHeader(Common::SeekableReadStream &in, SaveFileHeader
void *thumbnailData = malloc(kThumbnailSize); // freed by ScummVM's smartptr
s.read(thumbnailData, kThumbnailSize);
- header._thumbnail->init(80, 60, 160, thumbnailData, createRGB555());
-
+ header._thumbnail->init(80, 60, 160, thumbnailData, gameDataPixelFormat());
+ header._thumbnail->convertToInPlace(screenPixelForrmat());
s.seek(pos);
}
diff --git a/engines/bladerunner/shape.cpp b/engines/bladerunner/shape.cpp
index 828a8b2f39..39a7758a0f 100644
--- a/engines/bladerunner/shape.cpp
+++ b/engines/bladerunner/shape.cpp
@@ -103,22 +103,22 @@ void Shape::draw(Graphics::Surface &surface, int x, int y) const {
return;
}
- byte *src_p = _data + 2 * (src_y * _width + src_x);
- byte *dst_p = (byte *)surface.getBasePtr(dst_x, dst_y);
+ const uint8 *src_p = _data + 2 * (src_y * _width + src_x);
for (int yi = 0; yi != rect_h; ++yi) {
for (int xi = 0; xi != rect_w; ++xi) {
- uint16 color = READ_LE_UINT16(src_p);
- if ((color & 0x8000) == 0) {
- *(uint16 *)dst_p = color;
- }
-
+ uint16 shpColor = READ_LE_UINT16(src_p);
src_p += 2;
- dst_p += 2;
- }
+ uint8 a, r, g, b;
+ gameDataPixelFormat().colorToARGB(shpColor, a, r, g, b);
+ uint16 outColor = (uint16)surface.format.ARGBToColor(a, r, g, b);
+
+ if (!a) {
+ *(uint16 *)(surface.getBasePtr(dst_x + xi, dst_y + yi)) = outColor;
+ }
+ }
src_p += 2 * (_width - rect_w);
- dst_p += surface.pitch - 2 * rect_w;
}
}
diff --git a/engines/bladerunner/slice_animations.cpp b/engines/bladerunner/slice_animations.cpp
index 1b2c2e209b..2cff038326 100644
--- a/engines/bladerunner/slice_animations.cpp
+++ b/engines/bladerunner/slice_animations.cpp
@@ -56,10 +56,8 @@ bool SliceAnimations::open(const Common::String &name) {
_palettes[i].color[j].g = color_g;
_palettes[i].color[j].b = color_b;
- uint16 rgb555 = ((uint16)color_r << 10) |
- ((uint16)color_g << 5) |
- (uint16)color_b;
-
+ const int bladeToScummVmConstant = 256 / 32; // 5 bits to 8 bits
+ uint16 rgb555 = screenPixelForrmat().RGBToColor(color_r * bladeToScummVmConstant, color_g * bladeToScummVmConstant, color_b * bladeToScummVmConstant);
_palettes[i].color555[j] = rgb555;
}
}
diff --git a/engines/bladerunner/slice_renderer.cpp b/engines/bladerunner/slice_renderer.cpp
index 73d0cef929..e497b15c1c 100644
--- a/engines/bladerunner/slice_renderer.cpp
+++ b/engines/bladerunner/slice_renderer.cpp
@@ -36,7 +36,7 @@ namespace BladeRunner {
SliceRenderer::SliceRenderer(BladeRunnerEngine *vm) {
_vm = vm;
- _pixelFormat = createRGB555();
+ _pixelFormat = screenPixelForrmat();
for (int i = 0; i < 942; i++) { // yes, its going just to 942 and not 997
_animationsShadowEnabled[i] = true;
@@ -442,7 +442,6 @@ void SliceRenderer::drawInWorld(int animationId, int animationFrame, Vector3 pos
int frameY = sliceLineIterator._startY;
- uint16 *frameLinePtr = (uint16 *)surface.getPixels() + 640 * frameY;
uint16 *zBufferLinePtr = zbuffer + 640 * frameY;
while (sliceLineIterator._currentY <= sliceLineIterator._endY) {
@@ -468,13 +467,12 @@ void SliceRenderer::drawInWorld(int animationId, int animationFrame, Vector3 pos
_setEffectColor.g = setEffectColor.g * 31.0f * 65536.0f;
_setEffectColor.b = setEffectColor.b * 31.0f * 65536.0f;
- if (frameY >= 0 && frameY < 480) {
- drawSlice((int)sliceLine, true, frameLinePtr, zBufferLinePtr, frameY);
+ if (frameY >= 0 && frameY < surface.h) {
+ drawSlice((int)sliceLine, true, (uint16 *)surface.getBasePtr(0, frameY), zBufferLinePtr, frameY);
}
sliceLineIterator.advance();
frameY += 1;
- frameLinePtr += 640;
zBufferLinePtr += 640;
}
}
@@ -527,16 +525,14 @@ void SliceRenderer::drawOnScreen(int animationId, int animationFrame, int screen
float currentSlice = 0;
float sliceStep = 1.0f / size / _frameSliceHeight;
- uint16 *frameLinePtr = (uint16 *)surface.getPixels() + 640 * frameY;
uint16 lineZbuffer[640];
while (currentSlice < _frameSliceCount) {
- if (currentY >= 0 && currentY < 480) {
+ if (currentY >= 0 && currentY < surface.h) {
memset(lineZbuffer, 0xFF, 640 * 2);
- drawSlice(currentSlice, false, frameLinePtr, lineZbuffer, currentY);
+ drawSlice(currentSlice, false, (uint16 *)surface.getBasePtr(0, currentY), lineZbuffer, currentY);
currentSlice += sliceStep;
currentY--;
- frameLinePtr -= 640;
}
}
}
@@ -730,7 +726,12 @@ void SliceRenderer::drawShadowPolygon(int transparency, Graphics::Surface &surfa
if (z >= zMin) {
int index = (x & 3) + ((y & 3) << 2);
if (transparency - ditheringFactor[index] <= 0) {
- *pixel = ((*pixel & 0x7BDE) >> 1) + ((*pixel & 0x739C) >> 2);
+ uint8 r, g, b;
+ surface.format.colorToRGB(*pixel, r, g, b);
+ r *= 0.75f;
+ g *= 0.75f;
+ b *= 0.75f;
+ *pixel = surface.format.RGBToColor(r, g, b);
}
}
}
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) {
diff --git a/engines/bladerunner/vqa_decoder.cpp b/engines/bladerunner/vqa_decoder.cpp
index 05ad7a8449..e97d2383a9 100644
--- a/engines/bladerunner/vqa_decoder.cpp
+++ b/engines/bladerunner/vqa_decoder.cpp
@@ -830,42 +830,31 @@ bool VQADecoder::VQAVideoTrack::readVPTR(Common::SeekableReadStream *s, uint32 s
}
void VQADecoder::VQAVideoTrack::VPTRWriteBlock(Graphics::Surface *surface, unsigned int dstBlock, unsigned int srcBlock, int count, bool alpha) {
- uint16 *frame = (uint16 *)surface->getPixels();
- uint16 frame_width = _width;
- uint32 frame_stride = surface->w;
- uint16 block_width = _blockW;
- uint16 block_height = _blockH;
+ const uint8 *const block_src = &_codebook[2 * srcBlock * _blockW * _blockH];
- const uint8 *const block_src =
- &_codebook[2 * srcBlock * block_width * block_height];
+ int blocks_per_line = _width / _blockW;
- int blocks_per_line = frame_width / block_width;
+ for (int i = 0; i < count; ++i) {
+ uint32 dst_x = (dstBlock + i) % blocks_per_line * _blockW + _offsetX;
+ uint32 dst_y = (dstBlock + i) / blocks_per_line * _blockH + _offsetY;
- do {
- uint32 frame_x = dstBlock % blocks_per_line * block_width + _offsetX;
- uint32 frame_y = dstBlock / blocks_per_line * block_height + _offsetY;
-
- uint32 dst_offset = frame_x + frame_y * frame_stride;
+ const uint8 *src_p = block_src;
- const uint8 *__restrict src = block_src;
- uint16 *__restrict dst = frame + dst_offset;
+ for (int y = 0; y != _blockH; ++y) {
+ for (int x = 0; x != _blockW; ++x) {
+ uint16 vqaColor = READ_LE_UINT16(src_p);
+ src_p += 2;
- unsigned int block_y;
- for (block_y = 0; block_y != block_height; ++block_y) {
- unsigned int block_x;
- for (block_x = 0; block_x != block_width; ++block_x) {
- uint16 rgb555 = src[0] | (src[1] << 8);
- src += 2;
+ uint8 a, r, g, b;
+ gameDataPixelFormat().colorToARGB(vqaColor, a, r, g, b);
+ uint16 outColor = (uint16)surface->format.ARGBToColor(a, r, g, b);
- if (!(alpha && (rgb555 & 0x8000)))
- *dst = rgb555;
- ++dst;
+ if (!(alpha && a)) {
+ *(uint16 *)(surface->getBasePtr(dst_x + x, dst_y + y)) = outColor;
+ }
}
- dst += frame_stride - block_width;
}
-
- ++dstBlock;
- } while (--count);
+ }
}
bool VQADecoder::VQAVideoTrack::decodeFrame(Graphics::Surface *surface) {