[Scummvm-cvs-logs] scummvm master -> dd16e5f91ca98f81ec5863e118e81cacf34e17ad

Strangerke Strangerke at scummvm.org
Fri Mar 14 08:10:27 CET 2014


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:
dd16e5f91c VOYEUR: Get rid of some magic values


Commit: dd16e5f91ca98f81ec5863e118e81cacf34e17ad
    https://github.com/scummvm/scummvm/commit/dd16e5f91ca98f81ec5863e118e81cacf34e17ad
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-03-14T08:08:31+01:00

Commit Message:
VOYEUR: Get rid of some magic values

Changed paths:
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/graphics.cpp
    engines/voyeur/voyeur.cpp
    engines/voyeur/voyeur_game.cpp



diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 3e86f43..0a8a423 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -738,12 +738,12 @@ RectResource::RectResource(int x1, int y1, int x2, int y2) {
 
 DisplayResource::DisplayResource() {
 	_vm = NULL;
-	_flags = 0;
+	_flags = DISPFLAG_NONE;
 }
 
 DisplayResource::DisplayResource(VoyeurEngine *vm) {
 	_vm = vm;
-	_flags = 0;
+	_flags = DISPFLAG_NONE;
 }
 
 void DisplayResource::sFillBox(int width, int height) {
@@ -752,7 +752,7 @@ void DisplayResource::sFillBox(int width, int height) {
 	_vm->_graphicsManager->_saveBack = false;
 
 	PictureResource pr;
-	pr._flags = 1;
+	pr._flags = DISPFLAG_1;
 	pr._select = 0xff;
 	pr._pick = 0;
 	pr._onOff = _vm->_graphicsManager->_drawPtr->_penColor;
@@ -846,7 +846,7 @@ int DisplayResource::drawText(const Common::String &msg) {
 			break;
 		}
 
-		if (!(fontInfo._fontFlags & 3)) {
+		if (!(fontInfo._fontFlags & (DISPFLAG_1 | DISPFLAG_2))) {
 			viewPort->_fontRect.left = xp;
 			viewPort->_fontRect.top = yp;
 			viewPort->_fontRect.setWidth(msgWidth);
@@ -861,7 +861,7 @@ int DisplayResource::drawText(const Common::String &msg) {
 		pos.x = xp;
 		pos.y = yp;
 
-		if (fontInfo._fontFlags & 4) {
+		if (fontInfo._fontFlags & DISPFLAG_4) {
 			if (fontInfo._shadow.x <= 0) {
 				viewPort->_fontRect.left += fontInfo._shadow.x;
 				viewPort->_fontRect.right -= fontInfo._shadow.x * 2;
@@ -942,7 +942,7 @@ int DisplayResource::drawText(const Common::String &msg) {
 		if (i != 0) {
 			fontChar._pick = 0;
 			fontChar._onOff = fontInfo._shadowColor;
-		} else if (fontData._fontDepth == 1 || (fontInfo._fontFlags & 0x10)) {
+		} else if (fontData._fontDepth == 1 || (fontInfo._fontFlags & DISPFLAG_10)) {
 			fontChar._pick = 0;
 			fontChar._onOff = fontInfo._foreColor;
 		} else {
@@ -1120,7 +1120,7 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src):
 }
 
 PictureResource::PictureResource(Graphics::Surface *surface) {
-	_flags = 0;
+	_flags = DISPFLAG_NONE;
 	_select = 0;
 	_pick = 0;
 	_onOff = 0;
@@ -1134,7 +1134,7 @@ PictureResource::PictureResource(Graphics::Surface *surface) {
 }
 
 PictureResource::PictureResource() {
-	_flags = 0;
+	_flags = DISPFLAG_NONE;
 	_select = 0;
 	_pick = 0;
 	_onOff = 0;
@@ -1468,11 +1468,11 @@ FontInfoResource::FontInfoResource(BoltFilesState &state, const byte *src) {
 
 FontInfoResource::FontInfoResource() {
 	_curFont = NULL;
-	_picFlags = 3;
+	_picFlags = DISPFLAG_1 | DISPFLAG_2;
 	_picSelect = 0xff;
 	_picPick = 0xff;
 	_picOnOff = 0;
-	_fontFlags = 0;
+	_fontFlags = DISPFLAG_NONE;
 	_justify = ALIGN_LEFT;
 	_fontSaveBack = 0;
 	_justifyWidth = 1;
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 16d27fb..0e736c9 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -234,7 +234,8 @@ enum DisplayFlag { DISPFLAG_1 = 1, DISPFLAG_2 = 2, DISPFLAG_4 = 4, DISPFLAG_8 =
 	DISPFLAG_10 = 0x10, DISPFLAG_20 = 0x20, DISPFLAG_40 = 0x40, DISPFLAG_80 = 0x80,
 	DISPFLAG_100 = 0x100, DISPFLAG_200 = 0x200, DISPFLAG_400 = 0x400, 
 	DISPFLAG_800 = 0x800, DISPFLAG_1000 = 0x1000, DISPFLAG_2000 = 0x2000,
-	DISPFLAG_4000 = 0x4000, DISPFLAG_VIEWPORT = 0x8000, DISPFLAG_CURSOR = 0x10000 };
+	DISPFLAG_4000 = 0x4000, DISPFLAG_VIEWPORT = 0x8000, DISPFLAG_CURSOR = 0x10000,
+	DISPFLAG_NONE = 0};
 
 class DisplayResource {
 private:
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index acf0b27..f756b9c 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -48,7 +48,7 @@ GraphicsManager::GraphicsManager(VoyeurEngine *vm) : _defaultDrawInfo(1, Common:
 	_vPort = NULL;
 	_fontPtr = NULL;
 	Common::fill(&_VGAColors[0], &_VGAColors[PALETTE_SIZE], 0);
-	_fontChar = new PictureResource(0, 0xff, 0xff, 0, Common::Rect(), 0, NULL, 0);
+	_fontChar = new PictureResource(DISPFLAG_NONE, 0xff, 0xff, 0, Common::Rect(), 0, NULL, 0);
 	_backColors = nullptr;
 }
 
@@ -65,7 +65,7 @@ GraphicsManager::~GraphicsManager() {
 
 void GraphicsManager::setupMCGASaveRect(ViewPortResource *viewPort) {
 	if (viewPort->_activePage) {
-		viewPort->_activePage->_flags |= 1;
+		viewPort->_activePage->_flags |= DISPFLAG_1;
 		Common::Rect *clipRect = _clipPtr;
 		_clipPtr = &viewPort->_clipRect;
 
@@ -219,7 +219,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
 	widthDiff2 = destPic->_bounds.width() - width2;
 
 	if (destViewPort) {
-		if (!_saveBack || ((srcPic->_flags & DISPFLAG_800) != 0)) {
+		if (!_saveBack || (srcPic->_flags & DISPFLAG_800)) {
 			backBounds.left = destPic->_bounds.left + offset.x;
 			backBounds.top = destPic->_bounds.top + offset.y;
 			backBounds.setWidth(width2);
@@ -864,7 +864,7 @@ void GraphicsManager::fillPic(DisplayResource *display, byte onOff) {
 	}
 
 	PictureResource picResource;
-	picResource._flags = 0;
+	picResource._flags = DISPFLAG_NONE;
 	picResource._select = 0xff;
 	picResource._pick = 0;
 	picResource._onOff = onOff;
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 4b4ff9d..6f39be4 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -271,7 +271,7 @@ bool VoyeurEngine::doLock() {
 
 		_graphicsManager->_fontPtr->_curFont = _bVoy->boltEntry(0x708)._fontResource;
 		_graphicsManager->_fontPtr->_fontSaveBack = 0;
-		_graphicsManager->_fontPtr->_fontFlags = 0;
+		_graphicsManager->_fontPtr->_fontFlags = DISPFLAG_NONE;
 
 		Common::String dateString = "ScummVM";
  		Common::String displayString = Common::String::format("Last Play %s", dateString.c_str());
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 91bc429..a6564c3 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -292,7 +292,7 @@ void VoyeurEngine::doClosingCredits() {
 	_graphicsManager->_fontPtr->_foreColor = 2;
 	_graphicsManager->_fontPtr->_backColor = 2;
 	_graphicsManager->_fontPtr->_fontSaveBack = false;
-	_graphicsManager->_fontPtr->_fontFlags = 0;
+	_graphicsManager->_fontPtr->_fontFlags = DISPFLAG_NONE;
 
 	_soundManager->startVOCPlay(152);
 	FontInfoResource &fi = *_graphicsManager->_fontPtr;
@@ -398,7 +398,7 @@ void VoyeurEngine::doPiracy() {
 	fi._foreColor = 2;
 	fi._backColor = 2;
 	fi._fontSaveBack = false;
-	fi._fontFlags = 0;
+	fi._fontFlags = DISPFLAG_NONE;
 	fi._justify = ALIGN_CENTER;
 	fi._justifyWidth = 384;
 	fi._justifyHeight = 230;
@@ -460,7 +460,7 @@ void VoyeurEngine::reviewTape() {
 		_eventsManager->_intPtr._hasPalette = true;
 		_graphicsManager->_fontPtr->_curFont = _bVoy->boltEntry(0x909)._fontResource;
 		_graphicsManager->_fontPtr->_fontSaveBack = false;
-		_graphicsManager->_fontPtr->_fontFlags = 0;
+		_graphicsManager->_fontPtr->_fontFlags = DISPFLAG_NONE;
 
 		_eventsManager->getMouseInfo();
 		if (newX == -1) {
@@ -489,7 +489,7 @@ void VoyeurEngine::reviewTape() {
 				int yp = 45;
 				int eventNum = eventStart;
 				for (int lineNum = 0; lineNum < 8 && eventNum < _voy->_eventCount; ++lineNum, ++eventNum) {
-					_graphicsManager->_fontPtr->_picFlags = 0;
+					_graphicsManager->_fontPtr->_picFlags = DISPFLAG_NONE;
 					_graphicsManager->_fontPtr->_picSelect = 0xff;
 					_graphicsManager->_fontPtr->_picPick = 7;
 					_graphicsManager->_fontPtr->_picOnOff = (lineNum == eventLine) ? 8 : 0;
@@ -551,7 +551,7 @@ void VoyeurEngine::reviewTape() {
 					int yp = 45;
 					int eventNum = eventStart;
 					for (int idx = 0; idx < 8 && eventNum < _voy->_eventCount; ++idx, ++eventNum) {
-						_graphicsManager->_fontPtr->_picFlags = 0;
+						_graphicsManager->_fontPtr->_picFlags = DISPFLAG_NONE;
 						_graphicsManager->_fontPtr->_picSelect = 0xff;
 						_graphicsManager->_fontPtr->_picPick = 7;
 						_graphicsManager->_fontPtr->_picOnOff = (idx == eventLine) ? 8 : 0;
@@ -1171,7 +1171,7 @@ int VoyeurEngine::doComputerText(int maxLen) {
 	font._curFont = _bVoy->boltEntry(0x4910)._fontResource;
 	font._foreColor = 129;
 	font._fontSaveBack = false;
-	font._fontFlags = 0;
+	font._fontFlags = DISPFLAG_NONE;
 	if (_voy->_vocSecondsOffset > 60)
 		_voy->_vocSecondsOffset = 0;
 






More information about the Scummvm-git-logs mailing list