[Scummvm-git-logs] scummvm master -> 0b0d0e01e0a61ed453232998aa5ad137afccd935
mgerhardy
noreply at scummvm.org
Thu Jul 16 07:41:27 UTC 2026
This automated email contains information about 11 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
dcdbd32710 MACS2: removed duplicated lookup tables
a9100ae6e7 MACS2: fixed superflous checks, PVS-Studio V560
4b7180add4 MACS2: missing error check
eb6edc5cb2 MACS2: fixed xpression 'len > 20' is always false, PVS-Studio V547
57d2e961ed MACS2: fixed duplicated switch/case code, PVS-Studio V1037
c913ccd068 MACS2: removed superfluous check, PVS-Studio V547
51e17c3561 MACS2: removed dead code - walkspeed is always at least 1, PVS-Studio V560
a15935d82c MACS2: simplified check, PVS-Studio V590
694a553327 MACS2: the pTargetX variable was assigned the same value, PVS-Studio V1048
a7045abccd MACS2: targetblob can't be null, PVS-Studio V547
0b0d0e01e0 MACS2: fixed warning part of conditional expression is always true, PVS-Studio V560
Commit: dcdbd32710ca1e277083427c638c3a8f456618fe
https://github.com/scummvm/scummvm/commit/dcdbd32710ca1e277083427c638c3a8f456618fe
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2026-07-16T09:40:51+02:00
Commit Message:
MACS2: removed duplicated lookup tables
Changed paths:
engines/macs2/view1.cpp
diff --git a/engines/macs2/view1.cpp b/engines/macs2/view1.cpp
index e287a4bcb4a..3870a1d47af 100644
--- a/engines/macs2/view1.cpp
+++ b/engines/macs2/view1.cpp
@@ -40,6 +40,10 @@ namespace Macs2 {
namespace {
constexpr int kNumLoadedCursors = 33;
+// Button lookup table at data segment offset 0x26, 1-indexed
+// Binary: local_4 = 1..7, each iteration reads *(local_4 * 2 + 0x26) as index into cursor array
+const uint16 kLookupTable[8] = {9, 15, 14, 27, 29, 16, 17, 9}; // index 0 unused
+
// drawAllCharacters (1008:90a2) local_14: animation slot for current orientation.
uint16 resolveAnimSlotIndex(const GameObject *obj) {
if ((int16)obj->_overloadAnimTriggerDirection < 0 ||
@@ -4098,10 +4102,6 @@ void View1::openOriginalSaveLoadPanel() {
g_engine->getAdlib()->stopMusic();
}
- // Button lookup table at data segment offset 0x26, 1-indexed
- // Binary: local_4 = 1..7, each iteration reads *(local_4 * 2 + 0x26) as index into cursor array
- static const uint16 kLookupTable[8] = {9, 15, 14, 27, 29, 16, 17, 9}; // index 0 unused
-
// First loop: calculate max icon width/height from the 7 button images
for (int i = 1; i <= 7; i++) {
int imgIdx = kLookupTable[i] - 1; // convert to 0-based
@@ -4195,9 +4195,6 @@ void View1::drawOriginalSaveLoadPanel(Graphics::ManagedSurface &s) {
drawBorderSide(Common::Point(panelX, panelY), Common::Point(panelW, _saveLoadPanelRect.height()), s);
drawNinePatchBorder(Common::Point(panelX, panelY), Common::Point(panelW, _saveLoadPanelRect.height()), kBorderRaised, false, false, s);
- // Button loop: local_4 = 1..7
- // Lookup table at 0x26 (1-indexed): {_, 15, 14, 27, 29, 16, 17, 9}
- static const uint16 kLookupTable[8] = {9, 15, 14, 27, 29, 16, 17, 9};
// Alternate music icon is at cursor array offset 0x1B0 = entry 27 (0-based)
static const int kAltMusicIconIdx = 27; // 0-based into _imageResources
@@ -4344,8 +4341,6 @@ void View1::handleOriginalSaveLoadClick(const Common::Point &pos) {
}
}
- // Button loop: local_4 = 1..7
- static const uint16 kLookupTable[8] = {9, 15, 14, 27, 29, 16, 17, 9};
for (int i = 1; i <= 7; i++) {
int imgIdx = kLookupTable[i] - 1; // 0-based
Common::Point btnPos(_saveLoadButtonRects[i - 1].left, _saveLoadButtonRects[i - 1].top);
Commit: a9100ae6e7d878d90ee53c5d4f062f73ea046ce4
https://github.com/scummvm/scummvm/commit/a9100ae6e7d878d90ee53c5d4f062f73ea046ce4
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2026-07-16T09:40:51+02:00
Commit Message:
MACS2: fixed superflous checks, PVS-Studio V560
Changed paths:
engines/macs2/debugtools.cpp
engines/macs2/saveload.cpp
engines/macs2/scriptexecutor.cpp
engines/macs2/view1.cpp
diff --git a/engines/macs2/debugtools.cpp b/engines/macs2/debugtools.cpp
index 1854cdd4681..b29b643dcf3 100644
--- a/engines/macs2/debugtools.cpp
+++ b/engines/macs2/debugtools.cpp
@@ -575,7 +575,7 @@ static Common::String decodeParams(Common::MemoryReadStream *script, uint8 opcod
case 0x4E:
break;
default:
- if (length > 0 && length <= 30) {
+ if (length <= 30) {
result = " [";
for (uint8 i = 0; i < length && script->pos() < script->size(); i++) {
if (i)
@@ -951,7 +951,7 @@ static void showVariablesWindow() {
int firstLineY = view->_stringBoxPosition.y + 9;
int relY = mousePos.y - firstLineY;
int hoveredChoice = -1;
- if (relY >= 0 && lineHeight > 0) {
+ if (relY >= 0) {
int hoveredLine = relY / lineHeight;
int cumulativeLines = 0;
for (uint i = 0; i < view->_dialogueChoiceLineCounts.size(); i++) {
diff --git a/engines/macs2/saveload.cpp b/engines/macs2/saveload.cpp
index b7c52640911..ce1f04c81de 100644
--- a/engines/macs2/saveload.cpp
+++ b/engines/macs2/saveload.cpp
@@ -204,9 +204,9 @@ Common::Error Macs2Engine::syncGame(Common::Serializer &s) {
}
// g_wSavedCursorMode [0xfea]: 2 bytes
- uint16 savedCursorMode = view1 ? (uint16)view1->_savedCursorMode : (uint16)Script::MouseMode::Walk;
+ uint16 savedCursorMode = (uint16)view1->_savedCursorMode;
s.syncAsUint16LE(savedCursorMode);
- if (s.isLoading() && view1)
+ if (s.isLoading())
view1->_savedCursorMode = (Script::MouseMode)savedCursorMode;
// g_wClipRectDirty [0xfec]: 1 byte - flags clip region needs full-screen reset
diff --git a/engines/macs2/scriptexecutor.cpp b/engines/macs2/scriptexecutor.cpp
index 6245eebb1d2..793930b1fa2 100644
--- a/engines/macs2/scriptexecutor.cpp
+++ b/engines/macs2/scriptexecutor.cpp
@@ -727,7 +727,7 @@ uint16 Script::ScriptExecutor::readUint16() {
void Script::ScriptExecutor::scriptSetVar() {
// This writes to a script variable.
- readByte();
+ (void)readByte();
uint16 variableIndex = readUint16();
ScriptVariable var;
scriptReadValuePair(var.a, var.b);
@@ -737,7 +737,7 @@ void Script::ScriptExecutor::scriptSetVar() {
void Script::ScriptExecutor::scriptSetVarOr() {
// Padding/type byte (same as opcode 0x01) - read and discarded
- readByte();
+ (void)readByte();
uint16 variableIndex = readUint16();
// We skip the left shift and just read the first value directly
uint16 throwaway;
@@ -1885,9 +1885,8 @@ void Script::ScriptExecutor::scriptSetYOffset() {
}
object->_verticalOffsetScale = offset;
- Character *c = getOrCreateCharacter((uint16)objectID);
- if (c != nullptr) {
- c->_motionTargetVerticalOffset = offset;
+ if (Character *character = getOrCreateCharacter((uint16)objectID)) {
+ character->_motionTargetVerticalOffset = offset;
}
object->_storedWalkRuntime.valid = true;
object->_storedWalkRuntime.motionTargetVerticalOffset = offset;
diff --git a/engines/macs2/view1.cpp b/engines/macs2/view1.cpp
index 3870a1d47af..9d9226a905e 100644
--- a/engines/macs2/view1.cpp
+++ b/engines/macs2/view1.cpp
@@ -946,8 +946,8 @@ bool View1::handleDialogueChoiceClick(int clickY, int clickX) {
int firstLineY = _stringBoxPosition.y + 9;
int relY = clickY - firstLineY;
debug("handleDialogueChoiceClick: clickY=%d firstLineY=%d relY=%d lineHeight=%d clickedLine=%d",
- clickY, firstLineY, relY, (relY >= 0 && lineHeight > 0) ? relY / lineHeight : -1, lineHeight);
- if (relY >= 0 && lineHeight > 0) {
+ clickY, firstLineY, relY, lineHeight, relY >= 0 ? relY / lineHeight : -1);
+ if (relY >= 0) {
int clickedLine = relY / lineHeight;
int cumulativeLines = 0;
for (uint i = 0; i < _dialogueChoiceLineCounts.size(); i++) {
@@ -2094,7 +2094,7 @@ bool View1::msgKeypress(const KeypressMessage &msg) {
// Select a visible dialogue option by number key.
// Register a dialogue choice and act upon it
uint8 numberPressed = msg.ascii - '1' + 1;
- if (numberPressed >= 1 && numberPressed <= _dialogueChoiceCount && _isDialogueChoiceInputActive) {
+ if (numberPressed <= _dialogueChoiceCount && _isDialogueChoiceInputActive) {
handleTextBoxInput();
dismissDialoguePanel();
_isDialogueChoiceInputActive = false;
@@ -2125,9 +2125,7 @@ void View1::draw() {
// Handle highlighting
- if (_currentMode != ViewMode::VM_HELP) {
- drawAllCharacters(&s, true);
- }
+ drawAllCharacters(&s, true);
drawOverlayTextEntries();
if (shouldDrawPathfindingOverlay()) {
drawPathfindingPoints(s);
@@ -2148,7 +2146,7 @@ void View1::draw() {
int lineHeight = g_engine->maxGlyphHeight + 2;
int firstLineY = _stringBoxPosition.y + 9;
int relY = mousePos.y - firstLineY;
- if (relY >= 0 && lineHeight > 0) {
+ if (relY >= 0) {
int hoveredLine = relY / lineHeight;
int cumulativeLines = 0;
for (uint i = 0; i < _dialogueChoiceLineCounts.size(); i++) {
@@ -4105,7 +4103,7 @@ void View1::openOriginalSaveLoadPanel() {
// First loop: calculate max icon width/height from the 7 button images
for (int i = 1; i <= 7; i++) {
int imgIdx = kLookupTable[i] - 1; // convert to 0-based
- if (imgIdx < 0 || imgIdx >= (int)g_engine->_imageResources.size())
+ if (imgIdx >= (int)g_engine->_imageResources.size())
continue;
AnimFrame &frame = g_engine->_imageResources[imgIdx];
if (frame._data.empty() && frame._width == 0) {
@@ -4206,11 +4204,11 @@ void View1::drawOriginalSaveLoadPanel(Graphics::ManagedSurface &s) {
// Binary: if (local_4 < 0 || local_4 != g_wSaveLoadSubMode) -> normal border
// else -> pressed border
- const bool pressed = (i >= 0 && (uint16)i == subMode);
+ const bool pressed = ((uint16)i == subMode);
drawNinePatchBorder(btnPos, Common::Point(btnW, btnH), pressed ? kBorderPressed : kBorderRaised, false, false, s);
// Check if image has valid data (binary: check size fields > 0)
- if (imgIdx < 0 || imgIdx >= (int)g_engine->_imageResources.size()) {
+ if (imgIdx >= (int)g_engine->_imageResources.size()) {
continue;
}
AnimFrame &frame = g_engine->_imageResources[imgIdx];
@@ -4350,7 +4348,7 @@ void View1::handleOriginalSaveLoadClick(const Common::Point &pos) {
// AND has valid image data
// AND (mapDisabledFlag == 0 || i > 2)
bool hasData = false;
- if (imgIdx >= 0 && imgIdx < (int)g_engine->_imageResources.size()) {
+ if (imgIdx < (int)g_engine->_imageResources.size()) {
AnimFrame &frame = g_engine->_imageResources[imgIdx];
hasData = (!frame._data.empty() && frame._width > 0);
}
Commit: 4b7180add4afb66959f62eb0fb7652b4677daccd
https://github.com/scummvm/scummvm/commit/4b7180add4afb66959f62eb0fb7652b4677daccd
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2026-07-16T09:40:51+02:00
Commit Message:
MACS2: missing error check
Changed paths:
engines/macs2/saveload.cpp
diff --git a/engines/macs2/saveload.cpp b/engines/macs2/saveload.cpp
index ce1f04c81de..698a1df01ca 100644
--- a/engines/macs2/saveload.cpp
+++ b/engines/macs2/saveload.cpp
@@ -32,6 +32,8 @@ namespace Macs2 {
Common::Error Macs2Engine::syncGame(Common::Serializer &s) {
const byte SAVE_MAGIC[12] = {'A', 'H', 'F', 'F', 'M', 'S', 'G', 'M', '0', '1', '0', '0'};
View1 *view1 = (View1 *)findView("View1");
+ if (view1 == nullptr)
+ return Common::kUnknownError;
// --- Header: 12-byte magic ---
if (s.isSaving()) {
Commit: eb6edc5cb2d4b245f5bb82d51e83231e1f1e376f
https://github.com/scummvm/scummvm/commit/eb6edc5cb2d4b245f5bb82d51e83231e1f1e376f
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2026-07-16T09:40:51+02:00
Commit Message:
MACS2: fixed xpression 'len > 20' is always false, PVS-Studio V547
Changed paths:
engines/macs2/saveload.cpp
diff --git a/engines/macs2/saveload.cpp b/engines/macs2/saveload.cpp
index 698a1df01ca..e18e0af4fe9 100644
--- a/engines/macs2/saveload.cpp
+++ b/engines/macs2/saveload.cpp
@@ -54,12 +54,9 @@ Common::Error Macs2Engine::syncGame(Common::Serializer &s) {
// name when producing an original-format save.
byte slotName[21] = {0};
if (s.isSaving()) {
- const char *defName = "SCUMMVM";
- uint8 len = (uint8)strlen(defName);
- if (len > 20)
- len = 20;
- slotName[0] = len;
- memcpy(slotName + 1, defName, len);
+ const char defName[] = {'S', 'C', 'U', 'M', 'M', 'V', 'M'};
+ slotName[0] = 20;
+ memcpy(slotName + 1, defName, sizeof(defName));
}
s.syncBytes(slotName, 21);
Commit: 57d2e961ed57c6e3b62582816609e62cb8b0f84d
https://github.com/scummvm/scummvm/commit/57d2e961ed57c6e3b62582816609e62cb8b0f84d
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2026-07-16T09:40:51+02:00
Commit Message:
MACS2: fixed duplicated switch/case code, PVS-Studio V1037
Changed paths:
engines/macs2/view1.cpp
diff --git a/engines/macs2/view1.cpp b/engines/macs2/view1.cpp
index 9d9226a905e..28449a73da2 100644
--- a/engines/macs2/view1.cpp
+++ b/engines/macs2/view1.cpp
@@ -1893,8 +1893,6 @@ bool View1::handlePanelRelease(const MouseUpMessage &msg) {
shouldClose = true;
break;
case kUiPanelInventory:
- shouldClose = (_clickedButtonIndex == 6);
- break;
case kUiPanelContainerInventory:
shouldClose = (_clickedButtonIndex == 6);
break;
Commit: c913ccd068616a079279f23ca4b00ebe3fa49930
https://github.com/scummvm/scummvm/commit/c913ccd068616a079279f23ca4b00ebe3fa49930
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2026-07-16T09:40:51+02:00
Commit Message:
MACS2: removed superfluous check, PVS-Studio V547
Changed paths:
engines/macs2/view1.cpp
diff --git a/engines/macs2/view1.cpp b/engines/macs2/view1.cpp
index 28449a73da2..f495d9e63f7 100644
--- a/engines/macs2/view1.cpp
+++ b/engines/macs2/view1.cpp
@@ -3939,99 +3939,97 @@ void Character::update() {
// After loop: if pixelsMoved != walkSpeed -> revert pos to savedPos and cancel path.
int pixelsMoved = 0;
Common::Point savedPos = pos;
- if (walkSpeed > 0) {
- for (int stepCounter = 1; stepCounter <= walkSpeed; stepCounter++) {
- savedPos = pos; // Binary: savedX/savedY at top of each iteration
- // Bresenham: if error >= deltaX -> step Y, else step X
- if (_stepError >= _stepDeltaX) {
- // Step Y axis
- if (_targetPosition.y != pos.y)
- pixelsMoved++;
- if (_targetPosition.y < pos.y)
- pos.y--;
- else if (_targetPosition.y > pos.y)
- pos.y++;
- _stepError -= _stepDeltaX;
- } else {
- // Step X axis
- if (_targetPosition.x != pos.x)
- pixelsMoved++;
- if (_targetPosition.x < pos.x)
- pos.x--;
- else if (_targetPosition.x > pos.x)
- pos.x++;
- _stepError += _stepDeltaY;
+ for (int stepCounter = 1; stepCounter <= walkSpeed; stepCounter++) {
+ savedPos = pos; // Binary: savedX/savedY at top of each iteration
+ // Bresenham: if error >= deltaX -> step Y, else step X
+ if (_stepError >= _stepDeltaX) {
+ // Step Y axis
+ if (_targetPosition.y != pos.y)
+ pixelsMoved++;
+ if (_targetPosition.y < pos.y)
+ pos.y--;
+ else if (_targetPosition.y > pos.y)
+ pos.y++;
+ _stepError -= _stepDeltaX;
+ } else {
+ // Step X axis
+ if (_targetPosition.x != pos.x)
+ pixelsMoved++;
+ if (_targetPosition.x < pos.x)
+ pos.x--;
+ else if (_targetPosition.x > pos.x)
+ pos.x++;
+ _stepError += _stepDeltaY;
+ }
+ // Vertical offset interpolation
+ if (shouldStepVerticalMotion()) {
+ _motionProgress += _motionVerticalOffsetDelta;
+ while (_motionProgress >= _motionDistanceUnits && _motionDistanceUnits > 0) {
+ _motionProgress -= _motionDistanceUnits;
+ if (_motionTargetVerticalOffset < _gameObject->_verticalOffsetScale)
+ _gameObject->_verticalOffsetScale--;
+ else if (_motionTargetVerticalOffset > _gameObject->_verticalOffsetScale)
+ _gameObject->_verticalOffsetScale++;
}
- // Vertical offset interpolation
- if (shouldStepVerticalMotion()) {
- _motionProgress += _motionVerticalOffsetDelta;
- while (_motionProgress >= _motionDistanceUnits && _motionDistanceUnits > 0) {
- _motionProgress -= _motionDistanceUnits;
- if (_motionTargetVerticalOffset < _gameObject->_verticalOffsetScale)
- _gameObject->_verticalOffsetScale--;
- else if (_motionTargetVerticalOffset > _gameObject->_verticalOffsetScale)
- _gameObject->_verticalOffsetScale++;
- }
+ }
+ // Walkability check - binary uses getWalkabilityAt(posY, posX) >= 0xC8
+ if (!isWalkable(pos)) {
+ const uint16 tileArea = g_engine->_scriptExecutor->getAreaAtPoint(pos.x, pos.y);
+ if (tileArea >= 210 && tileArea <= 215) {
+ debugC(kDebugPath,
+ "walk blocked on plate area %u at (%d,%d) walk=%u int16=%d target=(%d,%d)",
+ tileArea, pos.x, pos.y, lookupWalkability(pos), (int16)lookupWalkability(pos),
+ _targetPosition.x, _targetPosition.y);
}
- // Walkability check - binary uses getWalkabilityAt(posY, posX) >= 0xC8
- if (!isWalkable(pos)) {
- const uint16 tileArea = g_engine->_scriptExecutor->getAreaAtPoint(pos.x, pos.y);
- if (tileArea >= 210 && tileArea <= 215) {
- debugC(kDebugPath,
- "walk blocked on plate area %u at (%d,%d) walk=%u int16=%d target=(%d,%d)",
- tileArea, pos.x, pos.y, lookupWalkability(pos), (int16)lookupWalkability(pos),
- _targetPosition.x, _targetPosition.y);
+ // Revert position
+ pos = savedPos;
+ // Wall-sliding: build push vector from ±1 and ±2 samples
+ int pushX = 0, pushY = 0;
+ if (Macs2Engine::isWalkabilityBlocking(lookupWalkability(Common::Point(pos.x + 1, pos.y))))
+ pushX--;
+ if (Macs2Engine::isWalkabilityBlocking(lookupWalkability(Common::Point(pos.x - 1, pos.y))))
+ pushX++;
+ if (Macs2Engine::isWalkabilityBlocking(lookupWalkability(Common::Point(pos.x, pos.y + 1))))
+ pushY--;
+ if (Macs2Engine::isWalkabilityBlocking(lookupWalkability(Common::Point(pos.x, pos.y - 1))))
+ pushY++;
+ if (Macs2Engine::isWalkabilityBlocking(lookupWalkability(Common::Point(pos.x + 2, pos.y))))
+ pushX--;
+ if (Macs2Engine::isWalkabilityBlocking(lookupWalkability(Common::Point(pos.x - 2, pos.y))))
+ pushX++;
+ if (Macs2Engine::isWalkabilityBlocking(lookupWalkability(Common::Point(pos.x, pos.y + 2))))
+ pushY--;
+ if (Macs2Engine::isWalkabilityBlocking(lookupWalkability(Common::Point(pos.x, pos.y - 2))))
+ pushY++;
+ // Apply push vector
+ while (pushX != 0 || pushY != 0) {
+ if (pushX < 0) {
+ if (Macs2Engine::isWalkabilityWalkable(lookupWalkability(Common::Point(pos.x - 1, pos.y))))
+ pos.x--;
+ pushX++;
}
- // Revert position
- pos = savedPos;
- // Wall-sliding: build push vector from ±1 and ±2 samples
- int pushX = 0, pushY = 0;
- if (Macs2Engine::isWalkabilityBlocking(lookupWalkability(Common::Point(pos.x + 1, pos.y))))
+ if (pushX > 0) {
+ if (Macs2Engine::isWalkabilityWalkable(lookupWalkability(Common::Point(pos.x + 1, pos.y))))
+ pos.x++;
pushX--;
- if (Macs2Engine::isWalkabilityBlocking(lookupWalkability(Common::Point(pos.x - 1, pos.y))))
- pushX++;
- if (Macs2Engine::isWalkabilityBlocking(lookupWalkability(Common::Point(pos.x, pos.y + 1))))
- pushY--;
- if (Macs2Engine::isWalkabilityBlocking(lookupWalkability(Common::Point(pos.x, pos.y - 1))))
+ }
+ if (pushY < 0) {
+ if (Macs2Engine::isWalkabilityWalkable(lookupWalkability(Common::Point(pos.x, pos.y - 1))))
+ pos.y--;
pushY++;
- if (Macs2Engine::isWalkabilityBlocking(lookupWalkability(Common::Point(pos.x + 2, pos.y))))
- pushX--;
- if (Macs2Engine::isWalkabilityBlocking(lookupWalkability(Common::Point(pos.x - 2, pos.y))))
- pushX++;
- if (Macs2Engine::isWalkabilityBlocking(lookupWalkability(Common::Point(pos.x, pos.y + 2))))
+ }
+ if (pushY > 0) {
+ if (Macs2Engine::isWalkabilityWalkable(lookupWalkability(Common::Point(pos.x, pos.y + 1))))
+ pos.y++;
pushY--;
- if (Macs2Engine::isWalkabilityBlocking(lookupWalkability(Common::Point(pos.x, pos.y - 2))))
- pushY++;
- // Apply push vector
- while (pushX != 0 || pushY != 0) {
- if (pushX < 0) {
- if (Macs2Engine::isWalkabilityWalkable(lookupWalkability(Common::Point(pos.x - 1, pos.y))))
- pos.x--;
- pushX++;
- }
- if (pushX > 0) {
- if (Macs2Engine::isWalkabilityWalkable(lookupWalkability(Common::Point(pos.x + 1, pos.y))))
- pos.x++;
- pushX--;
- }
- if (pushY < 0) {
- if (Macs2Engine::isWalkabilityWalkable(lookupWalkability(Common::Point(pos.x, pos.y - 1))))
- pos.y--;
- pushY++;
- }
- if (pushY > 0) {
- if (Macs2Engine::isWalkabilityWalkable(lookupWalkability(Common::Point(pos.x, pos.y + 1))))
- pos.y++;
- pushY--;
- }
}
- // Binary: target = finalDest = pos (cancel path, but loop continues)
- _targetPosition = pos;
- _pathFinalDestination = pos;
- _path.clear();
}
- // Binary: loop continues unconditionally until stepCounter == walkSpeed
+ // Binary: target = finalDest = pos (cancel path, but loop continues)
+ _targetPosition = pos;
+ _pathFinalDestination = pos;
+ _path.clear();
}
+ // Binary: loop continues unconditionally until stepCounter == walkSpeed
}
// Binary (2280): if pixelsMoved != walkSpeed -> revert and cancel
Commit: 51e17c35614e623092f7b34cc08a52c24c383612
https://github.com/scummvm/scummvm/commit/51e17c35614e623092f7b34cc08a52c24c383612
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2026-07-16T09:40:51+02:00
Commit Message:
MACS2: removed dead code - walkspeed is always at least 1, PVS-Studio V560
Changed paths:
engines/macs2/view1.cpp
diff --git a/engines/macs2/view1.cpp b/engines/macs2/view1.cpp
index f495d9e63f7..b55127f1bdd 100644
--- a/engines/macs2/view1.cpp
+++ b/engines/macs2/view1.cpp
@@ -4051,19 +4051,6 @@ void Character::update() {
_path.clear();
}
- // Binary: walkSpeed==0 special case - still run vertical offset once
- if (walkSpeed == 0 && shouldStepVerticalMotion()) {
- _motionProgress += _motionVerticalOffsetDelta;
- while (_motionProgress >= _motionDistanceUnits && _motionDistanceUnits > 0) {
- _motionProgress -= _motionDistanceUnits;
- if (_motionTargetVerticalOffset < _gameObject->_verticalOffsetScale) {
- _gameObject->_verticalOffsetScale--;
- } else if (_motionTargetVerticalOffset > _gameObject->_verticalOffsetScale) {
- _gameObject->_verticalOffsetScale++;
- }
- }
- }
-
setPosition(pos);
}
Commit: a15935d82cb27c941409639095e0b4bd20664ca9
https://github.com/scummvm/scummvm/commit/a15935d82cb27c941409639095e0b4bd20664ca9
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2026-07-16T09:40:51+02:00
Commit Message:
MACS2: simplified check, PVS-Studio V590
Changed paths:
engines/macs2/scriptexecutor.cpp
diff --git a/engines/macs2/scriptexecutor.cpp b/engines/macs2/scriptexecutor.cpp
index 793930b1fa2..5bf1bdb65f9 100644
--- a/engines/macs2/scriptexecutor.cpp
+++ b/engines/macs2/scriptexecutor.cpp
@@ -1240,8 +1240,7 @@ ExecutionResult Script::ScriptExecutor::scriptShowDialogue() {
return ExecutionResult::ScriptFinished;
}
// Binary: bSlotLoaded for portrait slots 0x12 and 0x13 (runtime+0x153, +0x163).
- if (speaker->_blobs.size() <= 17 || speaker->_blobs[17].empty() ||
- speaker->_blobs.size() <= 18 || speaker->_blobs[18].empty()) {
+ if (speaker->_blobs.size() < 19 || speaker->_blobs[17].empty() || speaker->_blobs[18].empty()) {
setScriptError(6);
endBuffering(_lastOpcodeTriggeredSkip);
return ExecutionResult::ScriptFinished;
Commit: 694a5533275bb75f22db763a52a57796219c81d9
https://github.com/scummvm/scummvm/commit/694a5533275bb75f22db763a52a57796219c81d9
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2026-07-16T09:40:51+02:00
Commit Message:
MACS2: the pTargetX variable was assigned the same value, PVS-Studio V1048
Changed paths:
engines/macs2/macs2.cpp
diff --git a/engines/macs2/macs2.cpp b/engines/macs2/macs2.cpp
index 39c187b1348..1e1f84b1dba 100644
--- a/engines/macs2/macs2.cpp
+++ b/engines/macs2/macs2.cpp
@@ -845,7 +845,6 @@ void Macs2Engine::snapToWalkablePosition(int16 *pTargetY, int16 *pTargetX, int16
// Phase 4: If still non-walkable, scan X toward character
uint16 w = getWalkabilityAt(*pTargetY, *pTargetX);
if (isWalkabilityBlocking(w)) {
- *pTargetX = savedX;
*pTargetY = savedY;
if (charX < *pTargetX) {
while (true) {
Commit: a7045abccde8129408e877308786a521882746d9
https://github.com/scummvm/scummvm/commit/a7045abccde8129408e877308786a521882746d9
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2026-07-16T09:40:52+02:00
Commit Message:
MACS2: targetblob can't be null, PVS-Studio V547
Changed paths:
engines/macs2/macs2.cpp
diff --git a/engines/macs2/macs2.cpp b/engines/macs2/macs2.cpp
index 1e1f84b1dba..054d338c4f9 100644
--- a/engines/macs2/macs2.cpp
+++ b/engines/macs2/macs2.cpp
@@ -1768,11 +1768,6 @@ bool Macs2Engine::loadAnimationFromSceneData(uint16 objectIndex, uint16 slotInde
go->_blobMirrorFlags[slotIndex - 1] = shouldMirror;
}
- if (targetBlob == nullptr) {
- _scriptExecutor->setScriptError(1);
- return false;
- }
-
// Binary: memFree old blob if bSlotLoaded, then alloc + read; sets slot+0x33 = 1.
*targetBlob = data;
if (slotIndex == 0x15)
Commit: 0b0d0e01e0a61ed453232998aa5ad137afccd935
https://github.com/scummvm/scummvm/commit/0b0d0e01e0a61ed453232998aa5ad137afccd935
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2026-07-16T09:40:52+02:00
Commit Message:
MACS2: fixed warning part of conditional expression is always true, PVS-Studio V560
Changed paths:
engines/macs2/view1.cpp
diff --git a/engines/macs2/view1.cpp b/engines/macs2/view1.cpp
index b55127f1bdd..1e1fd25fd44 100644
--- a/engines/macs2/view1.cpp
+++ b/engines/macs2/view1.cpp
@@ -2909,7 +2909,7 @@ void View1::drawSpriteClipped(uint16 x, uint16 y, Common::Rect &clippingRect, ui
if (val != 0) {
const int px = x + currentX;
const int py = y + currentY;
- if (clippingRect.contains(px, py) && px >= 0 && px < s.w && py >= 0 && py < s.h)
+ if (clippingRect.contains(px, py) && px < s.w && py < s.h)
s.setPixel(px, py, val);
}
}
More information about the Scummvm-git-logs
mailing list