[Scummvm-cvs-logs] scummvm master -> 189260757de286ba79f18b971f16e3e7c704ec6d

Strangerke Strangerke at scummvm.org
Tue Feb 26 08:07:13 CET 2013


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
79062f426e HOPKINS: Some renaming in GraphicsManager
189260757d HOPKINS: Some renaming in LinesManager


Commit: 79062f426ebed125d28c503decf4de11eeb17608
    https://github.com/scummvm/scummvm/commit/79062f426ebed125d28c503decf4de11eeb17608
Author: Strangerke (strangerke at scummvm.org)
Date: 2013-02-25T22:37:09-08:00

Commit Message:
HOPKINS: Some renaming in GraphicsManager

Changed paths:
    engines/hopkins/anim.cpp
    engines/hopkins/computer.cpp
    engines/hopkins/dialogs.cpp
    engines/hopkins/graphics.cpp
    engines/hopkins/graphics.h
    engines/hopkins/hopkins.cpp
    engines/hopkins/saveload.cpp



diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp
index 5e7d648..6531e1d 100644
--- a/engines/hopkins/anim.cpp
+++ b/engines/hopkins/anim.cpp
@@ -258,7 +258,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u
 
 		_vm->_graphicsManager.clearPalette();
 		oldScrollPosX = _vm->_graphicsManager._scrollPosX;
-		_vm->_graphicsManager.SCANLINE(SCREEN_WIDTH);
+		_vm->_graphicsManager.setScreenWidth(SCREEN_WIDTH);
 		_vm->_graphicsManager.scrollScreen(0);
 		_vm->_graphicsManager.lockScreen();
 		_vm->_graphicsManager.clearScreen();
