[Scummvm-git-logs] scummvm master -> 7a0a0b548c70e5cb6e8e1f7c895616e77a5aac8b
dreammaster
dreammaster at scummvm.org
Thu Jun 8 04:32:24 CEST 2017
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
7a0a0b548c TITANIC: Fix color of starfield crosshairs
Commit: 7a0a0b548c70e5cb6e8e1f7c895616e77a5aac8b
https://github.com/scummvm/scummvm/commit/7a0a0b548c70e5cb6e8e1f7c895616e77a5aac8b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-06-07T22:32:11-04:00
Commit Message:
TITANIC: Fix color of starfield crosshairs
Changed paths:
engines/titanic/star_control/surface_area.cpp
engines/titanic/star_control/surface_area.h
diff --git a/engines/titanic/star_control/surface_area.cpp b/engines/titanic/star_control/surface_area.cpp
index 647413c..f243f60 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 be1689f..0261047 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;
More information about the Scummvm-git-logs
mailing list