[Scummvm-git-logs] scummvm master -> 579b31bd6b94ede2bf4e4f508e97882816e303ff

sev- noreply at scummvm.org
Thu Jun 4 20:27:56 UTC 2026


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

Summary:
5869634b2f DM: Correct type from int16 to uint16. PVS-Studio V1112
368e672ae7 DM: Correct triggerLocalEffect to check effCell. PVS-Studio V547
9366cf83ba DM: Add explicit casts to fix sign-compare warnings. PVS-Studio V1112
a1cac12ce6 DM: Fix champion rename state restore bug. PVS-Studio V519
c00e4c78b2 DM: Prevent array overrun when backspacing in renaming champion. PVS-Studio V557
a70e9eab03 DM: Change decodeText parameter type to int16. PVS-Studio V1016
81dab0d58a DM: Use correct size of _portrait in memset. PVS-Studio V1086
14f536d233 DM: Make variables static to prevent stack-use-after-scope. PVS-Studio V506
f489c0b4cf DM: Initialize members in constructor. PVS-Studio V730
c57c5ef12a DM: Fix possible array underrun (original bug). PVS-Studio V557
81bfab4ebf DM: Remove redundant footprint check in setSquareAspect. PVS-Studio V560
a303636f89 DM: Fix mouse button status update on button release. PVS-Studio V547
75cb68ec06 DM: Prevent potential uint16 underflow. PVS-Studio V658
2d47d540d8 DM: Add boundary check in mouseProcessCommands125To128_clickOnChampionIcon. PVS-Studio V1051
8935d35fe2 DM: Fix dangling pointer by declaring projectileCoordinates at function scope. PVS-Stduio V507
c3be4eb33e DM: Fix double assignment mistake. PVS-Studio V519
c2f2ad6b1c DM: Fix out-of-bounds pointer arithmetic. PVS-Studio V557
999255e9c3 DM: Refactor to avoid compound assignment in condition. PVS-Studio V1019
938f11c228 DM: Consolidate duplicate case branches. PVS-Studio V1037
1d481b111f DM: Prevent _aspect array underrun. PVS-Studio V557
800a7cb451 DM: Removed redundant condition check. PVS-Studio V560
aa9931f2dc DM: Correct the order of parameters to avoid confusion. PVS-Studio V764
ece35f516d DM: Disable copy constructor for LZWdecompressor. PVS-Studio V690
78406b76af DM: Use size_t for string length in DialogMan. PVS-Studio V1029
7fa36f1373 DM: Fix double assignment mistake. PVS-Studio V519
7a6c02a11e DM: Use int16 cast to suppress enum range warnings. PVS-Studio V1016
6e79884984 DM: Fix strict alignment warning in processTimeline. PVS-Studio V1032
579b31bd6b DM: Refactor self assignment. PVS-Studio V1048


Commit: 5869634b2f4caa4731f974efcd628da298af4485
    https://github.com/scummvm/scummvm/commit/5869634b2f4caa4731f974efcd628da298af4485
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-04T22:27:39+02:00

Commit Message:
DM: Correct type from int16 to uint16. PVS-Studio V1112

Changed paths:
    engines/dm/inventory.cpp


diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp
index a1b3a6bd16d..39cea8cb2fc 100644
--- a/engines/dm/inventory.cpp
+++ b/engines/dm/inventory.cpp
@@ -997,7 +997,7 @@ void InventoryMan::clickOnMouth() {
 		case kDMPotionTypeVi: {
 			uint16 healWoundIterationCount = MAX(1, (((Potion *)junkData)->getPower() / 42));
 			curChampion->_currHealth += curChampion->_maxHealth / counter;
-			int16 wounds = curChampion->_wounds;
+			uint16 wounds = curChampion->_wounds;
 			if (wounds) { /* If the champion is wounded */
 				counter = 10;
 				do {


Commit: 368e672ae79582f6d011eb2695a4e661c5aa8b4a
    https://github.com/scummvm/scummvm/commit/368e672ae79582f6d011eb2695a4e661c5aa8b4a
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-04T22:27:39+02:00

Commit Message:
DM: Correct triggerLocalEffect to check effCell. PVS-Studio V547

It checked localEffect != kDMSensorEffectNone instead of the correct effCell != kDMCellAny, as in the original reversed code.

Changed paths:
    engines/dm/movesens.cpp


diff --git a/engines/dm/movesens.cpp b/engines/dm/movesens.cpp
index 6a2ddc3bc3c..349cf3a32f1 100644
--- a/engines/dm/movesens.cpp
+++ b/engines/dm/movesens.cpp
@@ -937,7 +937,7 @@ void MovesensMan::triggerEffect(Sensor *sensor, SensorEffect effect, int16 mapX,
 
 void MovesensMan::triggerLocalEffect(SensorEffect localEffect, int16 effX, int16 effY, int16 effCell) {
 	if (localEffect == kDMSensorEffectAddExperience) {
-		addSkillExperience(kDMSkillSteal, 300, localEffect != kDMSensorEffectNone);
+		addSkillExperience(kDMSkillSteal, 300, effCell != kDMCellAny);
 		return;
 	}
 	_sensorRotationEffect = localEffect;


Commit: 9366cf83baa0db104abfd893850a7915666459b7
    https://github.com/scummvm/scummvm/commit/9366cf83baa0db104abfd893850a7915666459b7
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-04T22:27:39+02:00

Commit Message:
DM: Add explicit casts to fix sign-compare warnings. PVS-Studio V1112

Changed paths:
    engines/dm/movesens.cpp


diff --git a/engines/dm/movesens.cpp b/engines/dm/movesens.cpp
index 349cf3a32f1..5333dcbc9f3 100644
--- a/engines/dm/movesens.cpp
+++ b/engines/dm/movesens.cpp
@@ -972,14 +972,14 @@ void MovesensMan::processRotationEffect() {
 		{
 			Thing firstSensorThing = dungeon.getSquareFirstThing(_sensorRotationEffMapX, _sensorRotationEffMapY);
 			while ((firstSensorThing.getType() != kDMThingTypeSensor)
-				|| ((_sensorRotationEffCell != kDMCellAny) && (firstSensorThing.getCell() != _sensorRotationEffCell))) {
+				|| ((_sensorRotationEffCell != kDMCellAny) && ((int16)firstSensorThing.getCell() != _sensorRotationEffCell))) {
 				firstSensorThing = dungeon.getNextThing(firstSensorThing);
 			}
 			Sensor *firstSensor = (Sensor *)dungeon.getThingData(firstSensorThing);
 			Thing lastSensorThing = firstSensor->getNextThing();
 			while ((lastSensorThing != _vm->_thingEndOfList)
 				&& ((lastSensorThing.getType() != kDMThingTypeSensor)
-				|| ((_sensorRotationEffCell != kDMCellAny) && (lastSensorThing.getCell() != _sensorRotationEffCell)))) {
+				|| ((_sensorRotationEffCell != kDMCellAny) && ((int16)lastSensorThing.getCell() != _sensorRotationEffCell)))) {
 				lastSensorThing = dungeon.getNextThing(lastSensorThing);
 			}
 			if (lastSensorThing == _vm->_thingEndOfList)
@@ -988,7 +988,7 @@ void MovesensMan::processRotationEffect() {
 			Sensor *lastSensor = (Sensor *)dungeon.getThingData(lastSensorThing);
 			lastSensorThing = dungeon.getNextThing(lastSensorThing);
 			while (((lastSensorThing != _vm->_thingEndOfList) && (lastSensorThing.getType() == kDMThingTypeSensor))) {
-				if ((_sensorRotationEffCell == kDMCellAny) || (lastSensorThing.getCell() == _sensorRotationEffCell))
+				if ((_sensorRotationEffCell == kDMCellAny) || ((int16)lastSensorThing.getCell() == _sensorRotationEffCell))
 					lastSensor = (Sensor *)dungeon.getThingData(lastSensorThing);
 				lastSensorThing = dungeon.getNextThing(lastSensorThing);
 			}
@@ -1017,7 +1017,7 @@ Thing MovesensMan::getObjectOfTypeInCell(int16 mapX, int16 mapY, int16 cell, int
 	DungeonMan &dungeon = *_vm->_dungeonMan;
 	Thing curThing = dungeon.getSquareFirstObject(mapX, mapY);
 	while (curThing != _vm->_thingEndOfList) {
-		if ((_vm->_objectMan->getObjectType(curThing) == objectType) && ((cell == kDMCellAny) || (curThing.getCell() == cell)))
+		if ((_vm->_objectMan->getObjectType(curThing) == objectType) && ((cell == kDMCellAny) || ((int16)curThing.getCell() == cell)))
 			return curThing;
 
 		curThing = dungeon.getNextThing(curThing);


Commit: a1cac12ce6b83d3cb45b89efced741e072cd926a
    https://github.com/scummvm/scummvm/commit/a1cac12ce6b83d3cb45b89efced741e072cd926a
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-04T22:27:39+02:00

Commit Message:
DM: Fix champion rename state restore bug. PVS-Studio V519

Actaul game bug as mentioned in the reversed code.

Changed paths:
    engines/dm/champion.cpp


diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp
index 436a529dae2..5e8a9d431a6 100644
--- a/engines/dm/champion.cpp
+++ b/engines/dm/champion.cpp
@@ -2530,11 +2530,11 @@ void ChampionMan::renameChampion(Champion *champ) {
 						return;
 					}
 
+					Common::strcpy_s(champ->_name, championNameBackupString);
 					if (renamedChampionStringMode == kDMRenameChampionTitle)
 						renamedChampionString = champ->_title;
-
-					Common::strcpy_s(champ->_name, championNameBackupString);
-					renamedChampionString = champ->_name;
+					else
+						renamedChampionString = champ->_name;
 					curCharacterIndex = characterIndexBackup;
 				} else {
 					if ((mousePos.x >= 107) && (mousePos.x <= 175) && (mousePos.y >= 147) && (mousePos.y <= 155)) { /* Coordinates of 'BACKSPACE' button */


Commit: c00e4c78b2f934b5ea3254bd90661c4e747c4c40
    https://github.com/scummvm/scummvm/commit/c00e4c78b2f934b5ea3254bd90661c4e747c4c40
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-04T22:27:39+02:00

Commit Message:
DM: Prevent array overrun when backspacing in renaming champion. PVS-Studio V557

Actaul game bug as mentioned in the reversed code.

Changed paths:
    engines/dm/champion.cpp


diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp
index 5e8a9d431a6..3fcc103dd6a 100644
--- a/engines/dm/champion.cpp
+++ b/engines/dm/champion.cpp
@@ -2613,7 +2613,8 @@ void ChampionMan::renameChampion(Champion *champ) {
 			}
 			if (curCharacterIndex == 0) {
 				renamedChampionString = champ->_name;
-				curCharacterIndex = strlen(renamedChampionString) - 1;
+				int16 nameLen = (int16)strlen(renamedChampionString);
+				curCharacterIndex = nameLen > 0 ? nameLen - 1 : 0;
 				renamedChampionStringMode = kDMRenameChampionName;
 				textPosX = 177 + (curCharacterIndex * 6);
 				textPosY = 91;


Commit: a70e9eab0300b02058009d2cd712235d551da012
    https://github.com/scummvm/scummvm/commit/a70e9eab0300b02058009d2cd712235d551da012
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-04T22:27:39+02:00

Commit Message:
DM: Change decodeText parameter type to int16. PVS-Studio V1016

Changed paths:
    engines/dm/champion.cpp
    engines/dm/dm.cpp
    engines/dm/dungeonman.cpp
    engines/dm/dungeonman.h
    engines/dm/inventory.cpp


diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp
index 3fcc103dd6a..bddd8ce1dfd 100644
--- a/engines/dm/champion.cpp
+++ b/engines/dm/champion.cpp
@@ -1948,7 +1948,7 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) {
 	char L0807_ac_DecodedChampionText[77];
 	char *decodedStringPtr = L0807_ac_DecodedChampionText;
 	dungeon.decodeText(decodedStringPtr, sizeof(L0807_ac_DecodedChampionText),
-			curThing, (TextType)(kDMTextTypeScroll | kDMMaskDecodeEvenIfInvisible));
+			curThing, (int16)(kDMTextTypeScroll | kDMMaskDecodeEvenIfInvisible));
 
 	uint16 charIdx = 0;
 	char tmpChar;
diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp
index ef0eef93003..2858317b967 100644
--- a/engines/dm/dm.cpp
+++ b/engines/dm/dm.cpp
@@ -1001,7 +1001,7 @@ void DMEngine::fuseSequence() {
 		for (int16 idx = 0; idx < maxCount; idx++) {
 			char decodedString[200];
 			_dungeonMan->decodeText(decodedString, sizeof(decodedString),
-					textStringThings[idx], (TextType)(kDMTextTypeMessage | kDMMaskDecodeEvenIfInvisible));
+					textStringThings[idx], (int16)(kDMTextTypeMessage | kDMMaskDecodeEvenIfInvisible));
 			if (decodedString[1] == textFirstChar) {
 				_textMan->clearAllRows();
 				decodedString[1] = '\n'; /* New line */
diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp
index f6e6ea312a8..1ad005738d5 100644
--- a/engines/dm/dungeonman.cpp
+++ b/engines/dm/dungeonman.cpp
@@ -1047,7 +1047,7 @@ Thing DungeonMan::getNextThing(Thing thing) {
 	return Thing(getThingData(thing)[0]);
 }
 
-void DungeonMan::decodeText(char *destString, size_t maxSize, Thing thing, TextType type) {
+void DungeonMan::decodeText(char *destString, size_t maxSize, Thing thing, int16 type) {
 	static char messageAndScrollEscReplacementStrings[32][8] = { // @ G0255_aac_Graphic559_MessageAndScrollEscapeReplacementStrings
 		{'x',   0,   0,   0, 0, 0, 0, 0}, /* Atari ST Version 1.0 1987-12-08 1987-12-11 1.1 1.2EN 1.2GE: { '?',  0,  0,  0, 0, 0, 0, 0 }, */
 		{'y',   0,   0,   0, 0, 0, 0, 0}, /* Atari ST Version 1.0 1987-12-08 1987-12-11 1.1 1.2EN 1.2GE: { '!',  0,  0,  0, 0, 0, 0, 0 }, */
@@ -1131,7 +1131,7 @@ void DungeonMan::decodeText(char *destString, size_t maxSize, Thing thing, TextT
 
 	TextString textString(_thingData[kDMstringTypeText] + thing.getIndex() * _thingDataWordCount[kDMstringTypeText]);
 	if ((textString.isVisible()) || (type & kDMMaskDecodeEvenIfInvisible)) {
-		type = (TextType)(type & ~kDMMaskDecodeEvenIfInvisible);
+		type &= ~kDMMaskDecodeEvenIfInvisible;
 		char sepChar;
 		if (type == kDMTextTypeMessage) {
 			*destString++ = '\n';
diff --git a/engines/dm/dungeonman.h b/engines/dm/dungeonman.h
index 59df5773c2a..9c8666a60b4 100644
--- a/engines/dm/dungeonman.h
+++ b/engines/dm/dungeonman.h
@@ -641,7 +641,7 @@ public:
 		return Square(getRelSquare(dir, stepsForward, stepsRight, posX, posY)).getType();
 	} // @ F0153_DUNGEON_GetRelativeSquareType
 	void setSquareAspect(uint16 *aspectArray, Direction dir, int16 mapX, int16 mapY); // @ F0172_DUNGEON_SetSquareAspect
-	void decodeText(char *destString, size_t maxSize, Thing thing, TextType type); // F0168_DUNGEON_DecodeText
+	void decodeText(char *destString, size_t maxSize, Thing thing, int16 type); // F0168_DUNGEON_DecodeText
 	Thing getUnusedThing(uint16 thingType); // @ F0166_DUNGEON_GetUnusedThing
 
 	uint16 getObjectWeight(Thing thing); // @ F0140_DUNGEON_GetObjectWeight
diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp
index 39cea8cb2fc..47fec4a496a 100644
--- a/engines/dm/inventory.cpp
+++ b/engines/dm/inventory.cpp
@@ -317,7 +317,7 @@ void InventoryMan::drawPanelScroll(Scroll *scroll) {
 
 	char stringFirstLine[300];
 	_vm->_dungeonMan->decodeText(stringFirstLine, sizeof(stringFirstLine),
-			Thing(scroll->getTextStringThingIndex()), (TextType)(kDMTextTypeScroll | kDMMaskDecodeEvenIfInvisible));
+			Thing(scroll->getTextStringThingIndex()), (int16)(kDMTextTypeScroll | kDMMaskDecodeEvenIfInvisible));
 	char *charRed = stringFirstLine;
 	while (*charRed && (*charRed != '\n'))
 		charRed++;


Commit: 81dab0d58a46680e5bfb47173748880aecbf7058
    https://github.com/scummvm/scummvm/commit/81dab0d58a46680e5bfb47173748880aecbf7058
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-04T22:27:39+02:00

Commit Message:
DM: Use correct size of _portrait in memset. PVS-Studio V1086

Changed paths:
    engines/dm/champion.cpp


diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp
index bddd8ce1dfd..88afc8598d7 100644
--- a/engines/dm/champion.cpp
+++ b/engines/dm/champion.cpp
@@ -59,7 +59,7 @@ void Champion::resetToZero() {
 	_directionMaximumDamageReceived = _maximumDamageReceived = _poisonEventCount = _enableActionEventIndex = 0;
 	_hideDamageReceivedIndex = _currHealth = _maxHealth = _currStamina = _maxStamina = _currMana = _maxMana = 0;
 	_actionDefense = _food = _water = _load = _shieldDefense = 0;
-	memset(_portrait, 0, 464);
+	memset(_portrait, 0, sizeof(_portrait));
 }
 
 void Champion::setWoundsFlag(ChampionWound flag, bool value) {


Commit: 14f536d2332e050f40b6e98799a79146598e9907
    https://github.com/scummvm/scummvm/commit/14f536d2332e050f40b6e98799a79146598e9907
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-04T22:27:39+02:00

Commit Message:
DM: Make variables static to prevent stack-use-after-scope. PVS-Studio V506

Changed paths:
    engines/dm/dm.cpp


diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp
index 2858317b967..f14cb2e6b78 100644
--- a/engines/dm/dm.cpp
+++ b/engines/dm/dm.cpp
@@ -757,9 +757,9 @@ void DMEngine::drawEntrance() {
 	_dungeonMan->_currMapHeight = 5;
 	_dungeonMan->_currMapData = microDungeonCurrentMapData;
 
-	Map map; // uninitialized, won't be used
+	static Map map; // uninitialized, won't be used
 	_dungeonMan->_currMap = ↦
-	Square microDungeonSquares[25];
+	static Square microDungeonSquares[25];
 	for (uint16 i = 0; i < 25; ++i)
 		microDungeonSquares[i] = Square(kDMElementTypeWall, 0);
 


Commit: f489c0b4cf36f7696d50aa20da993292fa4a3a85
    https://github.com/scummvm/scummvm/commit/f489c0b4cf36f7696d50aa20da993292fa4a3a85
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-04T22:27:39+02:00

Commit Message:
DM: Initialize members in constructor. PVS-Studio V730

Changed paths:
    engines/dm/champion.h
    engines/dm/dm.cpp


diff --git a/engines/dm/champion.h b/engines/dm/champion.h
index 254c9b6590d..18a798b572f 100644
--- a/engines/dm/champion.h
+++ b/engines/dm/champion.h
@@ -462,7 +462,7 @@ public:
 
 class Spell {
 public:
-	Spell() {}
+	Spell() : _symbols(0), _baseRequiredSkillLevel(0), _skillIndex(0), _attributes(0) {}
 	Spell(int32 symbols, byte baseSkillReq, byte skillIndex, uint16 attributes)
 	: _symbols(symbols), _baseRequiredSkillLevel(baseSkillReq), _skillIndex(skillIndex), _attributes(attributes) {}
 
diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp
index f14cb2e6b78..12d3fabd50a 100644
--- a/engines/dm/dm.cpp
+++ b/engines/dm/dm.cpp
@@ -123,7 +123,8 @@ DMEngine::DMEngine(OSystem *syst, const DMADGameDescription *desc) :
 			_thingExplFireBall(0xFF80), _thingExplSlime(0xFF81), _thingExplLightningBolt(0xFF82),
 			_thingExplHarmNonMaterial(0xFF83), _thingExplOpenDoor(0xFF84), _thingExplPoisonBolt(0xFF86),
 			_thingExplPoisonCloud(0xFF87), _thingExplSmoke(0xFFA8), _thingExplFluxcage(0xFFB2),
-			_thingExplRebirthStep1(0xFFE4), _thingExplRebirthStep2(0xFFE5), _thingParty(0xFFFF)
+			_thingExplRebirthStep1(0xFFE4), _thingExplRebirthStep2(0xFFE5), _thingParty(0xFFFF),
+			_dirIntoStepCountEast(), _dirIntoStepCountNorth()
 	{
 	// register random source
 	_rnd = new Common::RandomSource("dm");


Commit: c57c5ef12ae3eddaaf4c4c3e2bce8c9bd787cf5c
    https://github.com/scummvm/scummvm/commit/c57c5ef12ae3eddaaf4c4c3e2bce8c9bd787cf5c
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-04T22:27:39+02:00

Commit Message:
DM: Fix possible array underrun (original bug). PVS-Studio V557

Changed paths:
    engines/dm/dungeonman.cpp


diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp
index 1ad005738d5..b58e6234d17 100644
--- a/engines/dm/dungeonman.cpp
+++ b/engines/dm/dungeonman.cpp
@@ -1388,7 +1388,10 @@ int16 DungeonMan::getProjectileAspect(Thing thing) {
 			return -projAspOrd;
 	}
 
-	return _objectInfos[getObjectInfoIndex(thing)]._objectAspectIndex;
+	int16 infoIndex = getObjectInfoIndex(thing);
+	if (infoIndex < 0 || infoIndex >= 180)
+		return 0;
+	return _objectInfos[infoIndex]._objectAspectIndex;
 }
 
 int16 DungeonMan::getLocationAfterLevelChange(int16 mapIndex, int16 levelDelta, int16 *mapX, int16 *mapY) {


Commit: 81bfab4ebfb469f5386880716e9c6574bcd9ef22
    https://github.com/scummvm/scummvm/commit/81bfab4ebfb469f5386880716e9c6574bcd9ef22
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-04T22:27:39+02:00

Commit Message:
DM: Remove redundant footprint check in setSquareAspect. PVS-Studio V560

Changed paths:
    engines/dm/dungeonman.cpp


diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp
index b58e6234d17..111f7480863 100644
--- a/engines/dm/dungeonman.cpp
+++ b/engines/dm/dungeonman.cpp
@@ -989,7 +989,7 @@ T0172010_ClosedFakeWall:
 		while ((curThing != _vm->_thingEndOfList) && (curThing.getType() <= kDMThingTypeSensor))
 			curThing = getNextThing(curThing);
 
-		if (AL0307_uc_FootprintsAllowed && (AL0307_uc_ScentOrdinal = championMan.getScentOrdinal(mapX, mapY)) && (--AL0307_uc_ScentOrdinal >= championMan._party._firstScentIndex) && (AL0307_uc_ScentOrdinal < championMan._party._lastScentIndex))
+		if ((AL0307_uc_ScentOrdinal = championMan.getScentOrdinal(mapX, mapY)) && (--AL0307_uc_ScentOrdinal >= championMan._party._firstScentIndex) && (AL0307_uc_ScentOrdinal < championMan._party._lastScentIndex))
 			setFlag(aspectArray[kDMSquareAspectFloorOrn], kDMMaskFootprints);
 		break;
 	default:


Commit: a303636f891b5f6c51fa20f5c51aec9ab5828342
    https://github.com/scummvm/scummvm/commit/a303636f891b5f6c51fa20f5c51aec9ab5828342
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-04T22:27:39+02:00

Commit Message:
DM: Fix mouse button status update on button release. PVS-Studio V547

Changed paths:
    engines/dm/eventman.cpp


diff --git a/engines/dm/eventman.cpp b/engines/dm/eventman.cpp
index 7515380d0df..b5f31737419 100644
--- a/engines/dm/eventman.cpp
+++ b/engines/dm/eventman.cpp
@@ -656,7 +656,7 @@ Common::EventType EventManager::processInput(Common::Event *grabKey, Common::Eve
 		}
 		case Common::EVENT_LBUTTONUP:
 		case Common::EVENT_RBUTTONUP: {
-			MouseButton button = (event.type == Common::EVENT_LBUTTONDOWN) ? kDMMouseButtonLeft : kDMMouseButtonRight;
+			MouseButton button = (event.type == Common::EVENT_LBUTTONUP) ? kDMMouseButtonLeft : kDMMouseButtonRight;
 			_mouseButtonStatus &= ~button;
 			resetPressingEyeOrMouth();
 			break;


Commit: 75cb68ec06983e4271c8d61115e57bfe41963e4e
    https://github.com/scummvm/scummvm/commit/75cb68ec06983e4271c8d61115e57bfe41963e4e
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-04T22:27:39+02:00

Commit Message:
DM: Prevent potential uint16 underflow. PVS-Studio V658

Changed paths:
    engines/dm/eventman.cpp


diff --git a/engines/dm/eventman.cpp b/engines/dm/eventman.cpp
index b5f31737419..6eb810ec35e 100644
--- a/engines/dm/eventman.cpp
+++ b/engines/dm/eventman.cpp
@@ -1611,7 +1611,7 @@ void EventManager::commandProcessType111To115_ClickInActionArea(int16 posX, int1
 			if (mouseCommand == kDMCommandClickInActionAreaPass) {
 				commandHighlightBoxEnable(285, 319, 77, 83);
 				_vm->_menuMan->didClickTriggerAction(-1);
-			} else if ((mouseCommand - kDMCommandClickInActionAreaPass) <= _vm->_menuMan->_actionCount) {
+			} else if (mouseCommand > kDMCommandClickInActionAreaPass && (mouseCommand - kDMCommandClickInActionAreaPass) <= _vm->_menuMan->_actionCount) {
 				if (mouseCommand == kDMCommandClickInActionAreaAction0)
 					commandHighlightBoxEnable(234, 318, 86, 96);
 				else if (mouseCommand == kDMCommandClickInActionAreaAction1)


Commit: 2d47d540d8281e24856c5ca5a5d03795f0bbce13
    https://github.com/scummvm/scummvm/commit/2d47d540d8281e24856c5ca5a5d03795f0bbce13
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-04T22:27:39+02:00

Commit Message:
DM: Add boundary check in mouseProcessCommands125To128_clickOnChampionIcon. PVS-Studio V1051

Changed paths:
    engines/dm/eventman.cpp


diff --git a/engines/dm/eventman.cpp b/engines/dm/eventman.cpp
index 6eb810ec35e..b5561a7d08d 100644
--- a/engines/dm/eventman.cpp
+++ b/engines/dm/eventman.cpp
@@ -1496,7 +1496,7 @@ void EventManager::mouseProcessCommands125To128_clickOnChampionIcon(uint16 champ
 		uint16 championIconIndex = _vm->ordinalToIndex(_useChampionIconOrdinalAsMousePointerBitmap);
 		_useChampionIconOrdinalAsMousePointerBitmap = _vm->indexToOrdinal(kDMChampionNone);
 		int16 championCellIndex = _vm->_championMan->getIndexInCell(_vm->normalizeModulo4(championIconIndex + _vm->_dungeonMan->_partyDir));
-		if (championIconIndex == champIconIndex) {
+		if (championCellIndex >= 0 && championIconIndex == champIconIndex) {
 			setFlag(_vm->_championMan->_champions[championCellIndex]._attributes, kDMAttributeIcon);
 			_vm->_championMan->drawChampionState((ChampionIndex)championCellIndex);
 		} else {


Commit: 8935d35fe2aa6e044c074d2014401dd79d3a842d
    https://github.com/scummvm/scummvm/commit/8935d35fe2aa6e044c074d2014401dd79d3a842d
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-04T22:27:39+02:00

Commit Message:
DM: Fix dangling pointer by declaring projectileCoordinates at function scope. PVS-Stduio V507

Matches with reversed source code

Changed paths:
    engines/dm/gfx.cpp


diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp
index 13c9c31a5c5..38691e4b664 100644
--- a/engines/dm/gfx.cpp
+++ b/engines/dm/gfx.cpp
@@ -2955,6 +2955,7 @@ void DisplayMan::drawObjectsCreaturesProjectilesExplosions(Thing thingParam, Dir
 	ObjectAspect *objectAspect;
 	uint32 remainingViewCellOrdinalsToProcess;
 	byte *coordinateSet;
+	byte projectileCoordinates[2];
 	int16 derivedBitmapIndex = -1;
 	bool L0135_B_DrawAlcoveObjects;
 	int16 byteWidth;
@@ -3726,7 +3727,6 @@ T0115129_DrawProjectiles:
 					blitToBitmap(bitmapRedBanana, _bitmapViewport, boxByteGreen, AL_4_xPos, 0, getNormalizedByteWidth(byteWidth), k112_byteWidthViewport, kDMColorFlesh, heightRedEagle, k136_heightViewport);
 				} else { /* Positive value: projectile aspect is the index of a OBJECT_ASPECT */
 					useAlcoveObjectImage = false;
-					byte projectileCoordinates[2];
 					projectileCoordinates[0] = projectilePosX;
 					projectileCoordinates[1] = 47;
 					coordinateSet = projectileCoordinates;


Commit: c3be4eb33e1e0dd01a7af08ee27817446870efe4
    https://github.com/scummvm/scummvm/commit/c3be4eb33e1e0dd01a7af08ee27817446870efe4
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-04T22:27:39+02:00

Commit Message:
DM: Fix double assignment mistake. PVS-Studio V519

Changed paths:
    engines/dm/dungeonman.cpp
    engines/dm/gfx.cpp


diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp
index 111f7480863..b6d50a144e1 100644
--- a/engines/dm/dungeonman.cpp
+++ b/engines/dm/dungeonman.cpp
@@ -415,7 +415,6 @@ DungeonMan::DungeonMan(DMEngine *dmEngine) : _vm(dmEngine) {
 	_dungeonColumCount = 0;
 	_dungeonMapsFirstColumnIndex = nullptr;
 
-	_dungeonColumCount = 0;
 	_dungeonColumnsCumulativeSquareThingCount = nullptr;
 	_squareFirstThings = nullptr;
 	_dungeonTextData = nullptr;
diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp
index 38691e4b664..ce94179213f 100644
--- a/engines/dm/gfx.cpp
+++ b/engines/dm/gfx.cpp
@@ -71,7 +71,6 @@ DisplayMan::DisplayMan(DMEngine *dmEngine) : _vm(dmEngine) {
 	_bitmapCompressedByteCount = nullptr;
 	_bitmapDecompressedByteCount = nullptr;
 	_packedBitmaps = nullptr;
-	_bitmaps = nullptr;
 	_tmpBitmap = nullptr;
 	_bitmapFloor = nullptr;
 	_bitmapCeiling = nullptr;
@@ -118,8 +117,6 @@ DisplayMan::DisplayMan(DMEngine *dmEngine) : _vm(dmEngine) {
 	_inscriptionThing = _vm->_thingNone;
 	_useByteBoxCoordinates = false;
 
-	_bitmapCeiling = nullptr;
-	_bitmapFloor = nullptr;
 	_bitmapWallSetD3L2 = nullptr;
 	_bitmapWallSetD3R2 = nullptr;
 	_bitmapWallSetD3LCR = nullptr;


Commit: c2f2ad6b1ce9bdc08bd0a682b72f0b38de8858c7
    https://github.com/scummvm/scummvm/commit/c2f2ad6b1ce9bdc08bd0a682b72f0b38de8858c7
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-04T22:27:39+02:00

Commit Message:
DM: Fix out-of-bounds pointer arithmetic. PVS-Studio V557

Changed paths:
    engines/dm/gfx.cpp


diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp
index ce94179213f..15156df6a0e 100644
--- a/engines/dm/gfx.cpp
+++ b/engines/dm/gfx.cpp
@@ -2817,7 +2817,8 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex
 			else if (viewWallIndex == kDMViewWallD2RFront)
 				coordinateSetOffset = -6;
 		}
-		blitPosX = (ornCoordSet + coordinateSetOffset)[1] - (ornCoordSet + coordinateSetOffset)[0];
+		byte *coords = _wallOrnamentCoordSets[wallOrnamentCoordinateSetIndex][viewWallIndex + (coordinateSetOffset / 6)];
+		blitPosX = coords[1] - coords[0];
 		wallOrnamentIndex = kDMDerivedBitmapFirstWallOrnament + (wallOrnamentIndex << 2) + wallOrnDerivedBitmapIndexIncrement[viewWallIndex];
 		if (!isDerivedBitmapInCache(wallOrnamentIndex)) {
 			byte *blitBitmap = getNativeBitmapOrGraphic(ornNativeBitmapIndex);


Commit: 999255e9c3c07110febdf31330a59668d1ab11e8
    https://github.com/scummvm/scummvm/commit/999255e9c3c07110febdf31330a59668d1ab11e8
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-04T22:27:39+02:00

Commit Message:
DM: Refactor to avoid compound assignment in condition. PVS-Studio V1019

Changed paths:
    engines/dm/gfx.cpp


diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp
index 15156df6a0e..ab6ed119264 100644
--- a/engines/dm/gfx.cpp
+++ b/engines/dm/gfx.cpp
@@ -1247,7 +1247,9 @@ void DisplayMan::drawFloorOrnament(uint16 floorOrnOrdinal, ViewFloor viewFloorIn
 		return;
 
 	bool drawFootprints = (getFlag(floorOrnOrdinal, kDMMaskFootprints) ? true : false);
-	if (!drawFootprints || clearFlag(floorOrnOrdinal, kDMMaskFootprints)) {
+	if (drawFootprints)
+		clearFlag(floorOrnOrdinal, kDMMaskFootprints);
+	if (!drawFootprints || floorOrnOrdinal) {
 		floorOrnOrdinal--;
 		uint16 floorOrnIndex = floorOrnOrdinal;
 		int16 nativeBitmapIndex = _currMapFloorOrnInfo[floorOrnIndex].nativeIndice


Commit: 938f11c228a548475eb7a4890a01821fa90aff7b
    https://github.com/scummvm/scummvm/commit/938f11c228a548475eb7a4890a01821fa90aff7b
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-04T22:27:39+02:00

Commit Message:
DM: Consolidate duplicate case branches. PVS-Studio V1037

Changed paths:
    engines/dm/gfx.cpp


diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp
index ab6ed119264..b15fd5bbe1e 100644
--- a/engines/dm/gfx.cpp
+++ b/engines/dm/gfx.cpp
@@ -1944,6 +1944,8 @@ void DisplayMan::drawSquareD1L(Direction dir, int16 posX, int16 posY) {
 			drawFloorPitOrStairsBitmap(_stairsNativeBitmapIndexDownSideD1L, frameStairsDownSideD1L);
 		// fall through
 	case kDMElementTypeDoorSide:
+	case kDMElementTypeTeleporter:
+	case kDMElementTypeCorridor:
 		order = kDMCellOrderBackRightFrontRight;
 		/* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */
 		drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD1L);
@@ -1960,13 +1962,6 @@ void DisplayMan::drawSquareD1L(Direction dir, int16 posX, int16 posY) {
 	case kDMElementTypePit:
 		drawFloorPitOrStairsBitmap(squareAspect[kDMSquareAspectPitInvisible] ? kDMGraphicIdxFloorPitInvisibleD1L : kDMGraphicIdxFloorPitD1L, frameFloorPitD1L);
 		// fall through
-	case kDMElementTypeTeleporter:
-	case kDMElementTypeCorridor:
-		order = kDMCellOrderBackRightFrontRight;
-		 /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */
-		drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD1L);
-		drawCeilingPit(kDMGraphicIdxCeilingPitD1L, &frameCeilingPitD1L, posX, posY, false);
-		break;
 	default:
 		skip = true;
 		break;
@@ -2029,6 +2024,8 @@ void DisplayMan::drawSquareD1R(Direction dir, int16 posX, int16 posY) {
 
 		// fall through
 	case kDMElementTypeDoorSide:
+	case kDMElementTypeTeleporter:
+	case kDMElementTypeCorridor:
 		order = kDMCellOrderBackLeftFrontLeft;
 		drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD1R); /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */
 		drawCeilingPit(kDMGraphicIdxCeilingPitD1L, &frameCeilingPitD1R, posX, posY, true);
@@ -2045,12 +2042,6 @@ void DisplayMan::drawSquareD1R(Direction dir, int16 posX, int16 posY) {
 		drawFloorPitOrStairsBitmapFlippedHorizontally(squareAspect[kDMSquareAspectPitInvisible] ? kDMGraphicIdxFloorPitInvisibleD1L
 														   : kDMGraphicIdxFloorPitD1L, frameFloorPitD1R);
 		// fall through
-	case kDMElementTypeTeleporter:
-	case kDMElementTypeCorridor:
-		order = kDMCellOrderBackLeftFrontLeft;
-		drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD1R); /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */
-		drawCeilingPit(kDMGraphicIdxCeilingPitD1L, &frameCeilingPitD1R, posX, posY, true);
-		break;
 	default:
 		skip = true;
 		break;


Commit: 1d481b111ff232eb79f72453c09f2ea1ea447031
    https://github.com/scummvm/scummvm/commit/1d481b111ff232eb79f72453c09f2ea1ea447031
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-04T22:27:39+02:00

Commit Message:
DM: Prevent _aspect array underrun. PVS-Studio V557

Changed paths:
    engines/dm/group.cpp


diff --git a/engines/dm/group.cpp b/engines/dm/group.cpp
index 84bda38c9db..1f39a4a39d2 100644
--- a/engines/dm/group.cpp
+++ b/engines/dm/group.cpp
@@ -753,7 +753,8 @@ T0209005_AddEventAndReturn:
 		}
 		if (AL0447_i_Behavior == kDMBehaviorAttack) {
 			AL0446_i_CreatureAspectIndex = eventType - kDMEventTypeUpdateAspectCreature0; /* Value -1 for event 32, meaning aspect will be updated for all creatures in the group */
-			nextAspectUpdateTime = getCreatureAspectUpdateTime(activeGroup, AL0446_i_CreatureAspectIndex, getFlag(activeGroup->_aspect[AL0446_i_CreatureAspectIndex], kDMAspectMaskActiveGroupIsAttacking));
+			bool isAttacking = (AL0446_i_CreatureAspectIndex >= 0 && AL0446_i_CreatureAspectIndex < 4) ? getFlag(activeGroup->_aspect[AL0446_i_CreatureAspectIndex], kDMAspectMaskActiveGroupIsAttacking) : false;
+			nextAspectUpdateTime = getCreatureAspectUpdateTime(activeGroup, AL0446_i_CreatureAspectIndex, isAttacking);
 			goto T0209136;
 		}
 		if ((AL0450_i_DistanceXToParty > 3) || (AL0451_i_DistanceYToParty > 3)) {


Commit: 800a7cb451d2cec351ed287a572f8875b2ff31bd
    https://github.com/scummvm/scummvm/commit/800a7cb451d2cec351ed287a572f8875b2ff31bd
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-04T22:27:39+02:00

Commit Message:
DM: Removed redundant condition check. PVS-Studio V560

Changed paths:
    engines/dm/group.cpp


diff --git a/engines/dm/group.cpp b/engines/dm/group.cpp
index 1f39a4a39d2..744abdc2190 100644
--- a/engines/dm/group.cpp
+++ b/engines/dm/group.cpp
@@ -745,7 +745,8 @@ T0209005_AddEventAndReturn:
 			if ((AL0447_i_Behavior != kDMBehaviorAttack) && (AL0447_i_Behavior != kDMBehaviorFlee)) {
 				if (_vm->getDistance(dungeon._partyMapX, dungeon._partyMapY, eventMapX, eventMapY) <= 1)
 					goto T0209044_SetBehavior6_Attack;
-				if (((AL0447_i_Behavior == kDMBehaviorWander) || (AL0447_i_Behavior == kDMBehaviorUnknown3)) && (AL0447_i_Behavior != kDMBehaviorApproach)) /* BUG0_00 Useless code. Behavior cannot be 3 because this value is never used. Moreover, the second condition in the && is redundant (if the value is 0 or 3, it cannot be 7). The actual condition is: if (AL0447_i_Behavior == k0_behavior_WANDER) */
+				// if (((AL0447_i_Behavior == kDMBehaviorWander) || (AL0447_i_Behavior == kDMBehaviorUnknown3)) && (AL0447_i_Behavior != kDMBehaviorApproach)) /* BUG0_00 Useless code. Behavior cannot be 3 because this value is never used. Moreover, the second condition in the && is redundant (if the value is 0 or 3, it cannot be 7). The actual condition is: if (AL0447_i_Behavior == k0_behavior_WANDER) */
+				if ((AL0447_i_Behavior == kDMBehaviorWander) || (AL0447_i_Behavior == kDMBehaviorUnknown3))
 					goto T0209054_SetBehavior7_Approach;
 			}
 			activeGroup->_targetMapX = dungeon._partyMapX;


Commit: aa9931f2dc2a398b7d8598cbddba4df3b4f6aee1
    https://github.com/scummvm/scummvm/commit/aa9931f2dc2a398b7d8598cbddba4df3b4f6aee1
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-04T22:27:39+02:00

Commit Message:
DM: Correct the order of parameters to avoid confusion. PVS-Studio V764

Changed paths:
    engines/dm/group.cpp
    engines/dm/group.h


diff --git a/engines/dm/group.cpp b/engines/dm/group.cpp
index 744abdc2190..9536aad2338 100644
--- a/engines/dm/group.cpp
+++ b/engines/dm/group.cpp
@@ -1400,7 +1400,7 @@ void GroupMan::addGroupEvent(TimelineEvent *event, uint32 time) {
 	_vm->_timeline->addEventGetEventIndex(event);
 }
 
-int16 GroupMan::getSmelledPartyPrimaryDirOrdinal(CreatureInfo *creatureInfo, int16 mapY, int16 mapX) {
+int16 GroupMan::getSmelledPartyPrimaryDirOrdinal(CreatureInfo *creatureInfo, int16 mapX, int16 mapY) {
 	uint16 smellRange = creatureInfo->getSmellRange();
 	if (!smellRange)
 		return 0;
@@ -1408,14 +1408,14 @@ int16 GroupMan::getSmelledPartyPrimaryDirOrdinal(CreatureInfo *creatureInfo, int
 	ChampionMan &championMan = *_vm->_championMan;
 	DungeonMan &dungeon = *_vm->_dungeonMan;
 
-	if ((((smellRange + 1) >> 1) >= _currGroupDistanceToParty) && getDistanceBetweenUnblockedSquares(mapY, mapX, dungeon._partyMapX, dungeon._partyMapY, &GroupMan::isSmellPartyBlocked)) {
+	if ((((smellRange + 1) >> 1) >= _currGroupDistanceToParty) && getDistanceBetweenUnblockedSquares(mapX, mapY, dungeon._partyMapX, dungeon._partyMapY, &GroupMan::isSmellPartyBlocked)) {
 		_vm->_projexpl->_secondaryDirToOrFromParty = _currGroupSecondaryDirToParty;
 		return _vm->indexToOrdinal(_currGroupPrimaryDirToParty);
 	}
 
-	int16 scentOrdinal = championMan.getScentOrdinal(mapY, mapX);
+	int16 scentOrdinal = championMan.getScentOrdinal(mapX, mapY);
 	if (scentOrdinal && ((championMan._party._scentStrengths[_vm->ordinalToIndex(scentOrdinal)] + _vm->getRandomNumber(4)) > (30 - (smellRange << 1)))) { /* If there is a fresh enough party scent on the group square */
-		return _vm->indexToOrdinal(getDirsWhereDestIsVisibleFromSource(mapY, mapX, championMan._party._scents[scentOrdinal].getMapX(), championMan._party._scents[scentOrdinal].getMapY()));
+		return _vm->indexToOrdinal(getDirsWhereDestIsVisibleFromSource(mapX, mapY, championMan._party._scents[scentOrdinal].getMapX(), championMan._party._scents[scentOrdinal].getMapY()));
 	}
 	return 0;
 }
diff --git a/engines/dm/group.h b/engines/dm/group.h
index cc96c8d8c70..3af34b631b2 100644
--- a/engines/dm/group.h
+++ b/engines/dm/group.h
@@ -218,7 +218,7 @@ public:
 										   bool isAttacking); // @ F0179_GROUP_GetCreatureAspectUpdateTime
 	void setGroupDirection(ActiveGroup *activeGroup, int16 dir, int16 creatureIndex, bool twoHalfSquareSizedCreatures); // @ F0205_GROUP_SetDirection
 	void addGroupEvent(TimelineEvent *event, uint32 time); // @ F0208_GROUP_AddEvent
-	int16 getSmelledPartyPrimaryDirOrdinal(CreatureInfo *creatureInfo, int16 mapY, int16 mapX); // @ F0201_GROUP_GetSmelledPartyPrimaryDirectionOrdinal
+	int16 getSmelledPartyPrimaryDirOrdinal(CreatureInfo *creatureInfo, int16 mapX, int16 mapY); // @ F0201_GROUP_GetSmelledPartyPrimaryDirectionOrdinal
 	bool isSmellPartyBlocked(uint16 mapX, uint16 mapY); // @ F0198_GROUP_IsSmellPartyBlocked
 	int16 getFirstPossibleMovementDirOrdinal(CreatureInfo *info, int16 mapX, int16 mapY,
 												  bool allowMovementOverImaginaryPitsAndFakeWalls); // @ F0203_GROUP_GetFirstPossibleMovementDirectionOrdinal


Commit: ece35f516dfeb46c86e2d32966121f156598b291
    https://github.com/scummvm/scummvm/commit/ece35f516dfeb46c86e2d32966121f156598b291
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-04T22:27:39+02:00

Commit Message:
DM: Disable copy constructor for LZWdecompressor. PVS-Studio V690

Changed paths:
    engines/dm/lzw.h


diff --git a/engines/dm/lzw.h b/engines/dm/lzw.h
index 6d040d0d86f..3d2ab7d8014 100644
--- a/engines/dm/lzw.h
+++ b/engines/dm/lzw.h
@@ -56,6 +56,7 @@ class LZWdecompressor {
 
 	int16 getNextInputCode(Common::MemoryReadStream &stream, int32 *inputByteCount);
 	void outputCharacter(byte character, byte **out);
+	LZWdecompressor(const LZWdecompressor &other); // no implementation on purpose
 	void operator=(const LZWdecompressor&); // deleted
 public:
 	LZWdecompressor();


Commit: 78406b76af080090783957b18d13fd7e549a9331
    https://github.com/scummvm/scummvm/commit/78406b76af080090783957b18d13fd7e549a9331
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-04T22:27:39+02:00

Commit Message:
DM: Use size_t for string length in DialogMan. PVS-Studio V1029

Changed paths:
    engines/dm/dialog.cpp
    engines/dm/text.cpp


diff --git a/engines/dm/dialog.cpp b/engines/dm/dialog.cpp
index 839eaed1c02..db3d83ffd2f 100644
--- a/engines/dm/dialog.cpp
+++ b/engines/dm/dialog.cpp
@@ -148,12 +148,12 @@ void DialogMan::printCenteredChoice(byte *bitmap, const char *str, int16 posX, i
 }
 
 bool DialogMan::isMessageOnTwoLines(const char *str, char *part1, char *part2) {
-	uint16 strLength = strlen(str);
+	size_t strLength = strlen(str);
 	if (strLength <= 30)
 		return false;
 
 	Common::strcpy_s(part1, 70, str);
-	uint16 splitPosition = strLength >> 1;
+	size_t splitPosition = strLength >> 1;
 	while ((splitPosition < strLength) && (part1[splitPosition] != ' '))
 		splitPosition++;
 
diff --git a/engines/dm/text.cpp b/engines/dm/text.cpp
index 3563a8d8e86..4ac98ec21dd 100644
--- a/engines/dm/text.cpp
+++ b/engines/dm/text.cpp
@@ -56,7 +56,7 @@ void TextMan::printTextToBitmap(byte *destBitmap, uint16 destByteWidth, int16 de
 
 	uint16 destPixelWidth = destByteWidth * 2;
 
-	uint16 textLength = strlen(text);
+	size_t textLength = strlen(text);
 	uint16 nextX = destX;
 	uint16 nextY = destY;
 	byte *srcBitmap = _vm->_displayMan->getNativeBitmapOrGraphic(kDMGraphicIdxFont);
@@ -153,7 +153,7 @@ void TextMan::createNewRow() {
 }
 
 void TextMan::printString(Color color, const char* string) {
-	int16 stringLength = strlen(string);
+	size_t stringLength = strlen(string);
 	if (isTextScrolling(&_textScroller, false))
 		printToLogicalScreen(_messageAreaCursorColumn * 6, (_messageAreaCursorRow * 7 - 1) + 177, color, kDMColorBlack, string);
 	else {


Commit: 7fa36f1373d18ae49b9f843e6008c9dbf1ca9fa2
    https://github.com/scummvm/scummvm/commit/7fa36f1373d18ae49b9f843e6008c9dbf1ca9fa2
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-04T22:27:39+02:00

Commit Message:
DM: Fix double assignment mistake. PVS-Studio V519

Changed paths:
    engines/dm/group.cpp
    engines/dm/timeline.cpp


diff --git a/engines/dm/group.cpp b/engines/dm/group.cpp
index 9536aad2338..d767950ddad 100644
--- a/engines/dm/group.cpp
+++ b/engines/dm/group.cpp
@@ -1983,7 +1983,6 @@ void GroupMan::fluxCageAction(int16 mapX, int16 mapY) {
 	newEvent._Cu._slot = unusedThing.toUint16();
 	newEvent._Bu._location._mapX = mapX;
 	newEvent._Bu._location._mapY = mapY;
-	newEvent._Bu._location._mapY = mapY;
 	_vm->_timeline->addEventGetEventIndex(&newEvent);
 	int16 fluxcageCount;
 	if (isLordChaosOnSquare(mapX, mapY - 1)) {
diff --git a/engines/dm/timeline.cpp b/engines/dm/timeline.cpp
index 324de237264..bfd7df8baed 100644
--- a/engines/dm/timeline.cpp
+++ b/engines/dm/timeline.cpp
@@ -760,7 +760,6 @@ void Timeline::processEventSquareCorridor(TimelineEvent *event) {
 						newEvent._priority = 0;
 						newEvent._Bu._location._mapX = mapX;
 						newEvent._Bu._location._mapY = mapY;
-						newEvent._Bu._location._mapY = mapY;
 						addEventGetEventIndex(&newEvent);
 					}
 				}


Commit: 7a6c02a11e22badd3e8f22979e187f42e1ef64be
    https://github.com/scummvm/scummvm/commit/7a6c02a11e22badd3e8f22979e187f42e1ef64be
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-04T22:27:39+02:00

Commit Message:
DM: Use int16 cast to suppress enum range warnings. PVS-Studio V1016

Changed paths:
    engines/dm/gfx.cpp
    engines/dm/gfx.h
    engines/dm/timeline.cpp


diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp
index b15fd5bbe1e..140ef36070e 100644
--- a/engines/dm/gfx.cpp
+++ b/engines/dm/gfx.cpp
@@ -1061,14 +1061,14 @@ void DisplayMan::fillBoxBitmap(byte *destBitmap, Box &box, Color color, int16 by
 }
 
 void DisplayMan::blitBoxFilledWithMaskedBitmap(byte *src, byte *dest, byte *mask, byte *tmp, Box& box,
-											   int16 lastUnitIndex, int16 firstUnitIndex, int16 destByteWidth, Color transparent,
+											   int16 lastUnitIndex, int16 firstUnitIndex, int16 destByteWidth, int16 transparent,
 											   int16 xPos, int16 yPos, int16 destHeight, int16 height2) {
 
 	// FIXME: does not produce the same effect as the original
 
 	byte nextUnitIndex = firstUnitIndex;
 	bool useMask = !(transparent & k0x0080_BlitDoNotUseMask);
-	transparent = (Color)(transparent & ~(k0x0080_BlitDoNotUseMask)); // clear flag 0x0080
+	transparent &= ~k0x0080_BlitDoNotUseMask; // clear flag 0x0080
 	for (byte next_y = box._rect.top; next_y <= box._rect.bottom; next_y++) { // '<=' for inclusive boundaries
 		for (byte next_x = box._rect.left; next_x <= box._rect.right; next_x++) { // '<=' for inclusive boundaries
 			byte *nextDestPixel = dest + next_y * destByteWidth * 2 + next_x;
@@ -2912,7 +2912,7 @@ void DisplayMan::drawField(FieldAspect *fieldAspect, Box& box) {
 	byte *bitmap = getNativeBitmapOrGraphic(kDMGraphicIdxFieldTeleporter + fieldAspect->_nativeBitmapRelativeIndex);
 	blitBoxFilledWithMaskedBitmap(bitmap, _bitmapViewport, bitmapMask, getDerivedBitmap(kDMDerivedBitmapViewport), box,
 									   _vm->getRandomNumber(2) + fieldAspect->_baseStartUnitIndex, _vm->getRandomNumber(32), k112_byteWidthViewport,
-									   (Color)fieldAspect->_transparentColor, fieldAspect->_xPos, 0, 136, fieldAspect->_bitplaneWordCount);
+									   fieldAspect->_transparentColor, fieldAspect->_xPos, 0, 136, fieldAspect->_bitplaneWordCount);
 	addDerivedBitmap(kDMDerivedBitmapViewport);
 	releaseBlock(kDMDerivedBitmapViewport | 0x8000);
 }
@@ -3796,7 +3796,7 @@ T0115171_BackFromT0115015_DrawProjectileAsObject:;
 					blitToBitmapShrinkWithPalChange(bitmapRedBanana, _tmpBitmap, 48, 32, 48, 32, _palChangeSmoke);
 					bitmapRedBanana = _tmpBitmap;
 				}
-				blitBoxFilledWithMaskedBitmap(bitmapRedBanana, _bitmapViewport, nullptr, getDerivedBitmap(kDMDerivedBitmapViewport), boxExplosionPatternD0C, _vm->getRandomNumber(4) + 87, _vm->getRandomNumber(64), k112_byteWidthViewport, Color(k0x0080_BlitDoNotUseMask | kDMColorFlesh), 0, 0, 136, 93);
+				blitBoxFilledWithMaskedBitmap(bitmapRedBanana, _bitmapViewport, nullptr, getDerivedBitmap(kDMDerivedBitmapViewport), boxExplosionPatternD0C, _vm->getRandomNumber(4) + 87, _vm->getRandomNumber(64), k112_byteWidthViewport, k0x0080_BlitDoNotUseMask | kDMColorFlesh, 0, 0, 136, 93);
 				addDerivedBitmap(kDMDerivedBitmapViewport);
 				warning("DISABLED CODE: f480_releaseBlock in drawObjectsCreaturesProjectilesExplosions");
 				//f480_releaseBlock(k0_DerivedBitmapViewport | 0x8000);
diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h
index 4e734110113..34c84ae2f5f 100644
--- a/engines/dm/gfx.h
+++ b/engines/dm/gfx.h
@@ -742,7 +742,7 @@ public:
 						   uint16 destByteWidth, Color transparent, int16 srcHeight, int16 destHight); // @ F0132_VIDEO_Blit
 	 /* Expects inclusive boundaries in box */
 	void blitBoxFilledWithMaskedBitmap(byte *src, byte *dest, byte *mask, byte *tmp, Box &box, int16 lastUnitIndex,
-											int16 firstUnitIndex, int16 destByteWidth, Color transparent,
+											int16 firstUnitIndex, int16 destByteWidth, int16 transparent,
 											int16 xPos, int16 yPos, int16 destHeight, int16 height2); // @ F0133_VIDEO_BlitBoxFilledWithMaskedBitmap
 		 // this function takes pixel widths
 	void blitToBitmapShrinkWithPalChange(byte *srcBitmap, byte *destBitmap,
diff --git a/engines/dm/timeline.cpp b/engines/dm/timeline.cpp
index bfd7df8baed..0d966077f28 100644
--- a/engines/dm/timeline.cpp
+++ b/engines/dm/timeline.cpp
@@ -417,8 +417,10 @@ void Timeline::processEventDoorAnimation(TimelineEvent *event) {
 				if (_vm->_groupMan->getDamageAllCreaturesOutcome((Group *)_vm->_dungeonMan->getThingData(groupThing), mapX, mapY, 5, true) != kDMKillOutcomeAllCreaturesInGroup)
 					_vm->_groupMan->processEvents29to41(mapX, mapY, kDMEventTypeCreateReactionDangerOnSquare, 0);
 
-				int16 nextState = doorState - 1;
-				doorState = (doorState == kDMDoorStateOpen) ? kDMDoorStateOpen : (DoorState) nextState;
+				int16 nextState = (int16)doorState - 1;
+				if (nextState < 0)
+					nextState = 0;
+				doorState = (DoorState)nextState;
 				curSquare->setDoorState(doorState);
 				_vm->_sound->requestPlay(kDMSoundIndexWoodenThudAttackTrolinAntmanStoneGolem, mapX, mapY, kDMSoundModePlayIfPrioritized);
 				event->_mapTime++;
@@ -433,9 +435,13 @@ void Timeline::processEventDoorAnimation(TimelineEvent *event) {
 	if ((sensorEffect == kDMSensorEffectClear) && (doorState == kDMDoorStateClosed))
 		return;
 
-	int16 nextDoorEffect = doorState + 1;
-	int16 prevDoorEffect = doorState - 1;
-	doorState = (DoorState) ((sensorEffect == kDMSensorEffectSet) ? prevDoorEffect : nextDoorEffect);
+	int16 nextDoorStateVal = (sensorEffect == kDMSensorEffectSet) ? (int16)doorState - 1 : (int16)doorState + 1;
+	if (nextDoorStateVal < 0) {
+		nextDoorStateVal = 0;
+	} else if (nextDoorStateVal > 4) {
+		nextDoorStateVal = 4;
+	}
+	doorState = (DoorState)nextDoorStateVal;
 	curSquare->setDoorState(doorState);
 	_vm->_sound->requestPlay(kDMSoundIndexDoorRattle, mapX, mapY, kDMSoundModePlayIfPrioritized);
 


Commit: 6e79884984913087fddb709dab5c9fff4a6b53c9
    https://github.com/scummvm/scummvm/commit/6e79884984913087fddb709dab5c9fff4a6b53c9
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-04T22:27:39+02:00

Commit Message:
DM: Fix strict alignment warning in processTimeline. PVS-Studio V1032

Changed paths:
    engines/dm/timeline.cpp


diff --git a/engines/dm/timeline.cpp b/engines/dm/timeline.cpp
index 0d966077f28..43e8510ff9c 100644
--- a/engines/dm/timeline.cpp
+++ b/engines/dm/timeline.cpp
@@ -308,8 +308,8 @@ void Timeline::processTimeline() {
 			case kDMEventTypeRemoveFluxcage:
 				if (!_vm->_gameWon) {
 					_vm->_dungeonMan->unlinkThingFromList(Thing(newEvent._Cu._slot), Thing(0), newEvent._Bu._location._mapX, newEvent._Bu._location._mapY);
-					curEvent = (TimelineEvent *)_vm->_dungeonMan->getThingData(Thing(newEvent._Cu._slot));
-					((Explosion *)curEvent)->setNextThing(_vm->_thingNone);
+					Explosion *explosion = (Explosion *)_vm->_dungeonMan->getThingData(Thing(newEvent._Cu._slot));
+					explosion->setNextThing(_vm->_thingNone);
 				}
 				break;
 			case kDMEventTypeEnableChampionAction:


Commit: 579b31bd6b94ede2bf4e4f508e97882816e303ff
    https://github.com/scummvm/scummvm/commit/579b31bd6b94ede2bf4e4f508e97882816e303ff
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-04T22:27:39+02:00

Commit Message:
DM: Refactor self assignment. PVS-Studio V1048

Changed paths:
    engines/dm/gfx.cpp
    engines/dm/lzw.cpp
    engines/dm/menus.cpp
    engines/dm/movesens.cpp
    engines/dm/timeline.cpp


diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp
index 140ef36070e..a74c0146eed 100644
--- a/engines/dm/gfx.cpp
+++ b/engines/dm/gfx.cpp
@@ -2830,7 +2830,6 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex
 	}
 	byte byteFrame[6];
 	if (isInscription) {
-		byte *blitBitmap = ornCoordSet;
 		byte *inscrString2 = inscriptionString;
 		int16 unreadableTextLineCount = 0;
 		do {
@@ -2839,7 +2838,6 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex
 			}
 			unreadableTextLineCount++;
 		} while (*inscrString2++ != 129); /* Hexadecimal: 0x81 (Megamax C does not support hexadecimal character constants) */
-		ornCoordSet = blitBitmap;
 		if (unreadableTextLineCount < 4) {
 			for (uint16 i = 0; i < 6; ++i)
 				byteFrame[i] = ornCoordSet[i];
@@ -3341,7 +3339,6 @@ T0115015_DrawProjectileAsObject:
 						AL_6_box->_rect.top = MIN(AL_6_box->_rect.top, boxByteGreen._rect.top);
 						AL_6_box->_rect.bottom = MAX(AL_6_box->_rect.bottom, boxByteGreen._rect.bottom);
 					}
-					bitmapRedBanana = bitmapGreenAnt;
 					dungeon._pileTopObject[AL_2_viewCell] = thingParam; /* The object is at the top of the pile */
 				}
 				blitToBitmap(bitmapRedBanana, _bitmapViewport, boxByteGreen, AL_4_xPos, 0, getNormalizedByteWidth(byteWidth), k112_byteWidthViewport, kDMColorFlesh, heightRedEagle, k136_heightViewport);
diff --git a/engines/dm/lzw.cpp b/engines/dm/lzw.cpp
index 6360478a5a1..6cab6d8b42e 100644
--- a/engines/dm/lzw.cpp
+++ b/engines/dm/lzw.cpp
@@ -131,7 +131,7 @@ int32 LZWdecompressor::decompress(Common::MemoryReadStream &inStream, int32 inpu
 	byte *reversedDecodedStringEnd = reversedDecodedStringStart = _tempBuffer;
 	byte *originalOut = out;
 	_repetitionEnabled = false;
-	_codeBitCount = 9;
+	// _codeBitCount = 9;
 	_dictFlushed = false;
 	_currentMaximumCode = (1 << (_codeBitCount = 9)) - 1;
 	for (int16 code = 255; code >= 0; code--) {
diff --git a/engines/dm/menus.cpp b/engines/dm/menus.cpp
index 7fca0f08134..795e5575c5c 100644
--- a/engines/dm/menus.cpp
+++ b/engines/dm/menus.cpp
@@ -1294,7 +1294,6 @@ bool MenuMan::isActionPerformed(uint16 champIndex, int16 actionIndex) {
 				curChampion->_currMana = 0;
 
 			setFlag(curChampion->_attributes, kDMAttributeStatistics);
-			actionPerformed = true;
 		}
 		}
 		break;
diff --git a/engines/dm/movesens.cpp b/engines/dm/movesens.cpp
index 5333dcbc9f3..d8f82df7e87 100644
--- a/engines/dm/movesens.cpp
+++ b/engines/dm/movesens.cpp
@@ -308,7 +308,6 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM
 			} else {
 				if ((destinationSquareType == (int)kDMElementTypePit) && !thingLevitates && getFlag(destinationSquareData, kDMSquareMaskPitOpen) && !getFlag(destinationSquareData, kDMSquareMaskPitImaginary)) {
 					if (drawDungeonViewWhileFalling && !_useRopeToClimbDownPit) {
-						drawDungeonViewWhileFalling = true;
 						if (traversedPitCount) {
 							dungeon.setCurrentMapAndPartyMap(mapIndexDestination);
 							display.loadCurrentMapGraphics();
diff --git a/engines/dm/timeline.cpp b/engines/dm/timeline.cpp
index 43e8510ff9c..16757915538 100644
--- a/engines/dm/timeline.cpp
+++ b/engines/dm/timeline.cpp
@@ -352,7 +352,7 @@ void Timeline::processTimeline() {
 				break;
 			case kDMEventTypePoisonChampion: {
 				uint16 championIndex = newEvent._priority;
-				_vm->_championMan->_champions[championIndex = newEvent._priority]._poisonEventCount--;
+				_vm->_championMan->_champions[championIndex]._poisonEventCount--;
 				_vm->_championMan->championPoison(championIndex, newEvent._Bu._attack);
 				}
 				break;




More information about the Scummvm-git-logs mailing list