[Scummvm-git-logs] scummvm master -> 98c9b23e673706040b9c773fe73e5cfe9ee2dcdf

sev- noreply at scummvm.org
Sun Jun 21 22:12:09 UTC 2026


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

Summary:
f48a7fa3dd DM: Fix logical bug checking for Fluxcage explosion type in group movement. PVS-Studio V547
82dac76c43 DM: Remove redundant upper bound check. PVS-Studio V560
6d0918292c DM: Use correct index to access champion in drawPanelFoodWaterPoisoned
818dfc7c95 DM: Use correct index to access door button derived bitmap
0b18f8b82c DM: Correct Bitmask in ProjExpl::projectileDelete().
83b27c3350 DM: Fix heap-buffer-overflow in processEventDoorAnimation
df38a47bd5 DM: Fix visual glitches on flying items
0dac5427cd DM: Correct _actionDefense array indexing to prevent out-of-bounds crash
874ff4a4f4 DM: Skip unused thing slots in Console::Cmd_gimme
39c1088693 DM: Add "nuke" command to debugger console
cd9e41d1d5 DM: Fix duplicate item references and crashes from gimme debug command
558e3b329e DM: Add bounds checking to prevent crashes from out-of-bounds object aspect reads
fa2245a23c DM: Change ActiveGroup::_directions type to uint16 to prevent undefined behavior
5b306e97c7 DM: Fix infinite loop freeze in dropCreatureFixedPossessions
98c9b23e67 DM: Fix crash when throwing projectiles by correcting cache index offsets


Commit: f48a7fa3ddce818f86bb67428d3a11607adafe60
    https://github.com/scummvm/scummvm/commit/f48a7fa3ddce818f86bb67428d3a11607adafe60
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-22T00:11:59+02:00

Commit Message:
DM: Fix logical bug checking for Fluxcage explosion type in group movement. PVS-Studio V547

Now matches the reversed source code.

Changed paths:
    engines/dm/group.cpp


