[Scummvm-git-logs] scummvm master -> 2a3e0f9f886c4c2c6506402dbd7bfd3fdee897b2

Strangerke noreply at scummvm.org
Tue May 7 20:23:35 UTC 2024


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:
f1a2370536 BAGEL: some renaming in movie_object, remove unused defines and dead code in bibble_window
2a3e0f9f88 BAGEL: Some renaming in movie_object, remove an unused contructor of CBagPanBitmap (Fixing 1544894), modify the other co


Commit: f1a23705366fa586f9e5525f324769cc919b7832
    https://github.com/scummvm/scummvm/commit/f1a23705366fa586f9e5525f324769cc919b7832
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2024-05-07T21:22:25+01:00

Commit Message:
BAGEL: some renaming in movie_object, remove unused defines and dead code in bibble_window

Changed paths:
    engines/bagel/baglib/movie_object.cpp
    engines/bagel/spacebar/bibble_window.cpp


diff --git a/engines/bagel/baglib/movie_object.cpp b/engines/bagel/baglib/movie_object.cpp
index 609918f2be1..132119d5b57 100644
--- a/engines/bagel/baglib/movie_object.cpp
+++ b/engines/bagel/baglib/movie_object.cpp
@@ -32,9 +32,9 @@
 
 namespace Bagel {
 
-#define SOUNDFILEEXTLOWER ".wav"
-#define SOUNDFILEEXTUPPER ".WAV"
-#define OVERRIDESMK "$SBARDIR\\BAR\\LOG\\OVERRIDE.SMK"
+#define SOUND_FILE_EXT_LOWER ".wav"
+#define SOUND_FILE_EXT_UPPER ".WAV"
+#define OVERRIDE_SMK "$SBARDIR\\BAR\\LOG\\OVERRIDE.SMK"
 
 CBagMovieObject::CBagMovieObject() {
 	_xObjType = MOVIE_OBJ;
@@ -106,7 +106,7 @@ bool CBagMovieObject::runObject() {
 
 		if (sFileName.find(".smk") > 0 || sFileName.find(".SMK") > 0) {
 			nMovFileType = MOVFILETYPE::MOVIE;
-		} else if (sFileName.find(SOUNDFILEEXTLOWER) > 0 || sFileName.find(SOUNDFILEEXTUPPER) > 0) {
+		} else if (sFileName.find(SOUND_FILE_EXT_LOWER) > 0 || sFileName.find(SOUND_FILE_EXT_UPPER) > 0) {
 			nMovFileType = MOVFILETYPE::SOUND;
 		} else if (sFileName.find(".txt") > 0 || sFileName.find(".TXT") > 0) {
 			nMovFileType = MOVFILETYPE::TEXT;
@@ -119,7 +119,7 @@ bool CBagMovieObject::runObject() {
 			switch (nMovFileType) {
 
 			case MOVFILETYPE::MOVIE:
-				sFileName = sBaseStr + SOUNDFILEEXTLOWER;
+				sFileName = sBaseStr + SOUND_FILE_EXT_LOWER;
 				nMovFileType = MOVFILETYPE::SOUND;
 				break;
 
@@ -161,15 +161,11 @@ bool CBagMovieObject::runObject() {
 					pPDA->addToMovieQueue(this);
 					return rc;
 				}
-			} else {
+			} else if ((pWnd != nullptr) && (pSDevWnd != nullptr)) {
 				// Don't need to redraw for asynch pda messages, this just
 				// messes things up in the PDA redraw code
-				if (pWnd != nullptr) {
-					if (pSDevWnd != nullptr) {
-						pSDevWnd->paintScreen(nullptr);
-						isFiltered = pSDevWnd->isFiltered();
-					}
-				}
+				pSDevWnd->paintScreen(nullptr);
+				isFiltered = pSDevWnd->isFiltered();
 			}
 
 			if (_xDisplayType == dispType::EXAMINE) {
@@ -284,7 +280,7 @@ bool CBagMovieObject::runObject() {
 						CBofString cStr(szLocalBuff, 256);
 
 						// Play the override message.
-						cStr = OVERRIDESMK;
+						cStr = OVERRIDE_SMK;
 						MACROREPLACE(cStr);
 
 						sFileName = cStr;
diff --git a/engines/bagel/spacebar/bibble_window.cpp b/engines/bagel/spacebar/bibble_window.cpp
index 03e790feed4..c27ad5d21b3 100644
--- a/engines/bagel/spacebar/bibble_window.cpp
+++ b/engines/bagel/spacebar/bibble_window.cpp
@@ -39,7 +39,6 @@ namespace SpaceBar {
 // Max number of credits the users is allowed to bet with
 #define MAX_AMOUNT  50000
 
-//#define BIBBLE_BACKDROP "BIBBLE.BMP"
 #define BIBBLE_BMP      "BIBSTRIP.BMP"
 #define BIBBLE_CELS     16
 #define BALL_BMP        "BALL2.BMP"
@@ -49,9 +48,6 @@ namespace SpaceBar {
 #define ARCH3_BMP       "ARCH3.BMP"
 #define CASINO_AUDIO            "CASINO.WAV"
 
-#define SOUNDFILEEXTLOWER       ".wav"
-#define SOUNDFILEEXTUPPER       ".WAV"
-
 #define BIBBLE_AUDIO_STARTGAME  "TEMP.WAV"
 #define BIBBLE_AUDIO_WINNER     "EVBWIN01.WAV"
 #define BIBBLE_AUDIO_LOSER      "TEMP.WAV"


Commit: 2a3e0f9f886c4c2c6506402dbd7bfd3fdee897b2
    https://github.com/scummvm/scummvm/commit/2a3e0f9f886c4c2c6506402dbd7bfd3fdee897b2
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2024-05-07T21:22:25+01:00

Commit Message:
BAGEL: Some renaming in movie_object, remove an unused contructor of CBagPanBitmap (Fixing 1544894), modify the other constructor to fix a call to generateCosineTable with an uninitialized variable

Changed paths:
    engines/bagel/baglib/movie_object.cpp
    engines/bagel/baglib/pan_bitmap.cpp
    engines/bagel/baglib/pan_bitmap.h


diff --git a/engines/bagel/baglib/movie_object.cpp b/engines/bagel/baglib/movie_object.cpp
index 132119d5b57..5f500b494bb 100644
--- a/engines/bagel/baglib/movie_object.cpp
+++ b/engines/bagel/baglib/movie_object.cpp
@@ -78,7 +78,7 @@ bool CBagMovieObject::runObject() {
 	bool bZoomed = (pPDAz == nullptr ? false : pPDAz->getZoomed());
 
 	// Get a pointer to the current game window
-	CBagStorageDevWnd *pMainWin = (CBagel::getBagApp()->getMasterWnd()->getCurrentStorageDev());
+	CBagStorageDevWnd *pMainWin = CBagel::getBagApp()->getMasterWnd()->getCurrentStorageDev();
 
 	bool rc = true;
 	if (!_bFlyThru || CBagMasterWin::getFlyThru()) {
@@ -97,7 +97,7 @@ bool CBagMovieObject::runObject() {
 		// This would be much cooler if it were a cast to another object type and
 		// then a run.  But this is a quicker fix.
 		//
-		enum class MOVFILETYPE { NONE = 0,
+		enum class MovieFileType { NONE = 0,
 		                   TEXT = 1,
 		                   SOUND = 2,
 		                   MOVIE = 3
@@ -105,43 +105,43 @@ bool CBagMovieObject::runObject() {
 		CBofString sBaseStr = sFileName.left(nExt);
 
 		if (sFileName.find(".smk") > 0 || sFileName.find(".SMK") > 0) {
-			nMovFileType = MOVFILETYPE::MOVIE;
+			nMovFileType = MovieFileType::MOVIE;
 		} else if (sFileName.find(SOUND_FILE_EXT_LOWER) > 0 || sFileName.find(SOUND_FILE_EXT_UPPER) > 0) {
-			nMovFileType = MOVFILETYPE::SOUND;
+			nMovFileType = MovieFileType::SOUND;
 		} else if (sFileName.find(".txt") > 0 || sFileName.find(".TXT") > 0) {
-			nMovFileType = MOVFILETYPE::TEXT;
+			nMovFileType = MovieFileType::TEXT;
 		} else {
-			nMovFileType = MOVFILETYPE::NONE;
+			nMovFileType = MovieFileType::NONE;
 		}
 
 		// Look for .SMK then .WAV, then .TXT
 		while (!fileExists(sFileName.getBuffer())) {
 			switch (nMovFileType) {
 
-			case MOVFILETYPE::MOVIE:
+			case MovieFileType::MOVIE:
 				sFileName = sBaseStr + SOUND_FILE_EXT_LOWER;
-				nMovFileType = MOVFILETYPE::SOUND;
+				nMovFileType = MovieFileType::SOUND;
 				break;
 
-			case MOVFILETYPE::SOUND:
+			case MovieFileType::SOUND:
 				sFileName = sBaseStr + ".txt";
-				nMovFileType = MOVFILETYPE::TEXT;
+				nMovFileType = MovieFileType::TEXT;
 				break;
 
-			case MOVFILETYPE::TEXT:
+			case MovieFileType::TEXT:
 				bofMessageBox(sFileName.getBuffer(), "Could not find asset");
-				nMovFileType = MOVFILETYPE::NONE;
+				nMovFileType = MovieFileType::NONE;
 				break;
 
 			// We should never get here
-			case MOVFILETYPE::NONE:
+			case MovieFileType::NONE:
 			default:
 				logError(buildString("Movie does not have a correct file name: %s.", sFileName.getBuffer()));
 				return rc;
 			}
 		}
 
-		if (nMovFileType == MOVFILETYPE::MOVIE) {
+		if (nMovFileType == MovieFileType::MOVIE) {
 #endif
 
 			bool isFiltered = false;
@@ -357,7 +357,7 @@ bool CBagMovieObject::runObject() {
 				pMainWin->setPreFilterPan(true);
 			}
 
-		} else if (nMovFileType == MOVFILETYPE::SOUND) {
+		} else if (nMovFileType == MovieFileType::SOUND) {
 			CBofSound *pSound = new CBofSound(CBofApp::getApp()->getMainWindow(), sFileName, SOUND_WAVE);
 			if (pSound) {
 				pSound->play();
@@ -365,7 +365,7 @@ bool CBagMovieObject::runObject() {
 			} else {
 				logError(buildString("Movie SOUND file could not be read: %s.  Where? Not in Kansas ...", sFileName.getBuffer()));
 			}
-		} else if (nMovFileType == MOVFILETYPE::TEXT) {
+		} else if (nMovFileType == MovieFileType::TEXT) {
 			Common::File f;
 			if (f.open(sFileName.getBuffer())) {
 				Common::String line = f.readLine();
diff --git a/engines/bagel/baglib/pan_bitmap.cpp b/engines/bagel/baglib/pan_bitmap.cpp
index 482ab68e88d..03ea7fac302 100644
--- a/engines/bagel/baglib/pan_bitmap.cpp
+++ b/engines/bagel/baglib/pan_bitmap.cpp
@@ -84,58 +84,11 @@ CBagPanBitmap::CBagPanBitmap(const char *pszFileName, CBofPalette *pPalette, con
 
 		normalizeViewSize();
 
-		setFOV(DEF_FOV); // If FOV is set to 0 then unity FOV is assumed (faster redraws)
-
-		// _nCorrWidth is uninitialized for the call to setFOV below,
-		// this causes the cosine table to be allocated incorrectly in
-		// generateCosineTable.  Move the initialization before setFOV.
-		if (_bPanorama)
-			setCorrWidth(4);
-		else
-			setCorrWidth(0);
-
-		_bIsValid = true;
-
-		return;
-	}
-	_bIsValid = false;
-}
-
-CBagPanBitmap::CBagPanBitmap(int dx, int dy, CBofPalette *pPalette, const CBofRect &xViewSize) :
-		CBofBitmap(dx, dy, pPalette) {
-	int nW = width();
-	int nH = height();
-
-	if (nW && nH) {
-		CBofRect xMaxViewSize(0, 0, nW - 1, nH - 1);
-		if (nW > 1000) {
-			xMaxViewSize.left = (long)(nW / MAX_DIV_VIEW);
-			_bPanorama = true;
-		} else
-			_bPanorama = false;
-
-		_pCosineTable = nullptr;
-		_bActiveScrolling = false;		// The scrolling is not active
-		_xDirection = kDirNONE;		// Direction is not moving
-
-		pPalette = getPalette();
-
-		if (xViewSize.isRectEmpty())
-			_xCurrView = xMaxViewSize;
-		else
-			_xCurrView = xViewSize;
-
-		if (_xCurrView.width() > xMaxViewSize.width()) {
-			_xCurrView.setRect(0, _xCurrView.top, xMaxViewSize.width() - 1, _xCurrView.bottom);
-		}
-
-		_xRotateRate.x = (nW - _xCurrView.width()) / 64 + 1;
-		_xRotateRate.y = (nH - _xCurrView.height()) / 64 + 1;
-
-		normalizeViewSize();
-
-		setFOV(DEF_FOV); // If FOV is set to 0 then unity FOV is assumed (faster redraws)
+		// If FOV is set to 0 then unity FOV is assumed (faster redraws)
+		// The update parameter is set to false to avoid to update the cosine table as _nCorrWidth isn't set yet
+		setFOV(DEF_FOV, false);
 
+		// Initialize _nCorrWidth and generate the cosine table.
 		if (_bPanorama)
 			setCorrWidth(4);
 		else
@@ -157,7 +110,7 @@ CBagPanBitmap::~CBagPanBitmap() {
 	}
 }
 
-// This must be updated whenever the size, view size, or correction witdh changes
+// This must be updated whenever the size, view size, or correction width changes
 void CBagPanBitmap::generateCosineTable() {
 	int nWidth = 1 << _nCorrWidth;
 	int offset = nWidth >> 1; // This is not really needed just more correction to move angle to center
@@ -165,11 +118,7 @@ void CBagPanBitmap::generateCosineTable() {
 
 	_nNumDegrees = (viewWidth >> _nCorrWidth) + 1;
 
-	if (_pCosineTable) {
-		delete[] _pCosineTable;
-		_pCosineTable = nullptr;
-	}
-
+	delete[] _pCosineTable;
 	_pCosineTable = new CBofFixed[_nNumDegrees];
 
 	for (int i = 0; i < _nNumDegrees; i++) {
diff --git a/engines/bagel/baglib/pan_bitmap.h b/engines/bagel/baglib/pan_bitmap.h
index f7c0971aa4b..692a9be5c87 100644
--- a/engines/bagel/baglib/pan_bitmap.h
+++ b/engines/bagel/baglib/pan_bitmap.h
@@ -59,7 +59,6 @@ private:
 
 public:
 	CBagPanBitmap(const char *pszFileName, CBofPalette *pPalette, const CBofRect &xViewSize = CBofRect());
-	CBagPanBitmap(int dx, int dy, CBofPalette *pPalette, const CBofRect &xViewSize = CBofRect());
 	virtual ~CBagPanBitmap();
 
 	bool isValid() const {




More information about the Scummvm-git-logs mailing list