aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2017-06-07 22:32:11 -0400
committerPaul Gilbert2017-06-07 22:32:11 -0400
commit7a0a0b548c70e5cb6e8e1f7c895616e77a5aac8b (patch)
tree0cbcb3853cfe898df93c53b9e09d6044a0e9ea2b /engines/titanic
parent3fdfd47ea3f4bcd7bab397f0ec9d84c89c897113 (diff)
downloadscummvm-rg350-7a0a0b548c70e5cb6e8e1f7c895616e77a5aac8b.tar.gz
scummvm-rg350-7a0a0b548c70e5cb6e8e1f7c895616e77a5aac8b.tar.bz2
scummvm-rg350-7a0a0b548c70e5cb6e8e1f7c895616e77a5aac8b.zip
TITANIC: Fix color of starfield crosshairs
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/star_control/surface_area.cpp25
-rw-r--r--engines/titanic/star_control/surface_area.h2
2 files changed, 18 insertions, 9 deletions
diff --git a/engines/titanic/star_control/surface_area.cpp b/engines/titanic/star_control/surface_area.cpp
index 647413c8fa..f243f60f65 100644
--- a/engines/titanic/star_control/surface_area.cpp
+++ b/engines/titanic/star_control/surface_area.cpp
@@ -22,6 +22,7 @@
#include "titanic/star_control/surface_area.h"
#include "graphics/primitives.h"
+#include "titanic/titanic.h"
namespace Titanic {
@@ -87,6 +88,18 @@ void CSurfaceArea::setColorFromPixel() {
setColor(_rgb);
}
+Graphics::PixelFormat CSurfaceArea::getPixelFormat() const {
+ switch (_bpp) {
+ case 1:
+ case 2:
+ return Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);
+ case 4:
+ return Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
+ default:
+ return Graphics::PixelFormat::createFormatCLUT8();
+ }
+}
+
void CSurfaceArea::pixelToRGB(uint pixel, uint *rgb) {
switch (_bpp) {
case 0:
@@ -95,12 +108,8 @@ void CSurfaceArea::pixelToRGB(uint pixel, uint *rgb) {
case 1:
case 2: {
- uint r = pixel & 0xF8;
- uint g = (pixel >> 8) & 0xf8;
- uint b = ((pixel >> 16) & 0xff) >> 3;
- uint value = (((r << 5) | g) << 2) | b;
- value &= 0xffff;
- *rgb = (value << 16) | value;
+ Graphics::PixelFormat pf = getPixelFormat();
+ *rgb = pf.RGBToColor(pixel & 0xff, (pixel >> 8) & 0xff, (pixel >> 16) & 0xff);
break;
}
@@ -176,13 +185,13 @@ double CSurfaceArea::drawLine(const FPoint &pt1, const FPoint &pt2) {
Graphics::Surface s;
s.setPixels(_pixelsPtr);
s.pitch = _pitch;
+ s.format = getPixelFormat();
s.w = _width;
s.h = _height;
_surface = &s;
switch (_bpp) {
case 0:
- s.format = Graphics::PixelFormat::createFormatCLUT8();
if (_mode != SA_SOLID) {
Graphics::drawLine(srcPos.x, srcPos.y, destPos.x, destPos.y, 0, plotPoint<byte>, this);
return p1._y;
@@ -190,14 +199,12 @@ double CSurfaceArea::drawLine(const FPoint &pt1, const FPoint &pt2) {
break;
case 1:
case 2:
- s.format = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);
if (_mode != SA_SOLID) {
Graphics::drawLine(srcPos.x, srcPos.y, destPos.x, destPos.y, 0, plotPoint<uint16>, this);
return p1._y;
}
break;
case 4:
- s.format = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
if (_mode != SA_SOLID) {
Graphics::drawLine(srcPos.x, srcPos.y, destPos.x, destPos.y, 0, plotPoint<uint32>, this);
return p1._y;
diff --git a/engines/titanic/star_control/surface_area.h b/engines/titanic/star_control/surface_area.h
index be1689fdec..0261047324 100644
--- a/engines/titanic/star_control/surface_area.h
+++ b/engines/titanic/star_control/surface_area.h
@@ -55,6 +55,8 @@ private:
void setColor(uint rgb);
void pixelToRGB(uint pixel, uint *rgb);
+
+ Graphics::PixelFormat getPixelFormat() const;
public:
int _field0;
int _width;