[Scummvm-cvs-logs] scummvm master -> 02f939c28209122ed1b8bef3cbf98973afed4bee

Strangerke Strangerke at scummvm.org
Tue Mar 26 08:15:28 CET 2013


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:
02f939c282 HOPKINS: Simplify some statements using MIN, MAX and CLIP


Commit: 02f939c28209122ed1b8bef3cbf98973afed4bee
    https://github.com/scummvm/scummvm/commit/02f939c28209122ed1b8bef3cbf98973afed4bee
Author: Strangerke (strangerke at scummvm.org)
Date: 2013-03-26T00:13:14-07:00

Commit Message:
HOPKINS: Simplify some statements using MIN, MAX and CLIP

Changed paths:
    engines/hopkins/events.cpp
    engines/hopkins/graphics.h
    engines/hopkins/hopkins.cpp
    engines/hopkins/lines.cpp



diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp
index a73ce41..0d5db1b 100644
--- a/engines/hopkins/events.cpp
+++ b/engines/hopkins/events.cpp
@@ -456,10 +456,7 @@ void EventsManager::refreshScreenAndEvents() {
 			if (getMouseX() < _vm->_graphicsManager->_scrollPosX + 10)
 				_vm->_graphicsManager->_scrollPosX -= _vm->_graphicsManager->_scrollSpeed;
 		}
-		if (_vm->_graphicsManager->_scrollPosX < 0)
-			_vm->_graphicsManager->_scrollPosX = 0;
-		if (_vm->_graphicsManager->_scrollPosX > SCREEN_WIDTH)
-			_vm->_graphicsManager->_scrollPosX = SCREEN_WIDTH;
+		_vm->_graphicsManager->_scrollPosX = CLIP(_vm->_graphicsManager->_scrollPosX, 0, SCREEN_WIDTH);
 		if (_vm->_graphicsManager->_oldScrollPosX == _vm->_graphicsManager->_scrollPosX) {
 			_vm->_graphicsManager->displayDirtyRects();
 		} else {
diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h
index 64ea426..1d02ce7 100644
--- a/engines/hopkins/graphics.h
+++ b/engines/hopkins/graphics.h
@@ -63,13 +63,15 @@ private:
 	bool _clipFl;
 	int _specialWidth;
 
-	byte SD_PIXELS[PALETTE_SIZE * 2];
 	int _enlargedX, _enlargedY;
 	bool _enlargedXFl, _enlargedYFl;
 	int clip_x1, clip_y1;
 	int _reduceX, _reducedY;
 	int _zoomOutFactor;
 
+	byte SD_PIXELS[PALETTE_SIZE * 2];
+	bool MANU_SCROLL;
+
 	void loadScreen(const Common::String &file);
 	void loadPCX640(byte *surface, const Common::String &file, byte *palette, bool typeFlag);
 	void loadPCX320(byte *surface, const Common::String &file, byte *palette);
@@ -77,10 +79,10 @@ private:
 	void fadeOut(const byte *palette, int step, const byte *surface);
 	void changePalette(const byte *palette);
 	uint16 mapRGB(byte r, byte g, byte b);
+	void copy16bFromSurfaceScaleX2(const byte *surface);
 
 	void Trans_bloc(byte *destP, const byte *srcP, int count, int minThreshold, int maxThreshold);
 	void Copy_Vga16(const byte *surface, int xp, int yp, int width, int height, int destX, int destY);
-	void copy16bFromSurfaceScaleX2(const byte *surface);
 public:
 	int _lineNbr;
 	byte _colorTable[PALETTE_EXT_BLOCK_SIZE];
@@ -113,7 +115,6 @@ public:
 
 	int WinScan;
 	byte *PAL_PIXELS;
-	bool MANU_SCROLL;
 	int FADE_LINUX;
 public:
 	GraphicsManager(HopkinsEngine *vm);
@@ -165,13 +166,13 @@ public:
 	void endDisplayBob();
 	void updateScreen();
 	void reduceScreenPart(const byte *srcSruface, byte *destSurface, int xp, int yp, int width, int height, int zoom);
+	void setScreenWidth(int pitch);
 
 	void SETCOLOR3(int palIndex, int r, int g, int b);
 	void SETCOLOR4(int palIndex, int r, int g, int b);
 	void AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, int idx, bool addSegment = true);
 	void Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int frameIndex, int zoom1, int zoom2, bool flipFl);
 	void Copy_Mem(const byte *srcSurface, int x1, int y1, uint16 width, int height, byte *destSurface, int destX, int destY);
-	void setScreenWidth(int pitch);
 	void Sprite_Vesa(byte *surface, const byte *spriteData, int xp, int yp, int spriteIndex);
 	void m_scroll16(const byte *surface, int xs, int ys, int width, int height, int destX, int destY);
 	void m_scroll16A(const byte *surface, int xs, int ys, int width, int height, int destX, int destY);
diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp
index 4051e5a..95d16aa 100644
--- a/engines/hopkins/hopkins.cpp
+++ b/engines/hopkins/hopkins.cpp
@@ -2457,14 +2457,11 @@ void HopkinsEngine::displayCredits(int startPosY, byte *buffer, char color) {
 		_globals->_creditsStartY = startPosY;
 		_globals->_creditsEndY = endPosY;
 	}
-	if (startPosX < _globals->_creditsStartX)
-		_globals->_creditsStartX = startPosX;
-	if (endPosX > _globals->_creditsEndX)
-		_globals->_creditsEndX = endPosX;
-	if (_globals->_creditsStartY > startPosY)
-		_globals->_creditsStartY = startPosY;
-	if (endPosY > _globals->_creditsEndY)
-		_globals->_creditsEndY = endPosY;
+
+	_globals->_creditsStartX = MIN(_globals->_creditsStartX, startPosX);
+	_globals->_creditsEndX = MAX(_globals->_creditsEndX, endPosX);
+	_globals->_creditsStartY = MIN(_globals->_creditsStartY, startPosY);
+	_globals->_creditsEndY = MAX(_globals->_creditsEndY, endPosY);
 
 	Common::String message = Common::String((char *)buffer);
 	_fontManager->displayText(startPosX, startPosY, message, color);
diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp
index e0f0d84..52a17b1 100644
--- a/engines/hopkins/lines.cpp
+++ b/engines/hopkins/lines.cpp
@@ -2698,14 +2698,10 @@ void LinesManager::CARRE_ZONE() {
 			int zoneX = *dataP++;
 			int zoneY = *dataP++;
 
-			if (curZone->_left >= zoneX)
-				curZone->_left = zoneX;
-			if (curZone->_right <= zoneX)
-				curZone->_right = zoneX;
-			if (curZone->_top >= zoneY)
-				curZone->_top = zoneY;
-			if (curZone->_bottom <= zoneY)
-				curZone->_bottom = zoneY;
+			curZone->_left = MIN(curZone->_left, zoneX);
+			curZone->_right = MAX(curZone->_right, zoneX);
+			curZone->_top = MIN(curZone->_top, zoneY);
+			curZone->_bottom = MAX(curZone->_bottom, zoneY);
 		}
 	}
 






More information about the Scummvm-git-logs mailing list