@@ -388,12 +388,12 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u
 	_vm->_graphicsManager._scrollPosX = oldScrollPosX;
 	_vm->_graphicsManager.scrollScreen(oldScrollPosX);
 	if (_vm->_graphicsManager._largeScreenFl) {
-		_vm->_graphicsManager.SCANLINE(2 * SCREEN_WIDTH);
+		_vm->_graphicsManager.setScreenWidth(2 * SCREEN_WIDTH);
 		_vm->_graphicsManager._maxX = 2 * SCREEN_WIDTH;
 		_vm->_graphicsManager.lockScreen();
 		_vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
 	} else {
-		_vm->_graphicsManager.SCANLINE(SCREEN_WIDTH);
+		_vm->_graphicsManager.setScreenWidth(SCREEN_WIDTH);
 		_vm->_graphicsManager._maxX = SCREEN_WIDTH;
 		_vm->_graphicsManager.lockScreen();
 		_vm->_graphicsManager.clearScreen();
diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp
index af898d3..ab81884 100644
--- a/engines/hopkins/computer.cpp
+++ b/engines/hopkins/computer.cpp
@@ -612,7 +612,7 @@ void ComputerManager::setModeVGA256() {
 	_vm->_graphicsManager.clearScreen();
 	_vm->_graphicsManager.unlockScreen();
 	_vm->_graphicsManager.clearPalette();
-	_vm->_graphicsManager.SCANLINE(320);
+	_vm->_graphicsManager.setScreenWidth(320);
 }
 
 /**
diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp
index 6102c86..6ccb601 100644
--- a/engines/hopkins/dialogs.cpp
+++ b/engines/hopkins/dialogs.cpp
@@ -75,6 +75,7 @@ void DialogsManager::showOptionsDialog() {
 	_vm->_globals._optionDialogSpr = _vm->_fileManager.loadFile(filename);
 	_vm->_globals._optionDialogFl = true;
 
+	int scrollOffset = _vm->_graphicsManager._scrollOffset;
 	bool doneFlag = false;
 	do {
 		if (_vm->_eventsManager.getMouseButton()) {
@@ -83,7 +84,7 @@ void DialogsManager::showOptionsDialog() {
 			mousePos.y = _vm->_eventsManager.getMouseY();
 
 			if (!_vm->_soundManager._musicOffFl) {
-				if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 300 && mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 327 && mousePos.y <= 138) {
+				if (mousePos.x >= scrollOffset + 300 && mousePos.y > 113 && mousePos.x <= scrollOffset + 327 && mousePos.y <= 138) {
 					// Change the music volume
 					++_vm->_soundManager._musicVolume;
 
@@ -96,7 +97,7 @@ void DialogsManager::showOptionsDialog() {
 					_vm->_soundManager.updateScummVMSoundSettings();
 				}
 
-				if (!_vm->_soundManager._musicOffFl && mousePos.x >= _vm->_graphicsManager._scrollOffset + 331 && mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 358 && mousePos.y <= 138) {
+				if (!_vm->_soundManager._musicOffFl && mousePos.x >= scrollOffset + 331 && mousePos.y > 113 && mousePos.x <= scrollOffset + 358 && mousePos.y <= 138) {
 					--_vm->_soundManager._musicVolume;
 					if (_vm->_soundManager._musicVolume >= 0)
 						_vm->_soundManager.playSoundFile("bruit2.wav");
@@ -109,7 +110,8 @@ void DialogsManager::showOptionsDialog() {
 				}
 			}
 			if (!_vm->_soundManager._soundOffFl) {
-				if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 300 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 327 && mousePos.y <= 165) {
+				// increase volume
+				if (mousePos.x >= scrollOffset + 300 && mousePos.y > 140 && mousePos.x <= scrollOffset + 327 && mousePos.y <= 165) {
 					++_vm->_soundManager._soundVolume;
 					if (_vm->_soundManager._soundVolume <= 16)
 						_vm->_soundManager.playSoundFile("bruit2.wav");
@@ -120,7 +122,8 @@ void DialogsManager::showOptionsDialog() {
 					_vm->_soundManager.updateScummVMSoundSettings();
 				}
 
-				if (!_vm->_soundManager._soundOffFl && mousePos.x >= _vm->_graphicsManager._scrollOffset + 331 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 358 && mousePos.y <= 165) {
+				// Decrease volume
+				if (!_vm->_soundManager._soundOffFl && mousePos.x >= scrollOffset + 331 && mousePos.y > 140 && mousePos.x <= scrollOffset + 358 && mousePos.y <= 165) {
 					--_vm->_soundManager._soundVolume;
 					if (_vm->_soundManager._soundVolume >= 0)
 						_vm->_soundManager.playSoundFile("bruit2.wav");
@@ -133,7 +136,7 @@ void DialogsManager::showOptionsDialog() {
 			}
 
 			if (!_vm->_soundManager._voiceOffFl) {
-				if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 300 && mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 327 && mousePos.y <= 192) {
+				if (mousePos.x >= scrollOffset + 300 && mousePos.y > 167 && mousePos.x <= scrollOffset + 327 && mousePos.y <= 192) {
 					++_vm->_soundManager._voiceVolume;
 
 					if (_vm->_soundManager._voiceVolume <= 16)
@@ -145,7 +148,7 @@ void DialogsManager::showOptionsDialog() {
 					_vm->_soundManager.updateScummVMSoundSettings();
 				}
 
-				if (!_vm->_soundManager._voiceOffFl && mousePos.x >= _vm->_graphicsManager._scrollOffset + 331 && mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 358 && mousePos.y <= 192) {
+				if (!_vm->_soundManager._voiceOffFl && mousePos.x >= scrollOffset + 331 && mousePos.y > 167 && mousePos.x <= scrollOffset + 358 && mousePos.y <= 192) {
 					--_vm->_soundManager._voiceVolume;
 					if (_vm->_soundManager._voiceVolume >= 0)
 						_vm->_soundManager.playSoundFile("bruit2.wav");
@@ -157,18 +160,18 @@ void DialogsManager::showOptionsDialog() {
 				}
 			}
 
-			if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 431) {
-				if (mousePos.y > 194 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 489 && mousePos.y <= 219)
+			if (mousePos.x >= scrollOffset + 431) {
+				if (mousePos.y > 194 && mousePos.x <= scrollOffset + 489 && mousePos.y <= 219)
 					_vm->_soundManager._textOffFl = !_vm->_soundManager._textOffFl;
 
-				if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 431) {
-					if (mousePos.y > 167 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 489 && mousePos.y <= 192) {
+				if (mousePos.x >= scrollOffset + 431) {
+					if (mousePos.y > 167 && mousePos.x <= scrollOffset + 489 && mousePos.y <= 192) {
 						_vm->_soundManager._voiceOffFl = !_vm->_soundManager._voiceOffFl;
 
 						_vm->_soundManager.updateScummVMSoundSettings();
 					}
-					if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 431) {
-						if (mousePos.y > 113 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 489 && mousePos.y <= 138) {
+					if (mousePos.x >= scrollOffset + 431) {
+						if (mousePos.y > 113 && mousePos.x <= scrollOffset + 489 && mousePos.y <= 138) {
 							if (_vm->_soundManager._musicOffFl) {
 								_vm->_soundManager._musicOffFl = false;
 								_vm->_soundManager.setMODMusicVolume(_vm->_soundManager._musicVolume);
@@ -180,7 +183,7 @@ void DialogsManager::showOptionsDialog() {
 							_vm->_soundManager.updateScummVMSoundSettings();
 						}
 
-						if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 431 && mousePos.y > 140 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 489 && mousePos.y <= 165) {
+						if (mousePos.x >= scrollOffset + 431 && mousePos.y > 140 && mousePos.x <= scrollOffset + 489 && mousePos.y <= 165) {
 							_vm->_soundManager._soundOffFl = !_vm->_soundManager._soundOffFl;
 
 							_vm->_soundManager.updateScummVMSoundSettings();
@@ -189,13 +192,13 @@ void DialogsManager::showOptionsDialog() {
 				}
 			}
 
-			if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 175 && mousePos.y > 285 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 281 && mousePos.y <= 310) {
+			if (mousePos.x >= scrollOffset + 175 && mousePos.y > 285 && mousePos.x <= scrollOffset + 281 && mousePos.y <= 310) {
 				_vm->_globals._exitId = 300;
 				doneFlag = true;
 			}
-			if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 355 && mousePos.y > 285 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 490 && mousePos.y <= 310)
+			if (mousePos.x >= scrollOffset + 355 && mousePos.y > 285 && mousePos.x <= scrollOffset + 490 && mousePos.y <= 310)
 				doneFlag = true;
-			if (mousePos.x >= _vm->_graphicsManager._scrollOffset + 300 && mousePos.y > 194 && mousePos.x <= _vm->_graphicsManager._scrollOffset + 358 && mousePos.y <= 219) {
+			if (mousePos.x >= scrollOffset + 300 && mousePos.y > 194 && mousePos.x <= scrollOffset + 358 && mousePos.y <= 219) {
 				switch (_vm->_graphicsManager._scrollSpeed) {
 				case 1:
 					_vm->_graphicsManager._scrollSpeed = 2;
@@ -237,7 +240,7 @@ void DialogsManager::showOptionsDialog() {
 			//if (mousePos.x >= _vm->_graphicsManager.ofscroll + 348 && mousePos.y > 248 && mousePos.x <= _vm->_graphicsManager.ofscroll + 394 && mousePos.y <= 273)
 			//	_vm->_globals._speed = 2;
 
-			if (   mousePos.x < _vm->_graphicsManager._scrollOffset + 165 || mousePos.x > _vm->_graphicsManager._scrollOffset + 496 
+			if (   mousePos.x < scrollOffset + 165 || mousePos.x > scrollOffset + 496 
 				|| mousePos.y < 107 || mousePos.y > 318)
 				doneFlag = true;
 		}
@@ -298,10 +301,10 @@ void DialogsManager::showOptionsDialog() {
 		_vm->_eventsManager.VBL();
 	} while (!doneFlag);
 
-	_vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, _vm->_graphicsManager._scrollOffset + 164,
-		107, 335, 215, _vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._scrollOffset + 164, 107);
-	_vm->_graphicsManager.addVesaSegment(_vm->_graphicsManager._scrollOffset + 164, 107,
-		_vm->_graphicsManager._scrollOffset + 498, 320);
+	_vm->_graphicsManager.copySurface(_vm->_graphicsManager._vesaScreen, scrollOffset + 164,
+		107, 335, 215, _vm->_graphicsManager._vesaBuffer, scrollOffset + 164, 107);
+	_vm->_graphicsManager.addVesaSegment(scrollOffset + 164, 107,
+		scrollOffset + 498, 320);
 
 	_vm->_globals._optionDialogSpr = _vm->_globals.freeMemory(_vm->_globals._optionDialogSpr);
 	_vm->_globals._optionDialogFl = false;
diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp
index 03f27b5..ef2e07d 100644
--- a/engines/hopkins/graphics.cpp
+++ b/engines/hopkins/graphics.cpp
@@ -128,13 +128,14 @@ void GraphicsManager::setGraphicalMode(int width, int height) {
  * (try to) Lock Screen
  */
 void GraphicsManager::lockScreen() {
-	if (!_skipVideoLockFl) {
-		if (_lockCounter++ == 0) {
-			_videoPtr = g_system->lockScreen();
-			if (WinScan == 0)
-				WinScan = _videoPtr->pitch;
-		}
-	}		
+	if (_skipVideoLockFl)
+		return;
+
+	if (_lockCounter++ == 0) {
+		_videoPtr = g_system->lockScreen();
+		if (WinScan == 0)
+			WinScan = _videoPtr->pitch;
+	}
 }
 
 /**
@@ -169,13 +170,13 @@ void GraphicsManager::loadImage(const Common::String &file) {
  * Load VGA Image
  */
 void GraphicsManager::loadVgaImage(const Common::String &file) {
-	SCANLINE(SCREEN_WIDTH);
+	setScreenWidth(SCREEN_WIDTH);
 	lockScreen();
 	clearScreen();
 	unlockScreen();
 	loadPCX320(_vesaScreen, file, _palette);
 	memcpy(_vesaBuffer, _vesaScreen, 64000);
-	SCANLINE(320);
+	setScreenWidth(320);
 	_maxX = 320;
 
 	lockScreen();
@@ -209,14 +210,14 @@ void GraphicsManager::loadScreen(const Common::String &file) {
 	clearPalette();
 
 	if (!_largeScreenFl) {
-		SCANLINE(SCREEN_WIDTH);
+		setScreenWidth(SCREEN_WIDTH);
 		_maxX = SCREEN_WIDTH;
 		lockScreen();
 		clearScreen();
 		m_scroll16(_vesaScreen, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
 		unlockScreen();
 	} else {
-		SCANLINE(SCREEN_WIDTH * 2);
+		setScreenWidth(SCREEN_WIDTH * 2);
 		_maxX = SCREEN_WIDTH * 2;
 		lockScreen();
 		clearScreen();
@@ -405,7 +406,7 @@ void GraphicsManager::clearPalette() {
 		WRITE_LE_UINT16(&SD_PIXELS[i], col0);
 }
 
-void GraphicsManager::SCANLINE(int pitch) {
+void GraphicsManager::setScreenWidth(int pitch) {
 	_lineNbr = _lineNbr2 = pitch;
 }
 
@@ -1776,7 +1777,7 @@ void GraphicsManager::copyWinscanVbe(const byte *src, byte *dest) {
 }
 
 // Reduce Screen
-void GraphicsManager::Reduc_Ecran(const byte *srcSurface, byte *destSurface, int xp, int yp, int width, int height, int zoom) {
+void GraphicsManager::reduceScreenPart(const byte *srcSurface, byte *destSurface, int xp, int yp, int width, int height, int zoom) {
 	const byte *srcP = xp + _lineNbr2 * yp + srcSurface;
 	byte *destP = destSurface;
 	Red = zoom;
diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h
index 16788ad..620c1b7 100644
--- a/engines/hopkins/graphics.h
+++ b/engines/hopkins/graphics.h
@@ -157,20 +157,20 @@ public:
 	void initScreen(const Common::String &file, int mode, bool initializeScreen);
 	void displayAllBob();
 	void endDisplayBob();
+	void updateScreen();
+	void reduceScreenPart(const byte *srcSruface, byte *destSurface, int xp, int yp, int width, int height, int zoom);
 
 	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 updateScreen();
 	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 SCANLINE(int pitch);
+	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);
 	void Trans_bloc2(byte *surface, byte *col, int size);
 	void NB_SCREEN(bool initPalette);
-	void Reduc_Ecran(const byte *srcSruface, byte *destSurface, int xp, int yp, int width, int height, int zoom);
 };
 
 } // End of namespace Hopkins
diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp
index 5992f22..86cb473 100644
--- a/engines/hopkins/hopkins.cpp
+++ b/engines/hopkins/hopkins.cpp
@@ -1856,7 +1856,7 @@ void HopkinsEngine::displayEndDemo() {
 
 void HopkinsEngine::bombExplosion() {
 	_graphicsManager._lineNbr = SCREEN_WIDTH;
-	_graphicsManager.SCANLINE(SCREEN_WIDTH);
+	_graphicsManager.setScreenWidth(SCREEN_WIDTH);
 	_graphicsManager.lockScreen();
 	_graphicsManager.clearScreen();
 	_graphicsManager.unlockScreen();
diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp
index f934c4c..2202951 100644
--- a/engines/hopkins/saveload.cpp
+++ b/engines/hopkins/saveload.cpp
@@ -234,7 +234,7 @@ void SaveLoadManager::createThumbnail(Graphics::Surface *s) {
 	Graphics::Surface thumb8;
 	thumb8.create(w, h, Graphics::PixelFormat::createFormatCLUT8());
 
-	_vm->_graphicsManager.Reduc_Ecran(_vm->_graphicsManager._vesaBuffer, (byte *)thumb8.pixels,
+	_vm->_graphicsManager.reduceScreenPart(_vm->_graphicsManager._vesaBuffer, (byte *)thumb8.pixels,
 		_vm->_eventsManager._startPos.x, 20, SCREEN_WIDTH, SCREEN_HEIGHT - 40, 80);
 
 	// Convert the 8-bit pixel to 16 bit surface


Commit: 189260757de286ba79f18b971f16e3e7c704ec6d
    https://github.com/scummvm/scummvm/commit/189260757de286ba79f18b971f16e3e7c704ec6d
Author: Strangerke (strangerke at scummvm.org)
Date: 2013-02-25T23:06:08-08:00

Commit Message:
HOPKINS: Some renaming in LinesManager

Changed paths:
    engines/hopkins/lines.cpp



diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp
index ebf48a7..b2e96f5 100644
--- a/engines/hopkins/lines.cpp
+++ b/engines/hopkins/lines.cpp
@@ -257,7 +257,7 @@ void LinesManager::addLine(int idx, Directions direction, int a3, int a4, int a5
 	Common::fill(v10, v10 + 4 * v34 + 8, 0);
 	_lineItem[idx]._lineData = (int16 *)v10;
 
-	int16 *v32 = _lineItem[idx]._lineData;
+	int16 *curLineData = _lineItem[idx]._lineData;
 	int v36 = 1000 * v8;
 	int v39 = 1000 * v8 / (v34 - 1);
 	int v37 = 1000 * v33 / (v34 - 1);
@@ -265,65 +265,62 @@ void LinesManager::addLine(int idx, Directions direction, int a3, int a4, int a5
 		v39 = -v39;
 	if (a6 < a4)
 		v37 = -v37;
-	int v11 = (int)v39 / 1000;
-	int v12 = (int)v37 / 1000;
-	if (!v11) {
-		if (v12 == -1) {
+	int dirX = (int)v39 / 1000; // -1: Left, 0: None, 1: Right
+	int dirY = (int)v37 / 1000; // -1: Up, 0: None, 1: Right
+	if (!dirX) {
+		if (dirY == -1) {
 			_lineItem[idx]._directionRouteInc = DIR_UP;
 			_lineItem[idx]._directionRouteDec = DIR_DOWN;
-		}
-		if (v12 == 1) {
+		} else if (dirY == 1) {
 			_lineItem[idx]._directionRouteInc = DIR_DOWN;
 			_lineItem[idx]._directionRouteDec = DIR_UP;
 		}
-	}
-	if (v11 == 1) {
-		if (v12 == -1) {
+		// If dirY == 0, no move
+	} else if (dirX == 1) {
+		if (dirY == -1) {
 			_lineItem[idx]._directionRouteInc = DIR_UP_RIGHT;
 			_lineItem[idx]._directionRouteDec = DIR_DOWN_LEFT;
-		}
-		if (!v12) {
+		} else if (!dirY) {
 			_lineItem[idx]._directionRouteInc = DIR_RIGHT;
 			_lineItem[idx]._directionRouteDec = DIR_LEFT;
-		}
-		if (v12 == 1) {
+		} else if (dirY == 1) {
 			_lineItem[idx]._directionRouteInc = DIR_DOWN_RIGHT;
 			_lineItem[idx]._directionRouteDec = DIR_UP_LEFT;
 		}
-	}
-	if (v11 == -1) {
-		if (v12 == 1) {
+	} else if (dirX == -1) {
+		if (dirY == 1) {
 			_lineItem[idx]._directionRouteInc = DIR_DOWN_LEFT;
 			_lineItem[idx]._directionRouteDec = DIR_UP_RIGHT;
-		}
-		if (!v12) {
+		} else if (!dirY) {
 			_lineItem[idx]._directionRouteInc = DIR_LEFT;
 			_lineItem[idx]._directionRouteDec = DIR_RIGHT;
-		}
-		if (v12 == -1) {
+		} else if (dirY == -1) {
 			_lineItem[idx]._directionRouteInc = DIR_UP_LEFT;
 			_lineItem[idx]._directionRouteDec = DIR_DOWN_RIGHT;
 		}
 	}
-	if (v11 == 1 && v37 > 250 && v37 <= 999) {
-		_lineItem[idx]._directionRouteInc = DIR_DOWN_RIGHT;
-		_lineItem[idx]._directionRouteDec = DIR_UP_LEFT;
-	}
-	if (v11 == -1 && v37 > 250 && v37 <= 999) {
-		_lineItem[idx]._directionRouteInc = DIR_DOWN_LEFT;
-		_lineItem[idx]._directionRouteDec = DIR_UP_RIGHT;
-	}
-	if (v11 == 1 && v37 < -250 && v37 > -1000) {
-		_lineItem[idx]._directionRouteInc = DIR_UP_RIGHT;
-		_lineItem[idx]._directionRouteDec = DIR_DOWN_LEFT;
-	}
-	// This condition is impossible to meet!
-	// Code present in the Linux and BeOS executables
-	// CHECKME: maybe it should be checking negative values?
-	if (v11 == -1 && v37 <= 249 && v37 > 1000) {
-		_lineItem[idx]._directionRouteInc = DIR_UP_LEFT;
-		_lineItem[idx]._directionRouteDec = DIR_DOWN_RIGHT;
+
+	// Second pass to soften cases where dirY == 0
+	if (dirX == 1) {
+		if (v37 > 250 && v37 <= 999) {
+			_lineItem[idx]._directionRouteInc = DIR_DOWN_RIGHT;
+			_lineItem[idx]._directionRouteDec = DIR_UP_LEFT;
+		} else if (v37 < -250 && v37 > -1000) {
+			_lineItem[idx]._directionRouteInc = DIR_UP_RIGHT;
+			_lineItem[idx]._directionRouteDec = DIR_DOWN_LEFT;
+		}
+	} else if (dirX == -1) {
+		if (v37 > 250 && v37 <= 999) {
+			_lineItem[idx]._directionRouteInc = DIR_DOWN_LEFT;
+			_lineItem[idx]._directionRouteDec = DIR_UP_RIGHT;
+		} else if (v37 < -250 && v37 > -1000) {
+			// In the original code, the test was on positive values and 
+			// was impossible to meet. 
+			_lineItem[idx]._directionRouteInc = DIR_UP_LEFT;
+			_lineItem[idx]._directionRouteDec = DIR_DOWN_RIGHT;
+		}
 	}
+
 	int v40 = v36 / v34;
 	int v38 = 1000 * v33 / v34;
 	if (a5 < a3)
@@ -336,21 +333,21 @@ void LinesManager::addLine(int idx, Directions direction, int a3, int a4, int a5
 	int v30 = 1000 * a4 / 1000;
 	int v35 = v34 - 1;
 	for (int v26 = 0; v26 < v35; v26++) {
-		v32[0] = v31;
-		v32[1] = v30;
-		v32 += 2;
+		curLineData[0] = v31;
+		curLineData[1] = v30;
+		curLineData += 2;
 
 		v24 += v40;
 		v25 += v38;
 		v31 = v24 / 1000;
 		v30 = v25 / 1000;
 	}
-	v32[0] = a5;
-	v32[1] = a6;
+	curLineData[0] = a5;
+	curLineData[1] = a6;
 
-	v32 += 2;
-	v32[0] = -1;
-	v32[1] = -1;
+	curLineData += 2;
+	curLineData[0] = -1;
+	curLineData[1] = -1;
 
 	_lineItem[idx]._lineDataEndIdx = v35 + 1;
 	_lineItem[idx]._direction = direction;






More information about the Scummvm-git-logs mailing list