[Scummvm-git-logs] scummvm master -> 44286da60a6385d3fd2a3d75a589e6229db64ad8

kelmer44 noreply at scummvm.org
Wed Sep 17 13:56:46 UTC 2025


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

Summary:
44286da60a TOT: Fixes warnings for type discrepancies


Commit: 44286da60a6385d3fd2a3d75a589e6229db64ad8
    https://github.com/scummvm/scummvm/commit/44286da60a6385d3fd2a3d75a589e6229db64ad8
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-17T15:56:18+02:00

Commit Message:
TOT: Fixes warnings for type discrepancies

Changed paths:
    engines/tot/anims.cpp
    engines/tot/chrono.cpp
    engines/tot/chrono.h
    engines/tot/dialog.cpp
    engines/tot/engine.cpp
    engines/tot/saveload.cpp
    engines/tot/tot.h
    engines/tot/types.h


diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 58628f8fb31..acbfd198ce5 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -70,8 +70,8 @@ void drawText(uint x, uint y, const Common::String &str1, const Common::String &
 
 void removeText(uint xTextLine1, uint yTextLine1, uint xTextLine2, uint yTextLine2, byte fillColor) {
 
-	for (int j = yTextLine1; j < yTextLine2 + 1; j++) {
-		for (int i = xTextLine1; i < xTextLine2 + 1; i++) {
+	for (uint j = yTextLine1; j < yTextLine2 + 1; j++) {
+		for (uint i = xTextLine1; i < xTextLine2 + 1; i++) {
 			*((byte *)g_engine->_screen->getBasePtr(i, j)) = 0;
 		}
 	}
diff --git a/engines/tot/chrono.cpp b/engines/tot/chrono.cpp
index 79cdea6ad92..bc3b514568e 100644
--- a/engines/tot/chrono.cpp
+++ b/engines/tot/chrono.cpp
@@ -57,7 +57,7 @@ void ChronoManager::changeSpeed() {
 		_speedMultiplier = 1;
 }
 
-void ChronoManager::delay(int ms) {
+void ChronoManager::delay(uint32 ms) {
 	uint32 delayStart = g_system->getMillis();
 	Common::Event e;
 	ms = ms / _speedMultiplier;
diff --git a/engines/tot/chrono.h b/engines/tot/chrono.h
index 7d8b03365b2..2c0519143a0 100644
--- a/engines/tot/chrono.h
+++ b/engines/tot/chrono.h
@@ -40,7 +40,7 @@ public:
 	ChronoManager();
 	~ChronoManager();
 	void updateChrono();
-	void delay(int ms);
+	void delay(uint32 ms);
 	void changeSpeed();
 
 	bool _gameTick = false;
diff --git a/engines/tot/dialog.cpp b/engines/tot/dialog.cpp
index d46571cce7e..54eaf05b80c 100644
--- a/engines/tot/dialog.cpp
+++ b/engines/tot/dialog.cpp
@@ -25,7 +25,7 @@
 namespace Tot {
 
 Common::String decrypt(Common::String encryptedText) {
-	for (int i = 0; i < encryptedText.size(); i++) {
+	for (uint i = 0; i < encryptedText.size(); i++) {
 		encryptedText.setChar(g_engine->_decryptionKey[i] ^ (char)encryptedText[i], i);
 	}
 	return encryptedText;
@@ -368,7 +368,7 @@ void showDialogueLine(
 			if (g_engine->_mouse->mouseClickY < 143)
 				selectedConv = 0;
 			else {
-				if (g_engine->_mouse->mouseClickX >= 0 && g_engine->_mouse->mouseClickX <= 280) {
+				if (g_engine->_mouse->mouseClickX <= 280) {
 					if (g_engine->_mouse->mouseClickY >= 143 && g_engine->_mouse->mouseClickY <= 155) {
 						selectedConv = firstChat;
 					} else if (g_engine->_mouse->mouseClickY >= 156 && g_engine->_mouse->mouseClickY <= 166) {
@@ -450,7 +450,7 @@ void talk(byte characterIndex) {
 			insertName = 0;
 			conversationMatrix[conversationIndex] = decrypt(text.text);
 
-			for (int i = 0; i < conversationMatrix[conversationIndex].size(); i++) {
+			for (uint i = 0; i < conversationMatrix[conversationIndex].size(); i++) {
 				if (conversationMatrix[conversationIndex][i] == '@')
 					insertName = i;
 			}
diff --git a/engines/tot/engine.cpp b/engines/tot/engine.cpp
index 1c6d378c6c8..1dcea3d013b 100644
--- a/engines/tot/engine.cpp
+++ b/engines/tot/engine.cpp
@@ -95,7 +95,7 @@ void TotEngine::runaroundRed() {
 				_iframe2++;
 			_secondaryAnimation.posx = devilTrajectory[secTrajIndex][0] - 15;
 			_secondaryAnimation.posy = devilTrajectory[secTrajIndex][1] - 42;
-			if (secTrajIndex >= 0 && secTrajIndex <= 8) {
+			if (secTrajIndex <= 8) {
 				_secondaryAnimation.dir = 2;
 				_secondaryAnimation.depth = 1;
 			} else if (secTrajIndex >= 9 && secTrajIndex <= 33) {
@@ -221,8 +221,8 @@ static void assembleImage(const byte *img, uint imgPosX, uint imgPosY) {
 			incy = g_engine->_dirtyMainSpriteY + hBg - y;
 	} // end of region calculating overlapping area
 
-	for (int j = 0; j < incy; j++) {
-		for (int i = 0; i < incx; i++) {
+	for (uint j = 0; j < incy; j++) {
+		for (uint i = 0; i < incx; i++) {
 			int bgOffset = 4 + ((y - g_engine->_dirtyMainSpriteY) + j) * wBg + i + (x - g_engine->_dirtyMainSpriteX);
 			int imgOffset = 4 + (y - imgPosY + j) * wImg + i + (x - imgPosX);
 			if (img[imgOffset] != 0) {
@@ -1039,7 +1039,7 @@ void TotEngine::goToObject(byte zone1, byte zone2) {
 
 void TotEngine::updateSecondaryAnimationDepth() {
 	uint animationPos = _secondaryAnimation.posy + _secondaryAnimHeight - 1;
-	if (animationPos >= 0 && animationPos <= 56) {
+	if (animationPos && animationPos <= 56) {
 		_secondaryAnimation.depth = 0;
 	} else if (animationPos >= 57 && animationPos <= 66) {
 		_secondaryAnimation.depth = 1;
@@ -1063,7 +1063,7 @@ void TotEngine::updateSecondaryAnimationDepth() {
 }
 
 void TotEngine::updateMainCharacterDepth() {
-	if (_characterPosY >= 0 && _characterPosY <= 7) {
+	if (_characterPosY && _characterPosY <= 7) {
 		_mainCharAnimation.depth = 0;
 	} else if (_characterPosY >= 8 && _characterPosY <= 17) {
 		_mainCharAnimation.depth = 1;
@@ -1832,8 +1832,7 @@ void TotEngine::pickupScreenObject() {
 			break;
 		default: {
 			for (int i = 0; i < 15; i++)
-				if (_currentRoomData->screenLayers[i].bitmapPointer ==
-					_curObject.bitmapPointer) {
+				if (_currentRoomData->screenLayers[i].bitmapPointer == _curObject.bitmapPointer) {
 					_currentRoomData->screenLayers[i].bitmapPointer = 0;
 					_currentRoomData->screenLayers[i].bitmapSize = 0;
 					_currentRoomData->screenLayers[i].coordx = 0;
@@ -3643,7 +3642,7 @@ static void blit(byte *srcImage, byte *dstImage) { // Near;
 	uint size = w * h;
 	byte *dst = dstImage + 4;
 	byte *src = srcImage + 4;
-	for (int i = 0; i < size; i++) {
+	for (uint i = 0; i < size; i++) {
 		if (dst[i] == 0) {
 			dst[i] = src[i];
 		}
@@ -3666,7 +3665,7 @@ void TotEngine::scrollRight(uint horizontalPos) {
 	byte *assembledCharacterFrame = (byte *)malloc(_mainCharFrameSize);
 	// Number of bytes to move
 	size_t numBytes = 44796;
-	for (int i = 0; i < stepCount; i++) {
+	for (uint i = 0; i < stepCount; i++) {
 		// move everything to the left
 		memmove(_sceneBackground + 4, _sceneBackground + 8, numBytes);
 
@@ -3830,7 +3829,8 @@ void TotEngine::sayLine(
 	bool isWithinConversation) {
 	TextEntry text;
 
-	byte insertName, charCounter, lineBreakCount, width;
+	uint charCounter;
+	byte insertName, lineBreakCount, width;
 	byte characterFacingDir;
 
 	uint talkAnimIndex, bgSize, posx, posy;
@@ -3914,7 +3914,7 @@ void TotEngine::sayLine(
 
 		insertName = 0;
 
-		for (int i = 0; i < text.text.size(); i++) {
+		for (uint i = 0; i < text.text.size(); i++) {
 			text.text.setChar(_decryptionKey[i] ^ text.text[i], i);
 			if (text.text[i] == '@')
 				insertName = i;
@@ -4621,7 +4621,7 @@ void TotEngine::checkMouseGrid() {
 	Common::String invObject;
 	if (_cpCounter2 > 120)
 		showError(274);
-	if (_mouse->mouseY >= 0 && _mouse->mouseY <= 131) {
+	if (_mouse->mouseY <= 131) {
 		xGrid = _mouse->getMouseCoordsWithinGrid().x;
 		yGrid = _mouse->getMouseCoordsWithinGrid().y;
 		if (_currentRoomData->mouseGrid[xGrid][yGrid] != _currentRoomData->mouseGrid[_oldGridX][_oldGridY] || _oldInventoryObjectName != "") {
@@ -4887,7 +4887,8 @@ void TotEngine::displayObjectDescription(const Common::String &textString) {
 	byte maxWidth = 33;
 	byte textColor = 255;
 	byte shadowColor = 0;
-	byte ihc, lineCounter;
+	uint ihc;
+	byte lineCounter;
 	byte newLineMatrix[10];
 
 	if (textString.size() < maxWidth) {
diff --git a/engines/tot/saveload.cpp b/engines/tot/saveload.cpp
index 6af17508a12..cb40808a5cf 100644
--- a/engines/tot/saveload.cpp
+++ b/engines/tot/saveload.cpp
@@ -566,11 +566,11 @@ void TotEngine::loadGame(SavedGame game) {
 	_graphics->sceneTransition(false, _sceneBackground);
 }
 
-Common::String drawAndSelectSaves(Common::StringArray saves, int selectedGame) {
+Common::String drawAndSelectSaves(Common::StringArray saves, uint selectedGame) {
 	g_engine->_mouse->hide();
 	const char *availableText = getHardcodedTextsByCurrentLanguage()[11];
-	int size = saves.size();
-	for (int i = 0; i < 6; i++) {
+	uint size = saves.size();
+	for (uint i = 0; i < 6; i++) {
 
 		int color = i == selectedGame ? 255 : 253;
 		if (i < size) {
@@ -594,7 +594,7 @@ Common::String drawAndSelectSaves(Common::StringArray saves, int selectedGame) {
 
 void TotEngine::originalSaveLoadScreen() {
 	uint oldMouseX, oldMouseY;
-	int selectedGame = -1;
+	uint selectedGame = -1;
 	bool modified = false;
 	Common::String saveName = "";
 
@@ -661,7 +661,7 @@ void TotEngine::originalSaveLoadScreen() {
 		if (mouseClicked) {
 			if (_mouse->mouseY >= 13 && _mouse->mouseY <= 16) {
 				if (_mouse->mouseX >= 54 && _mouse->mouseX <= 124) {
-					if (selectedGame >= 0 && _saveAllowed && saveName != "") {
+					if (selectedGame && _saveAllowed && saveName != "") {
 						saveGameState(selectedGame, saveName, false);
 						_graphics->putImg(50, 10, menuBgPointer);
 						exitSaveLoadMenu = true;
@@ -670,7 +670,7 @@ void TotEngine::originalSaveLoadScreen() {
 						_sound->beep(100, 300);
 					}
 				} else if (_mouse->mouseX >= 130 && _mouse->mouseX <= 194) {
-					if (selectedGame >= 0 && !modified) {
+					if (selectedGame && !modified) {
 						if (selectedGame < saves.size()) {
 							_mouse->hide();
 							_graphics->putImg(50, 10, menuBgPointer);
@@ -740,7 +740,7 @@ void TotEngine::originalSaveLoadScreen() {
 			}
 		}
 
-		if (selectedGame >= 0 && keyPressed && _saveAllowed) {
+		if (selectedGame && keyPressed && _saveAllowed) {
 			_mouse->hide();
 			byte ytext = 29 + (selectedGame * 15);
 			readAlphaGraphSmall(saveName, 30, 65, ytext, 251, 254, lastInputChar);
diff --git a/engines/tot/tot.h b/engines/tot/tot.h
index 597b20aaa46..27ef56cd1b4 100644
--- a/engines/tot/tot.h
+++ b/engines/tot/tot.h
@@ -293,7 +293,7 @@ public:
 	/**
 	 * Current position of the main character
 	 */
-	int _characterPosX = 0, _characterPosY = 0;
+	uint16 _characterPosX = 0, _characterPosY = 0;
 	/**
 	 * Target position of the main character?
 	 */
@@ -447,7 +447,7 @@ public:
 	 * Point of origin of the area surrounding the main character.
 	 * Calculated using the position of the character.
 	 */
-	uint _dirtyMainSpriteX = 0, _dirtyMainSpriteY = 0;
+	uint16 _dirtyMainSpriteX = 0, _dirtyMainSpriteY = 0;
 	/**
 	 * End point of origin of the area surrounding the main character.
 	 * Calculated using the position of the character + dimension
diff --git a/engines/tot/types.h b/engines/tot/types.h
index 2fb63bcc980..03bcee8f3ac 100644
--- a/engines/tot/types.h
+++ b/engines/tot/types.h
@@ -171,14 +171,14 @@ struct RoomObjectListEntry {
 };
 
 struct RoomBitmapRegister {
-	int32 bitmapPointer;
+	uint32 bitmapPointer;
 	uint16 bitmapSize;
 	uint16 coordx, coordy, depth;
 };
 
 struct RoomFileRegister {
 	uint16 code;
-	int32 roomImagePointer;
+	uint32 roomImagePointer;
 	uint16 roomImageSize;
 	byte walkAreasGrid[40][28]; /* movement grid */
 	byte mouseGrid[40][28];    /* mousegrid with index to indexadoObjetos */




More information about the Scummvm-git-logs mailing list