diff --git a/engines/dm/group.cpp b/engines/dm/group.cpp
index d767950ddad..d83f96fcdf5 100644
--- a/engines/dm/group.cpp
+++ b/engines/dm/group.cpp
@@ -1126,8 +1126,8 @@ bool GroupMan::isMovementPossible(CreatureInfo *creatureInfo, int16 mapX, int16
 		Thing curThing = dungeon.getSquareFirstThing(mapX, mapY);
 		while (curThing != _vm->_thingEndOfList) {
 			if ((curThing).getType() == kDMThingTypeExplosion) {
-				Teleporter *curTeleporter = (Teleporter *)dungeon.getThingData(curThing);
-				if (((Explosion *)curTeleporter)->setType(kDMExplosionTypeFluxcage)) {
+				Explosion *explosion = (Explosion *)dungeon.getThingData(curThing);
+				if (explosion->getType() == kDMExplosionTypeFluxcage) {
 					_fluxCages[dir] = true;
 					_fluxCageCount++;
 					_groupMovBlockedByWallStairsPitFakeWalFluxCageTeleporter = true;


Commit: 82dac76c43d93f9fc741716443df479486462eb4
    https://github.com/scummvm/scummvm/commit/82dac76c43d93f9fc741716443df479486462eb4
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-22T00:11:59+02:00

Commit Message:
DM: Remove redundant upper bound check. PVS-Studio V560

Changed paths:
    engines/dm/group.cpp


diff --git a/engines/dm/group.cpp b/engines/dm/group.cpp
index d83f96fcdf5..4558c4514be 100644
--- a/engines/dm/group.cpp
+++ b/engines/dm/group.cpp
@@ -754,7 +754,7 @@ 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 */
-			bool isAttacking = (AL0446_i_CreatureAspectIndex >= 0 && AL0446_i_CreatureAspectIndex < 4) ? getFlag(activeGroup->_aspect[AL0446_i_CreatureAspectIndex], kDMAspectMaskActiveGroupIsAttacking) : false;
+			bool isAttacking = (AL0446_i_CreatureAspectIndex >= 0) ? getFlag(activeGroup->_aspect[AL0446_i_CreatureAspectIndex], kDMAspectMaskActiveGroupIsAttacking) : false;
 			nextAspectUpdateTime = getCreatureAspectUpdateTime(activeGroup, AL0446_i_CreatureAspectIndex, isAttacking);
 			goto T0209136;
 		}


Commit: 6d0918292c4b1150ea84aa13dc4c39a199d5d106
    https://github.com/scummvm/scummvm/commit/6d0918292c4b1150ea84aa13dc4c39a199d5d106
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-22T00:11:59+02:00

Commit Message:
DM: Use correct index to access champion in drawPanelFoodWaterPoisoned

Fix heap-buffer-overflow in drawPanelFoodWaterPoisoned by converting ordinal to index. It occured when you click on 4th party member.

Changed paths:
    engines/dm/inventory.cpp


diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp
index 47fec4a496a..fbf49a21b7d 100644
--- a/engines/dm/inventory.cpp
+++ b/engines/dm/inventory.cpp
@@ -207,7 +207,7 @@ void InventoryMan::drawPanelFoodWaterPoisoned() {
 	static Box boxWater(112, 159, 83, 91); // @ G0036_s_Graphic562_Box_Water
 	static Box boxPoisoned(112, 207, 105, 119); // @ G0037_s_Graphic562_Box_Poisoned
 
-	Champion &champ = _vm->_championMan->_champions[_inventoryChampionOrdinal];
+	Champion &champ = _vm->_championMan->_champions[_vm->ordinalToIndex(_inventoryChampionOrdinal)];
 	closeChest();
 	DisplayMan &dispMan = *_vm->_displayMan;
 


Commit: 818dfc7c95b678c0c3371c3757a2314acaaadd14
    https://github.com/scummvm/scummvm/commit/818dfc7c95b678c0c3371c3757a2314acaaadd14
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-22T00:11:59+02:00

Commit Message:
DM: Use correct index to access door button derived bitmap

Fixes a crash when drawing a door button. Matches with reversed source code.

Changed paths:
    engines/dm/gfx.cpp


diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp
index a74c0146eed..426d0db39aa 100644
--- a/engines/dm/gfx.cpp
+++ b/engines/dm/gfx.cpp
@@ -948,7 +948,7 @@ void DisplayMan::drawDoorButton(int16 doorButtonOrdinal, DoorButton doorButton)
 			dungeon._dungeonViewClickableBoxes[kDMViewCellDoorButtonOrWallOrn]._rect.top = coordSetRedEagle[2];
 			dungeon._dungeonViewClickableBoxes[kDMViewCellDoorButtonOrWallOrn]._rect.bottom = coordSetRedEagle[3];
 		} else {
-			doorButtonOrdinal = kDMDerivedBitmapFirstDoorButton + (doorButtonOrdinal * 2) + ((doorButton != kDMDoorButtonD3R) ? 0 : (int16)doorButton - 1);
+			doorButtonOrdinal = kDMDerivedBitmapFirstDoorButton + (doorButtonOrdinal * 2) + ((!doorButton) ? 0 : doorButton - 1);
 			if (!isDerivedBitmapInCache(doorButtonOrdinal)) {
 				uint16 *coordSetBlueGoat = _doorButtonCoordSets[coordSet][kDMDoorButtonD1C];
 				byte *bitmapNative = getNativeBitmapOrGraphic(nativeBitmapIndex);


Commit: 0b18f8b82cec88597e0fc740433cdc1a5deaced7
    https://github.com/scummvm/scummvm/commit/0b18f8b82cec88597e0fc740433cdc1a5deaced7
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-22T00:11:59+02:00

Commit Message:
DM: Correct Bitmask in ProjExpl::projectileDelete().

Matches original.

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


diff --git a/engines/dm/group.cpp b/engines/dm/group.cpp
index 4558c4514be..c6180060ba6 100644
--- a/engines/dm/group.cpp
+++ b/engines/dm/group.cpp
@@ -539,7 +539,7 @@ uint16 GroupMan::getGroupValueUpdatedWithCreatureValue(uint16 groupVal, uint16 c
 	creatureVal &= 0x0003;
 	creatureIndex <<= 1;
 	creatureVal <<= creatureIndex;
-	return creatureVal | (groupVal & ~(3 << creatureVal));
+	return creatureVal | (groupVal & ~(3 << creatureIndex));
 }
 
 int16 GroupMan::getDamageAllCreaturesOutcome(Group *group, int16 mapX, int16 mapY, int16 attack, bool notMoving) {
diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp
index b523d446715..ba60479d8c7 100644
--- a/engines/dm/projexpl.cpp
+++ b/engines/dm/projexpl.cpp
@@ -385,7 +385,7 @@ void ProjExpl::projectileDelete(Thing projectileThing, Thing *groupSlot, int16 m
 			} else
 				_vm->_dungeonMan->linkThingToList(projectileSlotThing, previousThing, kDMMapXNotOnASquare, 0);
 		} else
-			_vm->_moveSens->getMoveResult(Thing((projectileSlotThing).getTypeAndIndex() | getFlag(projectileThing.toUint16(), 0xC)), -2, 0, mapX, mapY);
+			_vm->_moveSens->getMoveResult(Thing((projectileSlotThing).getTypeAndIndex() | getFlag(projectileThing.toUint16(), 0xC000)), -2, 0, mapX, mapY);
 	}
 	projectile->_nextThing = _vm->_thingNone;
 }


Commit: 83b27c3350f8582f4dcb1b4d09eb4366d9798643
    https://github.com/scummvm/scummvm/commit/83b27c3350f8582f4dcb1b4d09eb4366d9798643
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-22T00:11:59+02:00

Commit Message:
DM: Fix heap-buffer-overflow in processEventDoorAnimation

Stop unconditional querying the creature's attributes before checking if a creature group actually existed on that square.

Changed paths:
    engines/dm/timeline.cpp


diff --git a/engines/dm/timeline.cpp b/engines/dm/timeline.cpp
index 16757915538..7ccc089b813 100644
--- a/engines/dm/timeline.cpp
+++ b/engines/dm/timeline.cpp
@@ -411,8 +411,8 @@ void Timeline::processEventDoorAnimation(TimelineEvent *event) {
 			return;
 		}
 		Thing groupThing = _vm->_groupMan->groupGetThing(mapX, mapY);
-		uint16 creatureAttributes = _vm->_dungeonMan->getCreatureAttributes(groupThing);
-		if ((groupThing != _vm->_thingEndOfList) && !getFlag(creatureAttributes, kDMCreatureMaskNonMaterial)) {
+		uint16 creatureAttributes;
+		if ((groupThing != _vm->_thingEndOfList) && !getFlag((creatureAttributes = _vm->_dungeonMan->getCreatureAttributes(groupThing)), kDMCreatureMaskNonMaterial)) {
 			if (doorState >= (verticalDoorFl ? CreatureInfo::getHeight(creatureAttributes) : 1)) { /* Creature height or 1 */
 				if (_vm->_groupMan->getDamageAllCreaturesOutcome((Group *)_vm->_dungeonMan->getThingData(groupThing), mapX, mapY, 5, true) != kDMKillOutcomeAllCreaturesInGroup)
 					_vm->_groupMan->processEvents29to41(mapX, mapY, kDMEventTypeCreateReactionDangerOnSquare, 0);


Commit: df38a47bd5ab55e06b8ad675d8a1fe496713652f
    https://github.com/scummvm/scummvm/commit/df38a47bd5ab55e06b8ad675d8a1fe496713652f
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-22T00:11:59+02:00

Commit Message:
DM: Fix visual glitches on flying items

Use the correct 8-byte aligned destination stride when writing to shrunk bitmaps in blitToBitmapShrinkWithPalChange.

Changed paths:
    engines/dm/gfx.cpp


diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp
index 426d0db39aa..01e350fffe3 100644
--- a/engines/dm/gfx.cpp
+++ b/engines/dm/gfx.cpp
@@ -2870,11 +2870,12 @@ void DisplayMan::blitToBitmapShrinkWithPalChange(byte *srcBitmap, byte *destBitm
 
 	uint32 scaleX = (kScaleThreshold * srcPixelWidth) / destPixelWidth;
 	uint32 scaleY = (kScaleThreshold * srcHeight) / destHeight;
+	uint32 destStride = getNormalizedByteWidth(destPixelWidth / 2) * 2;
 
 	// Loop through drawing output lines
 	for (uint32 destY = 0, scaleYCtr = 0; destY < (uint32)destHeight; ++destY, scaleYCtr += scaleY) {
 		const byte *srcLine = &srcBitmap[(scaleYCtr / kScaleThreshold) * srcPixelWidth];
-		byte *destLine = &destBitmap[destY * destPixelWidth];
+		byte *destLine = &destBitmap[destY * destStride];
 
 		// Loop through drawing the pixels of the row
 		for (uint32 destX = 0, xCtr = 0, scaleXCtr = 0; destX < (uint32)destPixelWidth; ++destX, ++xCtr, scaleXCtr += scaleX)


Commit: 0dac5427cd988375d3ed8cda92e158e1c00d86ec
    https://github.com/scummvm/scummvm/commit/0dac5427cd988375d3ed8cda92e158e1c00d86ec
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-22T00:11:59+02:00

Commit Message:
DM: Correct _actionDefense array indexing to prevent out-of-bounds crash

Changed paths:
    engines/dm/timeline.cpp


diff --git a/engines/dm/timeline.cpp b/engines/dm/timeline.cpp
index 7ccc089b813..4aae9c1317b 100644
--- a/engines/dm/timeline.cpp
+++ b/engines/dm/timeline.cpp
@@ -835,7 +835,7 @@ void Timeline::processEventEnableChampionAction(uint16 champIndex) {
 	curChampion->_enableActionEventIndex = -1;
 	clearFlag(curChampion->_attributes, kDMAttributeDisableAction);
 	if (curChampion->_actionIndex != kDMActionNone) {
-		curChampion->_actionDefense -= _actionDefense[curChampion->_actionDefense];
+		curChampion->_actionDefense -= _actionDefense[curChampion->_actionIndex];
 	}
 	if (curChampion->_currHealth) {
 		if ((curChampion->_actionIndex == kDMActionShoot) && (curChampion->_slots[kDMSlotReadyHand] == _vm->_thingNone)) {


Commit: 874ff4a4f415ba608e267a92d05bc465e9ceea78
    https://github.com/scummvm/scummvm/commit/874ff4a4f415ba608e267a92d05bc465e9ceea78
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-22T00:11:59+02:00

Commit Message:
DM: Skip unused thing slots in Console::Cmd_gimme

Prevent out of bounds array lookup in DungeonMan::getWeaponInfo and ObjectMan::getObjectType.

Changed paths:
    engines/dm/console.cpp


diff --git a/engines/dm/console.cpp b/engines/dm/console.cpp
index 7372da0bb18..97ff814eede 100644
--- a/engines/dm/console.cpp
+++ b/engines/dm/console.cpp
@@ -263,6 +263,9 @@ bool Console::Cmd_gimme(int argc, const char** argv) {
 		dummyThing.setType(thingType);
 		for (int16 thingIndex = 0; thingIndex < thingCount; ++thingIndex) {
 			dummyThing.setIndex(thingIndex);
+			uint16 *rawType = _vm->_dungeonMan->getThingData(dummyThing);
+			if (rawType[0] == _vm->_thingNone.toUint16())
+				continue;
 			int16 iconIndex = _vm->_objectMan->getIconIndex(dummyThing);
 			if (iconIndex >= 0 && iconIndex < kDMObjectNameCount) {
 				const char *displayName = _vm->_objectMan->_objectNames[iconIndex];


Commit: 39c10886931b77f6769d43606e662b81eba023b8
    https://github.com/scummvm/scummvm/commit/39c10886931b77f6769d43606e662b81eba023b8
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-22T00:11:59+02:00

Commit Message:
DM: Add "nuke" command to debugger console

Kill/Delete the creature group in front of you.

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


diff --git a/engines/dm/console.cpp b/engines/dm/console.cpp
index 97ff814eede..eeb6d51c604 100644
--- a/engines/dm/console.cpp
+++ b/engines/dm/console.cpp
@@ -30,6 +30,7 @@
 #include "dm/dungeonman.h"
 #include "dm/movesens.h"
 #include "dm/objectman.h"
+#include "dm/group.h"
 
 
 namespace DM {
@@ -67,6 +68,7 @@ Console::Console(DM::DMEngine* vm) : _vm(vm) {
 	registerCmd("map", WRAP_METHOD(Console, Cmd_map));
 	registerCmd("listItems", WRAP_METHOD(Console, Cmd_listItems));
 	registerCmd("gimme", WRAP_METHOD(Console, Cmd_gimme));
+	registerCmd("nuke", WRAP_METHOD(Console, Cmd_nuke));
 }
 
 bool Console::Cmd_godmode(int argc, const char** argv) {
@@ -289,4 +291,20 @@ bool Console::Cmd_gimme(int argc, const char** argv) {
 	return true;
 }
 
+bool Console::Cmd_nuke(int argc, const char** argv) {
+	DungeonMan &dm = *_vm->_dungeonMan;
+	int16 mapX = dm._partyMapX;
+	int16 mapY = dm._partyMapY;
+	dm.mapCoordsAfterRelMovement(dm._partyDir, 1, 0, mapX, mapY);
+
+	Thing groupThing = _vm->_groupMan->groupGetThing(mapX, mapY);
+	if (groupThing != _vm->_thingNone && groupThing != _vm->_thingEndOfList) {
+		_vm->_groupMan->groupDelete(mapX, mapY);
+		debugPrintf("Creatures in front have been nuked!\n");
+	} else {
+		debugPrintf("No creatures found in front of you.\n");
+	}
+	return true;
+}
+
 }
diff --git a/engines/dm/console.h b/engines/dm/console.h
index 0111e774ae0..6b2d21afb4b 100644
--- a/engines/dm/console.h
+++ b/engines/dm/console.h
@@ -43,6 +43,7 @@ private:
 	bool Cmd_map(int argc, const char **argv);
 	bool Cmd_listItems(int argc, const char **argv);
 	bool Cmd_gimme(int argc, const char **argv);
+	bool Cmd_nuke(int argc, const char **argv);
 
 	const char *debugGetDirectionName(int16 dir);
 


Commit: cd9e41d1d5c4533069ca1a2d54beb95afb2cde30
    https://github.com/scummvm/scummvm/commit/cd9e41d1d5c4533069ca1a2d54beb95afb2cde30
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-22T00:11:59+02:00

Commit Message:
DM: Fix duplicate item references and crashes from gimme debug command

Changed paths:
    engines/dm/console.cpp


diff --git a/engines/dm/console.cpp b/engines/dm/console.cpp
index eeb6d51c604..6c2082529c8 100644
--- a/engines/dm/console.cpp
+++ b/engines/dm/console.cpp
@@ -279,6 +279,7 @@ bool Console::Cmd_gimme(int argc, const char** argv) {
 						newThingData[thingCount * thingTypeSize + i] = newThingData[thingIndex * thingTypeSize + i];
 					_vm->_dungeonMan->_dungeonFileHeader._thingCounts[thingType]++;
 					_vm->_dungeonMan->_thingData[thingType] = newThingData;
+					dummyThing.setIndex(thingCount);
 					_vm->_championMan->addObjectInSlot((ChampionIndex)0, dummyThing, (ChampionSlot)29);
 					debugPrintf("Item gimmed to the first champion, last slot\n");
 					return true;


Commit: 558e3b329e54c713504b62c6d96835a9f025dbb5
    https://github.com/scummvm/scummvm/commit/558e3b329e54c713504b62c6d96835a9f025dbb5
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-22T00:11:59+02:00

Commit Message:
DM: Add bounds checking to prevent crashes from out-of-bounds object aspect reads

Changed paths:
    engines/dm/gfx.cpp


diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp
index 01e350fffe3..3da5c63fbdf 100644
--- a/engines/dm/gfx.cpp
+++ b/engines/dm/gfx.cpp
@@ -2991,6 +2991,9 @@ void DisplayMan::drawObjectsCreaturesProjectilesExplosions(Thing thingParam, Dir
 	bool drawProjectileAsObject; /* When true, the code section to draw an object is called (with a goto) to draw the projectile, then the code section goes back to projectile processing with another goto */
 	uint16 currentViewCellToDraw = 0;
 	bool projectileFlipVertical = false;
+	uint16 infoIndex;
+	uint16 aspectIndex;
+
 
 	/* This is the full dungeon view */
 	static Box boxExplosionPatternD0C = Box(0, 223, 0, 135); // @ G0105_s_Graphic558_Box_ExplosionPattern_D0C
@@ -3234,7 +3237,13 @@ void DisplayMan::drawObjectsCreaturesProjectilesExplosions(Thing thingParam, Dir
 			}
 
 			if ((viewSquareIndex >= kDMViewSquareD3C) && (viewSquareIndex <= kDMViewSquareD0C) && (thingParam.getCell() == cellYellowBear)) { /* Square where objects are visible and object is located on cell being processed */
-				objectAspect = &(_objectAspects209[dungeon._objectInfos[dungeon.getObjectInfoIndex(thingParam)]._objectAspectIndex]);
+				infoIndex = dungeon.getObjectInfoIndex(thingParam);
+				if (infoIndex >= 180)
+					continue;
+				aspectIndex = dungeon._objectInfos[infoIndex]._objectAspectIndex;
+				if (aspectIndex >= k85_ObjAspectCount)
+					continue;
+				objectAspect = &(_objectAspects209[aspectIndex]);
 				AL_4_nativeBitmapIndex = kDMGraphicIdxFirstObject + objectAspect->_firstNativeBitmapRelativeIndex;
 				useAlcoveObjectImage = (L0135_B_DrawAlcoveObjects && getFlag(objectAspect->_graphicInfo, k0x0010_ObjectAlcoveMask) && (viewLane == kDMViewLaneCenter));
 				if (useAlcoveObjectImage)


Commit: fa2245a23cb184d352927e58f2a5812720dba5d3
    https://github.com/scummvm/scummvm/commit/fa2245a23cb184d352927e58f2a5812720dba5d3
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-22T00:11:59+02:00

Commit Message:
DM: Change ActiveGroup::_directions type to uint16 to prevent undefined behavior

Prevent undefined behavior when storing packed creature direction values

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


diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp
index b6d50a144e1..eb649333f29 100644
--- a/engines/dm/dungeonman.cpp
+++ b/engines/dm/dungeonman.cpp
@@ -1553,7 +1553,7 @@ void DungeonMan::setGroupCells(Group *group, uint16 cells, uint16 mapIndex) {
 
 void DungeonMan::setGroupDirections(Group *group, int16 dir, uint16 mapIndex) {
 	if (mapIndex == _partyMapIndex)
-		_vm->_groupMan->_activeGroups[group->getActiveGroupIndex()]._directions = (Direction)dir;
+		_vm->_groupMan->_activeGroups[group->getActiveGroupIndex()]._directions = dir;
 	else
 		group->setDir(_vm->normalizeModulo4(dir));
 }
diff --git a/engines/dm/group.cpp b/engines/dm/group.cpp
index c6180060ba6..ac0032e314c 100644
--- a/engines/dm/group.cpp
+++ b/engines/dm/group.cpp
@@ -1384,7 +1384,7 @@ void GroupMan::setGroupDirection(ActiveGroup *activeGroup, int16 dir, int16 crea
 		G0396_ps_TwoHalfSquareSizedCreaturesGroupLastDirectionSetActiveGroup = activeGroup;
 	}
 
-	activeGroup->_directions = (Direction)groupDirections;
+	activeGroup->_directions = groupDirections;
 }
 
 void GroupMan::addGroupEvent(TimelineEvent *event, uint32 time) {
@@ -1752,7 +1752,7 @@ void GroupMan::addActiveGroup(Thing thing, int16 mapX, int16 mapY) {
 	activeGroup->_lastMoveTime = _vm->_gameTime - 127;
 	uint16 creatureIndex = curGroup->getCount();
 	do {
-		activeGroup->_directions = (Direction)getGroupValueUpdatedWithCreatureValue(activeGroup->_directions, creatureIndex, curGroup->getDir());
+		activeGroup->_directions = getGroupValueUpdatedWithCreatureValue(activeGroup->_directions, creatureIndex, curGroup->getDir());
 		activeGroup->_aspect[creatureIndex] = 0;
 	} while (creatureIndex--);
 	getCreatureAspectUpdateTime(activeGroup, kDMWholeCreatureGroup, false);
@@ -2118,7 +2118,7 @@ void GroupMan::loadActiveGroupPart(Common::InSaveFile *file) {
 	for (uint16 i = 0; i < _maxActiveGroupCount; ++i) {
 		ActiveGroup *group = &_activeGroups[i];
 		group->_groupThingIndex = file->readUint16BE();
-		group->_directions = (Direction)file->readUint16BE();
+		group->_directions = file->readUint16BE();
 		group->_cells = file->readByte();
 		group->_lastMoveTime = file->readByte();
 		group->_delayFleeingFromTarget = file->readByte();
diff --git a/engines/dm/group.h b/engines/dm/group.h
index 3af34b631b2..468debec04e 100644
--- a/engines/dm/group.h
+++ b/engines/dm/group.h
@@ -111,7 +111,7 @@ enum aspectMask {
 class ActiveGroup {
 public:
 	int16 _groupThingIndex;
-	Direction _directions;
+	uint16 _directions;
 	byte _cells;
 	byte _lastMoveTime;
 	byte _delayFleeingFromTarget;


Commit: 5b306e97c763d453e6eb27e30120fc14486d24bb
    https://github.com/scummvm/scummvm/commit/5b306e97c763d453e6eb27e30120fc14486d24bb
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-22T00:11:59+02:00

Commit Message:
DM: Fix infinite loop freeze in dropCreatureFixedPossessions

Advance the fixedPossessions pointer when skipping random drops or when no unused items are available. This fixes a game freeze when throwing explosives at creature groups.

Changed paths:
    engines/dm/group.cpp


diff --git a/engines/dm/group.cpp b/engines/dm/group.cpp
index ac0032e314c..9b65c5c8a02 100644
--- a/engines/dm/group.cpp
+++ b/engines/dm/group.cpp
@@ -271,8 +271,10 @@ void GroupMan::dropCreatureFixedPossessions(CreatureType creatureType, int16 map
 	uint16 currFixedPossession = *fixedPossessions++;
 	bool weaponDropped = false;
 	while (currFixedPossession) {
-		if (getFlag(currFixedPossession, kDMMaskRandomDrop) && _vm->getRandomNumber(2))
+		if (getFlag(currFixedPossession, kDMMaskRandomDrop) && _vm->getRandomNumber(2)) {
+			currFixedPossession = *fixedPossessions++;
 			continue;
+		}
 
 		int16 currThingType;
 		if (clearFlag(currFixedPossession, kDMMaskRandomDrop) >= kDMObjectInfoIndexFirstJunk) {
@@ -288,8 +290,10 @@ void GroupMan::dropCreatureFixedPossessions(CreatureType creatureType, int16 map
 		}
 
 		Thing nextUnusedThing = dungeon.getUnusedThing(currThingType);
-		if ((nextUnusedThing) == _vm->_thingNone)
+		if ((nextUnusedThing) == _vm->_thingNone) {
+			currFixedPossession = *fixedPossessions++;
 			continue;
+		}
 
 		Weapon *currWeapon = (Weapon *)dungeon.getThingData(nextUnusedThing);
 		/* The same pointer type is used no matter the actual type k5_WeaponThingType, k6_ArmourThingType or k10_JunkThingType */


Commit: 98c9b23e673706040b9c773fe73e5cfe9ee2dcdf
    https://github.com/scummvm/scummvm/commit/98c9b23e673706040b9c773fe73e5cfe9ee2dcdf
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-06-22T00:11:59+02:00

Commit Message:
DM: Fix crash when throwing projectiles by correcting cache index offsets

Changed paths:
    engines/dm/gfx.cpp


diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp
index 3da5c63fbdf..5a9b0187e0d 100644
--- a/engines/dm/gfx.cpp
+++ b/engines/dm/gfx.cpp
@@ -752,13 +752,13 @@ void DisplayMan::initializeGraphicData() {
 
 			for (int16 projectileScaleIndex = 0; projectileScaleIndex < 6; projectileScaleIndex++) {
 				int16 bitmapByteCount = getScaledBitmapByteCount(projectileAspect->_byteWidth, projectileAspect->_height, _projectileScales[projectileScaleIndex]);
-				_derivedBitmapByteCount[derivedBitmapIndex] = bitmapByteCount;
+				_derivedBitmapByteCount[derivedBitmapIndex + projectileScaleIndex] = bitmapByteCount;
 
 				if (getFlag(projectileAspect->_graphicInfo, k0x0003_ProjectileAspectTypeMask) != k3_ProjectileAspectHasNone) {
-					_derivedBitmapByteCount[derivedBitmapIndex + 6] = bitmapByteCount;
+					_derivedBitmapByteCount[derivedBitmapIndex + 6 + projectileScaleIndex] = bitmapByteCount;
 
 					if (getFlag(projectileAspect->_graphicInfo, k0x0003_ProjectileAspectTypeMask) != k2_ProjectileAspectHasRotation)
-						_derivedBitmapByteCount[derivedBitmapIndex + 12] = bitmapByteCount;
+						_derivedBitmapByteCount[derivedBitmapIndex + 12 + projectileScaleIndex] = bitmapByteCount;
 				}
 			}
 		}




More information about the Scummvm-git-logs mailing list