[Scummvm-git-logs] scummvm master -> 5154f6257507124b18a0faf5836947bcfa24d70d

bluegr noreply at scummvm.org
Sat Dec 5 15:26:46 UTC 2026


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

Summary:
4b6dadb6d4 PARALLACTION: BR: Refactor view scroll logic
d6475890df PARALLACTION: BR: Fix view scroll to the left
d379e84ffc PARALLACTION: BR: Fix crash on character inventory
f458f16cae PARALLACTION: BR: Fix SET wrapping local vars
8e290523a9 PARALLACTION: BR: Initialize _ferrcycleMode var
feea0dd934 PARALLACTION: BR: Fix function list typo albcycle
9338e6fa92 PARALLACTION: BR: Fix ZETA flags parsing
343cde1a77 PARALLACTION: Pause SFX with the game
1741b5600f PARALLACTION: Fix duplicated floating/cursor label
463647fcc6 PARALLACTION: Fix close game hang
722332104d PARALLACTION: BR: Case insensitive openfile
4546bed157 PARALLACTION: BR: Fix enter/exit trap swap
8ffc08ebb6 PARALLACTION: BR: changeLocation trap reset
4edf1e6085 PARALLACTION: BR: Fix Character load in rooms
b62436fa04 PARALLACTION: BR: Fix follow character
8f7ece7301 PARALLACTION: BR: Fix animations after swap
b0a603cf85 PARALLACTION: BR: Fix location events after swap
0e4b346f66 PARALLACTION: BR: Fix unclickable zones
76c47d0839 PARALLACTION: BR: Fix walk to MOVETO
f4d28ff14f PARALLACTION: BR: Fix SFX channel
4d6acc1d00 PARALLACTION: BR: Refactor changeLocation
953a960582 PARALLACTION: BR: Fix crash on loadPart
6b060a040a PARALLACTION: Fix mini characters handling
c5fc5568c3 PARALLACTION: BR: Implement save game
5154f62575 PARALLACTION: BR: Implement load game


Commit: 4b6dadb6d478ae12120d8b6e81629008a1f16e90
    https://github.com/scummvm/scummvm/commit/4b6dadb6d478ae12120d8b6e81629008a1f16e90
Author: Marketto (marco.ricupero at gmail.com)
Date: 2026-12-05T17:26:25+02:00

Commit Message:
PARALLACTION: BR: Refactor view scroll logic

Magic numbers to consts, readability improvement for further fix

AI assisted changes, human review and comment

Changed paths:
    engines/parallaction/graphics.cpp


diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index a9b146f581e..b037ce1ccbe 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -41,6 +41,10 @@ namespace Parallaction {
 
 #define	LABEL_TRANSPARENT_COLOR 0xFF
 
+// pixels scrolled per step
+static const int kHScrollStepSize = 32;
+static const int kVScrollStepSize = 8;
+
 class HalfbritePrimitives : public Graphics::Primitives {
 public:
 	void drawPoint(int x, int y, uint32 color, void *data) override {
@@ -381,13 +385,15 @@ void Gfx::initiateScroll(int deltaX, int deltaY) {
 	if (deltaX != 0) {
 		_requestedHScrollDir = deltaX > 0 ? 1 : -1;
 		deltaX *= _requestedHScrollDir;
-		_requestedHScrollSteps = ((deltaX+31)/32) / _requestedHScrollDir;
+		_requestedHScrollSteps = ((deltaX + kHScrollStepSize - 1) / kHScrollStepSize) /
+			_requestedHScrollDir;
 	}
 
 	if (deltaY != 0) {
 		_requestedVScrollDir = deltaY > 0 ? 1 : -1;
 		deltaY *= _requestedVScrollDir;
-		_requestedVScrollSteps = ((deltaY+7)/8) / _requestedVScrollDir;
+		_requestedVScrollSteps = ((deltaY + kVScrollStepSize - 1) / kVScrollStepSize) /
+			_requestedVScrollDir;
 	}
 }
 
@@ -395,12 +401,12 @@ void Gfx::scroll() {
 	int32 x = _scrollPosX, y = _scrollPosY;
 
 	if (_requestedHScrollSteps) {
-		x += 32*_requestedHScrollDir;	// scroll 32 pixels at a time
+		x += kHScrollStepSize * _requestedHScrollDir;
 		_requestedHScrollSteps--;
 	}
 
 	if (_requestedVScrollSteps) {
-		y += 8*_requestedVScrollDir;	// scroll 8 pixel at a time
+		y += kVScrollStepSize * _requestedVScrollDir;
 		_requestedVScrollSteps--;
 	}
 


Commit: d6475890df8dda23a3d1f1801a2b3347848826e0
    https://github.com/scummvm/scummvm/commit/d6475890df8dda23a3d1f1801a2b3347848826e0
Author: Marketto (marco.ricupero at gmail.com)
Date: 2026-12-05T17:26:25+02:00

Commit Message:
PARALLACTION: BR: Fix view scroll to the left

Scroll to the left or up follows the character walk, like JScroll_
in the original code, instead of running to the edge of the room:
the step count was divided by the direction, becoming huge as
unsigned.

AI assisted changes, human review and comment

Changed paths:
    engines/parallaction/graphics.cpp


diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index b037ce1ccbe..b75cdbfc271 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -385,15 +385,13 @@ void Gfx::initiateScroll(int deltaX, int deltaY) {
 	if (deltaX != 0) {
 		_requestedHScrollDir = deltaX > 0 ? 1 : -1;
 		deltaX *= _requestedHScrollDir;
-		_requestedHScrollSteps = ((deltaX + kHScrollStepSize - 1) / kHScrollStepSize) /
-			_requestedHScrollDir;
+		_requestedHScrollSteps = (deltaX + kHScrollStepSize - 1) / kHScrollStepSize;
 	}
 
 	if (deltaY != 0) {
 		_requestedVScrollDir = deltaY > 0 ? 1 : -1;
 		deltaY *= _requestedVScrollDir;
-		_requestedVScrollSteps = ((deltaY + kVScrollStepSize - 1) / kVScrollStepSize) /
-			_requestedVScrollDir;
+		_requestedVScrollSteps = (deltaY + kVScrollStepSize - 1) / kVScrollStepSize;
 	}
 }
 


Commit: d379e84ffca8e9d4d9c5db1f809e8585affa5726
    https://github.com/scummvm/scummvm/commit/d379e84ffca8e9d4d9c5db1f809e8585affa5726
Author: Marketto (marco.ricupero at gmail.com)
Date: 2026-12-05T17:26:25+02:00

Commit Message:
PARALLACTION: BR: Fix crash on character inventory

Inventory fix for character variants (like hot air balloon "mongolo"),
more similar to loadcharacter_ of the original assembly; resolves
error on load character and swap

AI assisted changes, human review and comment

Changed paths:
    engines/parallaction/exec_br.cpp
    engines/parallaction/parallaction_br.cpp


diff --git a/engines/parallaction/exec_br.cpp b/engines/parallaction/exec_br.cpp
index 3cf1c945dfd..d44327cad43 100644
--- a/engines/parallaction/exec_br.cpp
+++ b/engines/parallaction/exec_br.cpp
@@ -292,8 +292,12 @@ DECLARE_COMMAND_OPCODE(swap) {
 
 	_vm->linkUnlinkedZoneAnimations();
 
-	_vm->_inventory = _vm->findInventory(newCharacterName);
-	_vm->_inventoryRenderer->setInventory(_vm->_inventory);
+	// characters without an inventory keep the current one
+	Inventory *targetInventory = _vm->findInventory(newCharacterName);
+	if (targetInventory) {
+		_vm->_inventory = targetInventory;
+		_vm->_inventoryRenderer->setInventory(_vm->_inventory);
+	}
 
 	_vm->_input->setCharacterPointer(newCharacterName);
 }
diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp
index e27c9f2dc4b..df1c9843412 100644
--- a/engines/parallaction/parallaction_br.cpp
+++ b/engines/parallaction/parallaction_br.cpp
@@ -478,8 +478,12 @@ void Parallaction_br::changeCharacter(const char *name) {
 		_char._ani->gfxobj = _gfx->loadCharacterAnim(name);
 		_char._talk = _disk->loadTalk(name);
 
-		_inventory = findInventory(name);
-		_inventoryRenderer->setInventory(_inventory);
+		// characters without an inventory keep the current one
+		Inventory *targetInventory = findInventory(name);
+		if (targetInventory) {
+			_inventory = targetInventory;
+			_inventoryRenderer->setInventory(_inventory);
+		}
 
 		_input->setCharacterPointer(name);
 	}


Commit: f458f16caee7b2617e6062c5b63b877592660109
    https://github.com/scummvm/scummvm/commit/f458f16caee7b2617e6062c5b63b877592660109
Author: Marketto (marco.ricupero at gmail.com)
Date: 2026-12-05T17:26:25+02:00

Commit Message:
PARALLACTION: BR: Fix SET wrapping local vars

SET wrapped a local variable to its minimum, turning the value to 0
in the banana loop and preventing Dino's animation from completing,
ending in an unsolvable situation.
The fix follows SET in the original assembly, which writes the
value as is (only INC/DEC call trim_).
Nippon Safes is not affected.

AI assisted changes, human review and comment

Changed paths:
    engines/parallaction/exec_br.cpp
    engines/parallaction/objects.cpp
    engines/parallaction/objects.h
    engines/parallaction/parser_ns.cpp


diff --git a/engines/parallaction/exec_br.cpp b/engines/parallaction/exec_br.cpp
index d44327cad43..8cd1b228059 100644
--- a/engines/parallaction/exec_br.cpp
+++ b/engines/parallaction/exec_br.cpp
@@ -417,7 +417,13 @@ DECLARE_INSTRUCTION_OPCODE(off) {
 
 
 DECLARE_INSTRUCTION_OPCODE(set) {
-	ctxt._inst->_opA.setValue(ctxt._inst->_opB.getValue());
+	InstructionPtr inst = ctxt._inst;
+
+	// SET doesn't wrap a local variable, unlike INC and DEC
+	if (inst->_opA._flags & kParaLocal)
+		inst->_opA._local->forceValue(inst->_opB.getValue());
+	else
+		inst->_opA.setValue(inst->_opB.getValue());
 }
 
 
diff --git a/engines/parallaction/objects.cpp b/engines/parallaction/objects.cpp
index 8f1e56fb628..b510c8e7534 100644
--- a/engines/parallaction/objects.cpp
+++ b/engines/parallaction/objects.cpp
@@ -171,6 +171,10 @@ void LocalVariable::setValue(int16 value) {
 	_value = value;
 }
 
+void LocalVariable::forceValue(int16 value) {
+	_value = value;
+}
+
 void LocalVariable::setRange(int16 min, int16 max) {
 	_max = max;
 	_min = min;
diff --git a/engines/parallaction/objects.h b/engines/parallaction/objects.h
index d3121765747..a01a67991ed 100644
--- a/engines/parallaction/objects.h
+++ b/engines/parallaction/objects.h
@@ -333,6 +333,7 @@ public:
 
 	int16 getValue() const;
 	void setValue(int16 value);
+	void forceValue(int16 value);
 };
 
 
diff --git a/engines/parallaction/parser_ns.cpp b/engines/parallaction/parser_ns.cpp
index 5c7c83098e8..4c7e03eb54e 100644
--- a/engines/parallaction/parser_ns.cpp
+++ b/engines/parallaction/parser_ns.cpp
@@ -517,7 +517,7 @@ DECLARE_INSTRUCTION_PARSER(defLocal)  {
 	}
 
 	ctxt.inst->_opA.setLocal(&ctxt.locals[index]);
-	ctxt.inst->_opB.setImmediate(ctxt.locals[index].getValue());
+	ctxt.inst->_opB.setImmediate(val);
 
 	ctxt.inst->_index = INST_SET;
 }


Commit: 8e290523a9b70d1172d07f811831f7a6a0384269
    https://github.com/scummvm/scummvm/commit/8e290523a9b70d1172d07f811831f7a6a0384269
Author: Marketto (marco.ricupero at gmail.com)
Date: 2026-12-05T17:26:25+02:00

Commit Message:
PARALLACTION: BR: Initialize _ferrcycleMode var

_ferrcycleMode is now initialized to 0 as in the original assembly
(ferrcycle_) and following best practices.

AI assisted changes, human review and comment

Changed paths:
    engines/parallaction/parallaction_br.cpp


diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp
index df1c9843412..f3a0a76fbc8 100644
--- a/engines/parallaction/parallaction_br.cpp
+++ b/engines/parallaction/parallaction_br.cpp
@@ -53,6 +53,7 @@ Parallaction_br::Parallaction_br(OSystem* syst, const PARALLACTIONGameDescriptio
 	_countersNames = nullptr;
 	_callables = nullptr;
 	_walker = nullptr;
+	_ferrcycleMode = 0;
 }
 
 Common::Error Parallaction_br::init() {


Commit: feea0dd934244951402ffeb0d6434933a8559fd3
    https://github.com/scummvm/scummvm/commit/feea0dd934244951402ffeb0d6434933a8559fd3
Author: Marketto (marco.ricupero at gmail.com)
Date: 2026-12-05T17:26:25+02:00

Commit Message:
PARALLACTION: BR: Fix function list typo albcycle

Change "albycle" to "albcycle", as in the original assembly,
to solve the BRA crash in part 3, entering the train carriages.

AI assisted changes, human review and comment

Changed paths:
    engines/parallaction/staticres.cpp


diff --git a/engines/parallaction/staticres.cpp b/engines/parallaction/staticres.cpp
index 9280bf266a3..65195633e58 100644
--- a/engines/parallaction/staticres.cpp
+++ b/engines/parallaction/staticres.cpp
@@ -129,7 +129,7 @@ const char *callableNamesRes_br[] = {
 	"resetpalette",
 	"ferrcycle",
 	"lipsinc",
-	"albycle",
+	"albcycle",
 	"password"
 };
 


Commit: 9338e6fa9229fecac92810730ec196fc36458480
    https://github.com/scummvm/scummvm/commit/9338e6fa9229fecac92810730ec196fc36458480
Author: Marketto (marco.ricupero at gmail.com)
Date: 2026-12-05T17:26:25+02:00

Commit Message:
PARALLACTION: BR: Fix ZETA flags parsing

Make the ZETA param parser handle non numeric parameters properly,
as getcommands_ in the original assembly: the third value is read
only if it starts with a digit or minus "-" as an extra improvement.
In part 4 (SALONE) "ZETA 400 300 GFLAGS ..." was parsed with the
third value as 0, losing the condition and crashing due to a
division by zero.

AI assisted changes, human review and comment

Changed paths:
    engines/parallaction/parser_br.cpp


diff --git a/engines/parallaction/parser_br.cpp b/engines/parallaction/parser_br.cpp
index ab0ebe31149..e7e943fe545 100644
--- a/engines/parallaction/parser_br.cpp
+++ b/engines/parallaction/parser_br.cpp
@@ -635,7 +635,7 @@ DECLARE_COMMAND_PARSER(zeta)  {
 	ctxt.cmd->_zeta1 = atoi(_tokens[2]);
 	ctxt.nextToken++;
 
-	if (_tokens[3][0] != '\0') {
+	if (Common::isDigit(_tokens[3][0]) || _tokens[3][0] == '-') {
 		ctxt.cmd->_zeta2 = atoi(_tokens[3]);
 		ctxt.nextToken++;
 	} else {


Commit: 343cde1a770a37eb00ae9a55fcdaf23205c06d2e
    https://github.com/scummvm/scummvm/commit/343cde1a770a37eb00ae9a55fcdaf23205c06d2e
Author: Marketto (marco.ricupero at gmail.com)
Date: 2026-12-05T17:26:25+02:00

Commit Message:
PARALLACTION: Pause SFX with the game

Small fix to let pauseEngineIntern call the parent class behavior,
as other engines do, and also pause sound effects with the rest of
the game.

AI assisted changes, human review and comment

Changed paths:
    engines/parallaction/parallaction.cpp


diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index 9d8a504d0d0..2f70d4047cd 100644
--- a/engines/parallaction/parallaction.cpp
+++ b/engines/parallaction/parallaction.cpp
@@ -152,6 +152,7 @@ Common::Error Parallaction::init() {
 }
 
 void Parallaction::pauseEngineIntern(bool pause) {
+	Engine::pauseEngineIntern(pause);
 	if (_soundMan) {
 		_soundMan->execute(SC_PAUSE, (int)pause);
 	}


Commit: 1741b5600f0da7ee6d8b3e2ae11240886f88f776
    https://github.com/scummvm/scummvm/commit/1741b5600f0da7ee6d8b3e2ae11240886f88f776
Author: Marketto (marco.ricupero at gmail.com)
Date: 2026-12-05T17:26:25+02:00

Commit Message:
PARALLACTION: Fix duplicated floating/cursor label

Fix the logic to add items to draw on screen: remove the label from
the list first, to avoid useless duplicates of the same label.

AI assisted changes, human review and comment

Changed paths:
    engines/parallaction/graphics.cpp


diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index b75cdbfc271..c5a9bd60997 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -571,6 +571,7 @@ void Gfx::showFloatingLabel(GfxObj *label) {
 		label->setFlags(kGfxObjVisible);
 
 		_floatingLabel = label;
+		unregisterLabel(label);
 		_labels.push_back(label);
 	}
 }


Commit: 463647fcc6d7046088c1e3f906e487b0a85abed5
    https://github.com/scummvm/scummvm/commit/463647fcc6d7046088c1e3f906e487b0a85abed5
Author: Marketto (marco.ricupero at gmail.com)
Date: 2026-12-05T17:26:25+02:00

Commit Message:
PARALLACTION: Fix close game hang

Small fix to handle quitting the game while it is waiting for a
click, like a dialog or narrator parts, instead of keeping the
process alive and requiring a force close. Affects both Nippon
Safes and BRA.

AI assisted changes, human review and comment

Changed paths:
    engines/parallaction/input.cpp


diff --git a/engines/parallaction/input.cpp b/engines/parallaction/input.cpp
index 62534987a36..82182c316a7 100644
--- a/engines/parallaction/input.cpp
+++ b/engines/parallaction/input.cpp
@@ -167,7 +167,7 @@ void Input::waitForButtonEvent(uint32 buttonEventMask, int32 timeout) {
 		do {
 			readInput();
 			_vm->_system->delayMillis(LOOP_RESOLUTION);
-		} while ((_mouseButtons & buttonEventMask) == 0);
+		} while ((_mouseButtons & buttonEventMask) == 0 && !_vm->shouldQuit());
 	} else {
 		do {
 			readInput();


Commit: 722332104dfad8af137f54dbad4284d187a93b8c
    https://github.com/scummvm/scummvm/commit/722332104dfad8af137f54dbad4284d187a93b8c
Author: Marketto (marco.ricupero at gmail.com)
Date: 2026-12-05T17:26:25+02:00

Commit Message:
PARALLACTION: BR: Case insensitive openfile

openFile_internal case insensitive support as ReadMusic_ in assembly

AI assisted changes, human review and comment

Changed paths:
    engines/parallaction/disk_br.cpp


diff --git a/engines/parallaction/disk_br.cpp b/engines/parallaction/disk_br.cpp
index 664c7897a98..64200741ece 100644
--- a/engines/parallaction/disk_br.cpp
+++ b/engines/parallaction/disk_br.cpp
@@ -94,7 +94,7 @@ Common::SeekableReadStream *Disk_br::openFile_internal(bool errorOnNotFound, con
 
 	Common::Path lookup(name);
 
-	if (!ext.empty() && !name.hasSuffix(ext.c_str())) {
+	if (!ext.empty() && !name.hasSuffixIgnoreCase(ext.c_str())) {
 		// make sure we are using the specified extension
 		debugC(9, kDebugDisk, "Disk_br::openFile: appending explicit extension (%s) to (%s)", ext.c_str(), name.c_str());
 		lookup.appendInPlace(ext);
@@ -107,7 +107,7 @@ Common::SeekableReadStream *Disk_br::openFile_internal(bool errorOnNotFound, con
 
 	// as a very last resort, try trimming the file name to 8 chars
 	Common::String filename = lookup.baseName();
-	if (!ext.empty() && filename.hasSuffix(ext.c_str())) {
+	if (!ext.empty() && filename.hasSuffixIgnoreCase(ext.c_str())) {
 		int len = filename.size();
 		if (len > 8) {
 			debugC(9, kDebugDisk, "Disk_br::openFile: trimming filename (%s) to 8 characters", name.c_str());


Commit: 4546bed157135e2a260588829b9301a5b35c152e
    https://github.com/scummvm/scummvm/commit/4546bed157135e2a260588829b9301a5b35c152e
Author: Marketto (marco.ricupero at gmail.com)
Date: 2026-12-05T17:26:25+02:00

Commit Message:
PARALLACTION: BR: Fix enter/exit trap swap

Fix enter/exit trap swap according to BRA disassembly, fixing train
roof and other enter/exit animations

AI assisted changes, human review and comment

Changed paths:
    engines/parallaction/walk.cpp


diff --git a/engines/parallaction/walk.cpp b/engines/parallaction/walk.cpp
index b603efb7460..1dd241fc1b5 100644
--- a/engines/parallaction/walk.cpp
+++ b/engines/parallaction/walk.cpp
@@ -558,9 +558,9 @@ void PathWalker_BR::checkTrap(const Common::Point &p) {
 		if (z->_flags & kFlagsIsAnimation) {
 			z->_flags |= kFlagsActing;
 		} else {
-			_vm->setLocationFlags(kFlagsExit);
+			_vm->setLocationFlags(kFlagsEnter);
 			_vm->_cmdExec->run(z->_commands, z);
-			_vm->clearLocationFlags(kFlagsExit);
+			_vm->clearLocationFlags(kFlagsEnter);
 		}
 	}
 
@@ -568,9 +568,9 @@ void PathWalker_BR::checkTrap(const Common::Point &p) {
 		if (_vm->_zoneTrap->_flags & kFlagsIsAnimation) {
 			_vm->_zoneTrap->_flags &= ~kFlagsActing;
 		} else {
-			_vm->setLocationFlags(kFlagsEnter);
+			_vm->setLocationFlags(kFlagsExit);
 			_vm->_cmdExec->run(_vm->_zoneTrap->_commands, _vm->_zoneTrap);
-			_vm->clearLocationFlags(kFlagsEnter);
+			_vm->clearLocationFlags(kFlagsExit);
 		}
 	}
 


Commit: 8ffc08ebb6d719dc93af32f28b7f5ac3c07c0e97
    https://github.com/scummvm/scummvm/commit/8ffc08ebb6d719dc93af32f28b7f5ac3c07c0e97
Author: Marketto (marco.ricupero at gmail.com)
Date: 2026-12-05T17:26:25+02:00

Commit Message:
PARALLACTION: BR: changeLocation trap reset

ChangeLocation resets zoneTrap as in disassembly

AI assisted changes, human review and comment

Changed paths:
    engines/parallaction/parallaction_br.cpp


diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp
index f3a0a76fbc8..0a66e56c651 100644
--- a/engines/parallaction/parallaction_br.cpp
+++ b/engines/parallaction/parallaction_br.cpp
@@ -319,6 +319,7 @@ void Parallaction_br::changeLocation() {
 	}
 
 	freeLocation(false);
+	_zoneTrap.reset();
 	// load new location
 	Common::strlcpy(_location._name, _newLocationName.c_str(), 100);
 	parseLocation(_location._name);


Commit: 4edf1e60853e534128222de11b31ccc67228c84f
    https://github.com/scummvm/scummvm/commit/4edf1e60853e534128222de11b31ccc67228c84f
Author: Marketto (marco.ricupero at gmail.com)
Date: 2026-12-05T17:26:25+02:00

Commit Message:
PARALLACTION: BR: Fix Character load in rooms

Character is loaded only one time per room before specific character
room logics, fix dead end in chapter 4 walking back with Dino in the
village from graveyard, follows the assembly logic, saving character
name is not necessary anymore

AI assisted changes, human review and comment

Changed paths:
    engines/parallaction/parallaction_br.cpp
    engines/parallaction/parser.h
    engines/parallaction/parser_br.cpp


diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp
index 0a66e56c651..79eb46da3aa 100644
--- a/engines/parallaction/parallaction_br.cpp
+++ b/engines/parallaction/parallaction_br.cpp
@@ -419,11 +419,6 @@ void Parallaction_br::parseLocation(const char *filename) {
 		}
 	}
 
-	// load the character (must be done before animations are processed)
-	if (!out._characterName.empty()) {
-		changeCharacter(out._characterName.c_str());
-	}
-
 	// process animations
 	AnimationList::iterator ait = _location._animations.begin();
 	for ( ; ait != _location._animations.end(); ++ait) {
diff --git a/engines/parallaction/parser.h b/engines/parallaction/parser.h
index d9d78eb5d91..0df28ee9ec9 100644
--- a/engines/parallaction/parser.h
+++ b/engines/parallaction/parser.h
@@ -238,7 +238,6 @@ public:
 struct LocationParserOutput_br {
 	BackgroundInfo	*_info;
 
-	Common::String _characterName;
 	Common::String _backgroundName;
 	Common::String _maskName;
 	Common::String _pathName;
diff --git a/engines/parallaction/parser_br.cpp b/engines/parallaction/parser_br.cpp
index e7e943fe545..c39f72454c8 100644
--- a/engines/parallaction/parser_br.cpp
+++ b/engines/parallaction/parser_br.cpp
@@ -437,7 +437,11 @@ DECLARE_LOCATION_PARSER(redundant)  {
 
 DECLARE_LOCATION_PARSER(character)  {
 	debugC(7, kDebugParser, "LOCATION_PARSER(character) ");
-	_out->_characterName = _tokens[1];
+
+	// only for 1st visit, before IFCHAR is parsed
+	if ((_vm->getLocationFlags() & kFlagsVisited) == 0) {
+		_vm->changeCharacter(_tokens[1]);
+	}
 }
 
 


Commit: b62436fa04d1488024a86116db183ab3926cf406
    https://github.com/scummvm/scummvm/commit/b62436fa04d1488024a86116db183ab3926cf406
Author: Marketto (marco.ricupero at gmail.com)
Date: 2026-12-05T17:26:25+02:00

Commit Message:
PARALLACTION: BR: Fix follow character

After character swap in part 4 the companion character was not following
the controlled character

AI assisted changes, human review and comment

Changed paths:
    engines/parallaction/exec_br.cpp
    engines/parallaction/parallaction.h


diff --git a/engines/parallaction/exec_br.cpp b/engines/parallaction/exec_br.cpp
index 8cd1b228059..b28c74cd943 100644
--- a/engines/parallaction/exec_br.cpp
+++ b/engines/parallaction/exec_br.cpp
@@ -271,11 +271,8 @@ DECLARE_COMMAND_OPCODE(scroll) {
 
 
 DECLARE_COMMAND_OPCODE(swap) {
-	warning("Parallaction_br::cmdOp_swap does not handle a follower yet");
-
 	/*
 		TODO:
-		- fixup follower
 		- change mouse pointer
 	*/
 
@@ -290,6 +287,11 @@ DECLARE_COMMAND_OPCODE(swap) {
 	_vm->_char._talk = _vm->_disk->loadTalk(newCharacterName);
 	Common::strlcpy(_vm->_char._ani->_name, "yourself", ZONENAME_LENGTH);
 
+	// the character being left follows the new one
+	if (_vm->hasFollower()) {
+		_vm->setFollower(oldCharaterAnimation->_name);
+	}
+
 	_vm->linkUnlinkedZoneAnimations();
 
 	// characters without an inventory keep the current one
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index abfeacc9310..11ca35e50ae 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -621,6 +621,7 @@ public:
 	void	setCounterValue(const Common::String &name, int value);
 
 	void	setFollower(const Common::String &name);
+	bool	hasFollower() const { return _follower != nullptr; }
 
 	int		getSfxStatus();
 	int		getMusicStatus();


Commit: 8f7ece730139012f9356f65188e14b83820a1d04
    https://github.com/scummvm/scummvm/commit/8f7ece730139012f9356f65188e14b83820a1d04
Author: Marketto (marco.ricupero at gmail.com)
Date: 2026-12-05T17:26:25+02:00

Commit Message:
PARALLACTION: BR: Fix animations after swap

The original assembly copy chars animation at room entrance, after
swapping character everything is copied including animations
swapField follows the assembly logic handling refs between new and old
character when a character swap comes
Solves the problem of character disappears in chapter 4 after moving
stones
When unable to find the animation, it warns like the ADV.EXE assembly,
but avoids copying from null and consequent crash

AI assisted changes, human review and comment

Changed paths:
    engines/parallaction/exec_br.cpp
    engines/parallaction/objects.h


diff --git a/engines/parallaction/exec_br.cpp b/engines/parallaction/exec_br.cpp
index b28c74cd943..d1ad1d81453 100644
--- a/engines/parallaction/exec_br.cpp
+++ b/engines/parallaction/exec_br.cpp
@@ -270,6 +270,23 @@ DECLARE_COMMAND_OPCODE(scroll) {
 }
 
 
+// SWAP exchanges two animations, and so do the references of the scripts,
+// but those to the animation of the script itself
+static void swapField(ScriptVar &var, Animation *a, Animation *b, Animation *self) {
+	if (!(var._flags & kParaField)) {
+		return;
+	}
+	Animation *instance = var._field->getInstance();
+	if (instance == self) {
+		return;
+	}
+	if (instance == a) {
+		var._field->setInstance(b);
+	} else if (instance == b) {
+		var._field->setInstance(a);
+	}
+}
+
 DECLARE_COMMAND_OPCODE(swap) {
 	/*
 		TODO:
@@ -278,6 +295,10 @@ DECLARE_COMMAND_OPCODE(swap) {
 
 	const char *newCharacterName = ctxt._cmd->_string.c_str();
 	AnimationPtr newCharacterAnimation = _vm->_location.findAnimation(newCharacterName);
+	if (!newCharacterAnimation) {
+		warning("SWAP: can't find anim '%s'", newCharacterName);
+		return;
+	}
 	AnimationPtr oldCharaterAnimation = _vm->_char._ani;
 
 	Common::strlcpy(oldCharaterAnimation->_name, _vm->_char.getName(), ZONENAME_LENGTH);
@@ -287,6 +308,23 @@ DECLARE_COMMAND_OPCODE(swap) {
 	_vm->_char._talk = _vm->_disk->loadTalk(newCharacterName);
 	Common::strlcpy(_vm->_char._ani->_name, "yourself", ZONENAME_LENGTH);
 
+	ProgramList &programs = _vm->_location._programs;
+	for (ProgramList::iterator p = programs.begin(); p != programs.end(); ++p) {
+		Animation *self = (*p)->_anim.get();
+		InstructionList &instructions = (*p)->_instructions;
+		for (InstructionList::iterator it = instructions.begin(); it != instructions.end(); ++it) {
+			InstructionPtr inst = *it;
+			if (inst->_z == oldCharaterAnimation && oldCharaterAnimation.get() != self) {
+				inst->_z = newCharacterAnimation;
+			} else if (inst->_z == newCharacterAnimation && newCharacterAnimation.get() != self) {
+				inst->_z = oldCharaterAnimation;
+			}
+			swapField(inst->_opA, oldCharaterAnimation.get(), newCharacterAnimation.get(), self);
+			swapField(inst->_opB, oldCharaterAnimation.get(), newCharacterAnimation.get(), self);
+			swapField(inst->_opC, oldCharaterAnimation.get(), newCharacterAnimation.get(), self);
+		}
+	}
+
 	// the character being left follows the new one
 	if (_vm->hasFollower()) {
 		_vm->setFollower(oldCharaterAnimation->_name);
diff --git a/engines/parallaction/objects.h b/engines/parallaction/objects.h
index a01a67991ed..4a41aa13f26 100644
--- a/engines/parallaction/objects.h
+++ b/engines/parallaction/objects.h
@@ -357,18 +357,35 @@ struct AnimationField {
 protected:
 	Accessor *_accessor;
 	Mutator *_mutator;
+	Animation *_instance;
+	AccessorFunc _accessorFunc;
+	MutatorFunc _mutatorFunc;
 
 public:
-	AnimationField(Animation* instance, AccessorFunc accessor, MutatorFunc mutator) {
+	AnimationField(Animation* instance, AccessorFunc accessor, MutatorFunc mutator) :
+		_instance(instance), _accessorFunc(accessor), _mutatorFunc(mutator) {
 		_accessor = new Accessor(instance, accessor);
 		_mutator = new Mutator(instance, mutator);
 	}
 
-	AnimationField(Animation* instance, AccessorFunc accessor) {
+	AnimationField(Animation* instance, AccessorFunc accessor) :
+		_instance(instance), _accessorFunc(accessor), _mutatorFunc(0) {
 		_accessor = new Accessor(instance, accessor);
 		_mutator = 0;
 	}
 
+	Animation *getInstance() const {
+		return _instance;
+	}
+
+	void setInstance(Animation *newInstance) {
+		delete _accessor;
+		delete _mutator;
+		_instance = newInstance;
+		_accessor = new Accessor(newInstance, _accessorFunc);
+		_mutator = _mutatorFunc ? new Mutator(newInstance, _mutatorFunc) : 0;
+	}
+
 	~AnimationField() {
 		delete _accessor;
 		delete _mutator;


Commit: b0a603cf85b922b5f5b4aca95a190fd4f2cd36d9
    https://github.com/scummvm/scummvm/commit/b0a603cf85b922b5f5b4aca95a190fd4f2cd36d9
Author: Marketto (marco.ricupero at gmail.com)
Date: 2026-12-05T17:26:25+02:00

Commit Message:
PARALLACTION: BR: Fix location events after swap

The original assembly copy chars details at room entrance, after
swapping character specific character location events are reassigned
according to the new character
swapCommands and swapZoneCommands follows the assembly logic handling
refs between new and old character when a character swap comes
Solves the problem of double character in game while an animation of
that character starts

AI assisted changes, human review and comment

Changed paths:
    engines/parallaction/exec_br.cpp


diff --git a/engines/parallaction/exec_br.cpp b/engines/parallaction/exec_br.cpp
index d1ad1d81453..ad7b522b520 100644
--- a/engines/parallaction/exec_br.cpp
+++ b/engines/parallaction/exec_br.cpp
@@ -287,6 +287,41 @@ static void swapField(ScriptVar &var, Animation *a, Animation *b, Animation *sel
 	}
 }
 
+// The original binds the commands on loading: bind those naming the two
+// animations before SWAP renames them, then exchange them too
+static void swapCommands(CommandList &commands, Location &loc,
+		const AnimationPtr &a, const AnimationPtr &b) {
+	for (CommandList::iterator it = commands.begin(); it != commands.end(); ++it) {
+		CommandPtr cmd = *it;
+		if (cmd->_valid && !cmd->_zone && !cmd->_zoneName.empty()) {
+			ZonePtr z = loc.findZone(cmd->_zoneName.c_str());
+			if (z.get() == a.get() || z.get() == b.get()) {
+				cmd->_zone = z;
+			}
+		}
+		if (cmd->_zone.get() == a.get()) {
+			cmd->_zone = b;
+		} else if (cmd->_zone.get() == b.get()) {
+			cmd->_zone = a;
+		}
+	}
+}
+
+static void swapZoneCommands(ZonePtr z, Location &loc,
+		const AnimationPtr &a, const AnimationPtr &b) {
+	swapCommands(z->_commands, loc, a, b);
+	if (ACTIONTYPE(z) != kZoneSpeak || !z->u._speakDialogue) {
+		return;
+	}
+	Dialogue *dialogue = z->u._speakDialogue;
+	for (uint i = 0; i < dialogue->_numQuestions; i++) {
+		Question *q = dialogue->_questions[i];
+		for (int j = 0; j < NUM_ANSWERS && q->_answers[j]; j++) {
+			swapCommands(q->_answers[j]->_commands, loc, a, b);
+		}
+	}
+}
+
 DECLARE_COMMAND_OPCODE(swap) {
 	/*
 		TODO:
@@ -301,6 +336,19 @@ DECLARE_COMMAND_OPCODE(swap) {
 	}
 	AnimationPtr oldCharaterAnimation = _vm->_char._ani;
 
+	Location &loc = _vm->_location;
+	swapCommands(loc._commands, loc, oldCharaterAnimation, newCharacterAnimation);
+	swapCommands(loc._aCommands, loc, oldCharaterAnimation, newCharacterAnimation);
+	swapCommands(loc._escapeCommands, loc, oldCharaterAnimation, newCharacterAnimation);
+	ZoneList &zones = loc._zones;
+	for (ZoneList::iterator it = zones.begin(); it != zones.end(); ++it) {
+		swapZoneCommands(*it, loc, oldCharaterAnimation, newCharacterAnimation);
+	}
+	AnimationList &animations = loc._animations;
+	for (AnimationList::iterator it = animations.begin(); it != animations.end(); ++it) {
+		swapZoneCommands(*it, loc, oldCharaterAnimation, newCharacterAnimation);
+	}
+
 	Common::strlcpy(oldCharaterAnimation->_name, _vm->_char.getName(), ZONENAME_LENGTH);
 	_vm->_char.setName(newCharacterName);
 


Commit: 0e4b346f6612a2e3dca69e11eab19a4b047b0748
    https://github.com/scummvm/scummvm/commit/0e4b346f6612a2e3dca69e11eab19a4b047b0748
Author: Marketto (marco.ricupero at gmail.com)
Date: 2026-12-05T17:26:25+02:00

Commit Message:
PARALLACTION: BR: Fix unclickable zones

Fix path areas intersection with hit boxes that prevents click to be
caught, according to the original assembly. Resolves issue in part 3 for
train doors
checkZoneType, only for BRA, as in the original checkzone_ now checks
for hittable zones and path only

AI assisted changes, human review and comment

Changed paths:
    engines/parallaction/parallaction.cpp


diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index 2f70d4047cd..506f5e85e4f 100644
--- a/engines/parallaction/parallaction.cpp
+++ b/engines/parallaction/parallaction.cpp
@@ -707,6 +707,7 @@ bool Parallaction::checkZoneType(ZonePtr z, uint32 type) {
 			if (ACTIONTYPE(z) == kZoneDoor) {
 				return true;
 			}
+			return false;
 		}
 	}
 


Commit: 76c47d0839b3cee3b53bf76e271c46f38fa8079e
    https://github.com/scummvm/scummvm/commit/76c47d0839b3cee3b53bf76e271c46f38fa8079e
Author: Marketto (marco.ricupero at gmail.com)
Date: 2026-12-05T17:26:25+02:00

Commit Message:
PARALLACTION: BR: Fix walk to MOVETO

clicking on a change room box (a door)
now drives the character to the relative MOVETO point
instead of walking to the clicked point
Resolves unexpected behavior like walking near the door and get stuck
and follows the assembly logic

AI assisted changes, human review and comment

Changed paths:
    engines/parallaction/input.cpp


diff --git a/engines/parallaction/input.cpp b/engines/parallaction/input.cpp
index 82182c316a7..8fdfa1581c7 100644
--- a/engines/parallaction/input.cpp
+++ b/engines/parallaction/input.cpp
@@ -312,6 +312,10 @@ bool Input::translateGameInput() {
 	ZonePtr z = _vm->hitZone(_activeItem._id, mousePos.x, mousePos.y);
 
 	if (((_mouseButtons == kMouseLeftUp) && (_activeItem._id == 0) && ((g_engineFlags & kEngineWalking) == 0)) && ((!z) || (ACTIONTYPE(z) != kZoneCommand))) {
+		// BRA walks to the MOVETO of a door
+		if (_gameType == GType_BRA && z && ACTIONTYPE(z) == kZoneDoor && z->_moveTo.y != 0) {
+			mousePos = z->_moveTo;
+		}
 		walkTo(mousePos);
 		return true;
 	}


Commit: f4d28ff14f3f7a063ca0b90c71f55399e2fde1af
    https://github.com/scummvm/scummvm/commit/f4d28ff14f3f7a063ca0b90c71f55399e2fde1af
Author: Marketto (marco.ricupero at gmail.com)
Date: 2026-12-05T17:26:25+02:00

Commit Message:
PARALLACTION: BR: Fix SFX channel

As of the DOS assembly, SFX are played on a single channel the SFX id
was previously misconfused as channel writing memory outside the
available channel list

AI assisted changes, human review and comment

Changed paths:
    engines/parallaction/sound_br.cpp


diff --git a/engines/parallaction/sound_br.cpp b/engines/parallaction/sound_br.cpp
index 24a16bae59b..3d2bd8427c5 100644
--- a/engines/parallaction/sound_br.cpp
+++ b/engines/parallaction/sound_br.cpp
@@ -346,7 +346,8 @@ Audio::AudioStream *DosSoundMan_br::loadChannelData(const char *filename, Channe
 }
 
 void DosSoundMan_br::playSfx(const char *filename, uint channel, bool looping, int volume) {
-	stopSfx(channel);
+	// SBEFF.EXE has a single voice: the channel only names the sample
+	stopSfx(0);
 
 	if (!_sfxEnabled) {
 		return;
@@ -354,7 +355,7 @@ void DosSoundMan_br::playSfx(const char *filename, uint channel, bool looping, i
 
 	debugC(1, kDebugAudio, "DosSoundMan_br::playSfx(%s, %u, %i, %i)", filename, channel, looping, volume);
 
-	Channel *ch = &_channels[channel];
+	Channel *ch = &_channels[0];
 	Audio::AudioStream *input = loadChannelData(filename, ch, looping);
 	_mixer->playStream(Audio::Mixer::kSFXSoundType, &ch->handle, input, -1, volume);
 }


Commit: 4d6acc1d00c0ca4c7a7c48092f13b201fbec2323
    https://github.com/scummvm/scummvm/commit/4d6acc1d00c0ca4c7a7c48092f13b201fbec2323
Author: Marketto (marco.ricupero at gmail.com)
Date: 2026-12-05T17:26:25+02:00

Commit Message:
PARALLACTION: BR: Refactor changeLocation

Refactor of changeLocation function to move a part into loadPart, no
logic changes, loadPart behavior similar to assembly loadpart_

AI assisted changes, human review and comment

Changed paths:
    engines/parallaction/parallaction.h
    engines/parallaction/parallaction_br.cpp


diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index 11ca35e50ae..bb1b77d32d9 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -664,6 +664,7 @@ private:
 	void	initFonts();
 	void	freeFonts();
 	void	freeLocation(bool removeAll);
+	void	loadPart(int part);
 	void	loadProgram(AnimationPtr a, const char *filename);
 	void	startGui(bool showSplash);
 	void	startIngameMenu();
diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp
index 79eb46da3aa..3b2dc71516a 100644
--- a/engines/parallaction/parallaction_br.cpp
+++ b/engines/parallaction/parallaction_br.cpp
@@ -278,44 +278,48 @@ void Parallaction_br::cleanupGame() {
 }
 
 
-void Parallaction_br::changeLocation() {
-	if (_newLocationName.empty()) {
-		return;
-	}
+void Parallaction_br::loadPart(int part) {
+	cleanupGame();
 
-	if (_nextPart != -1) {
-		cleanupGame();
+	// more cleanup needed for part changes (see also saveload)
+	g_globalFlags = 0;
+	cleanInventory(true);
+	Common::strcpy_s(_characterName1, "null");
 
-		// more cleanup needed for part changes (see also saveload)
-		g_globalFlags = 0;
-		cleanInventory(true);
-		Common::strcpy_s(_characterName1, "null");
+	_part = part;
 
-		_part = _nextPart;
+	if (getFeatures() & GF_DEMO) {
+		assert(_part == 1);
+	} else {
+		assert(_part >= 0 && _part <= 4);
+	}
 
-		if (getFeatures() & GF_DEMO) {
-			assert(_part == 1);
-		} else {
-			assert(_part >= 0 && _part <= 4);
-		}
+	_disk->selectArchive(_partNames[_part]);
 
-		_disk->selectArchive(_partNames[_part]);
+	memset(_counters, 0, sizeof(_counters));
 
-		memset(_counters, 0, sizeof(_counters));
+	_globalFlagsNames = _disk->loadTable("global");
+	_objectsNames = _disk->loadTable("objects");
+	_countersNames = _disk->loadTable("counters");
 
-		_globalFlagsNames = _disk->loadTable("global");
-		_objectsNames = _disk->loadTable("objects");
-		_countersNames = _disk->loadTable("counters");
+	// TODO: maybe handle this into Disk
+	delete _objects;
+	if (getPlatform() == Common::kPlatformDOS) {
+		_objects = _disk->loadObjects("icone.ico");
+	} else {
+		_objects = _disk->loadObjects("icons.ico", _part);
+	}
 
-		// TODO: maybe handle this into Disk
-		delete _objects;
-		if (getPlatform() == Common::kPlatformDOS) {
-			_objects = _disk->loadObjects("icone.ico");
-		} else {
-			_objects = _disk->loadObjects("icons.ico", _part);
-		}
+	parseLocation("common.slf");
+}
 
-		parseLocation("common.slf");
+void Parallaction_br::changeLocation() {
+	if (_newLocationName.empty()) {
+		return;
+	}
+
+	if (_nextPart != -1) {
+		loadPart(_nextPart);
 	}
 
 	freeLocation(false);


Commit: 953a960582093cacdc61c81e6d7c8b31cdc06aaa
    https://github.com/scummvm/scummvm/commit/953a960582093cacdc61c81e6d7c8b31cdc06aaa
Author: Marketto (marco.ricupero at gmail.com)
Date: 2026-12-05T17:26:25+02:00

Commit Message:
PARALLACTION: BR: Fix crash on loadPart

loadPart calls cleanupGame, which clears all character data but the
name, then changeCharacter, which now loads the same character even
with the same name, according to the original assembly

AI assisted changes, human review and comment

Changed paths:
    engines/parallaction/parallaction_br.cpp


diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp
index 3b2dc71516a..1261e0f073b 100644
--- a/engines/parallaction/parallaction_br.cpp
+++ b/engines/parallaction/parallaction_br.cpp
@@ -470,7 +470,8 @@ void Parallaction_br::changeCharacter(const char *name) {
 
 	const char *charName = _char.getName();
 
-	if (scumm_stricmp(charName, name)) {
+	// the character is freed when a part is loaded
+	if (scumm_stricmp(charName, name) || !_char._ani->gfxobj) {
 		freeCharacter();
 
 		debugC(1, kDebugExec, "changeCharacter(%s)", name);


Commit: 6b060a040a4366fd5f082f3d7f8399d876e46c8f
    https://github.com/scummvm/scummvm/commit/6b060a040a4366fd5f082f3d7f8399d876e46c8f
Author: Marketto (marco.ricupero at gmail.com)
Date: 2026-12-05T17:26:25+02:00

Commit Message:
PARALLACTION: Fix mini characters handling

Nippon Safes has a logic to prefix "mini" characters starting with m,
not present in BR, the logic was triggered by mongolo in BR, causing a
potential save game unable to be loaded due to the resulting character
name "miniolo" which has no animations causing error; the fix limits
prefix logic to Nippon Safes, preventing character renaming and
inconsistent savegames

AI assisted changes, human review and comment

Changed paths:
    engines/parallaction/parallaction.cpp


diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index 506f5e85e4f..2a1d3722a5b 100644
--- a/engines/parallaction/parallaction.cpp
+++ b/engines/parallaction/parallaction.cpp
@@ -1012,7 +1012,8 @@ void CharacterName::bind(const char *name) {
 					end = s;
 				}
 			}
-			if (IS_MINI_CHARACTER(name)) {
+			// BR has no mini characters: its names starting with 'm' (mongolo) are kept as given
+			if (IS_MINI_CHARACTER(name) && g_vm->getGameType() == GType_Nippon) {
 				_prefix = _prefixMini;
 				begin = name + 4;
 			}


Commit: c5fc5568c366e9af73025ae6b0e824b953b7570a
    https://github.com/scummvm/scummvm/commit/c5fc5568c366e9af73025ae6b0e824b953b7570a
Author: Marketto (marco.ricupero at gmail.com)
Date: 2026-12-05T17:26:25+02:00

Commit Message:
PARALLACTION: BR: Implement save game

Implement save game logic using common extended save game only for BR,
including current inventory, leaving legacy save game for NS:
listSaves, hasFeature, getSaveStateName, canSaveGameStateCurrently,
saveGameStream

AI assisted changes, human review and comment

Changed paths:
    engines/parallaction/gui_br.cpp
    engines/parallaction/metaengine.cpp
    engines/parallaction/parallaction.h
    engines/parallaction/parallaction_br.cpp
    engines/parallaction/saveload.cpp
    engines/parallaction/saveload.h


diff --git a/engines/parallaction/gui_br.cpp b/engines/parallaction/gui_br.cpp
index 6c4ca47d9b6..54728544b0a 100644
--- a/engines/parallaction/gui_br.cpp
+++ b/engines/parallaction/gui_br.cpp
@@ -431,7 +431,6 @@ public:
 			break;
 
 		case 2:	// save
-			warning("Saving is not supported yet");
 			_vm->_saveLoad->saveGame();
 			break;
 
diff --git a/engines/parallaction/metaengine.cpp b/engines/parallaction/metaengine.cpp
index 70adce018b2..3b9921259ff 100644
--- a/engines/parallaction/metaengine.cpp
+++ b/engines/parallaction/metaengine.cpp
@@ -80,6 +80,7 @@ public:
 	Common::KeymapArray initKeymaps(const char *target) const override;
 
 	SaveStateList listSaves(const char *target) const override;
+	SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const override;
 	int getMaximumSaveSlot() const override;
 	bool removeSaveState(const char *target, int slot) const override;
 	Common::String getSavegameFile(int saveGameIdx, const char *target) const override {
@@ -97,7 +98,8 @@ bool ParallactionMetaEngine::hasFeature(MetaEngineFeature f) const {
 	return
 		(f == kSupportsListSaves) ||
 		(f == kSimpleSavesNames) ||
-		(f == kSupportsDeleteSave);
+		(f == kSupportsDeleteSave) ||
+		(f == kSavesUseExtendedFormat);
 }
 
 bool Parallaction::Parallaction::hasFeature(EngineFeature f) const {
@@ -183,6 +185,10 @@ Common::KeymapArray ParallactionMetaEngine::initKeymaps(const char *target) cons
 }
 
 SaveStateList ParallactionMetaEngine::listSaves(const char *target) const {
+	// only Big Red Adventure uses the extended saves
+	if (ConfMan.get("gameid", target) == "bra")
+		return MetaEngine::listSaves(target);
+
 	Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
 
 	Common::StringArray filenames = saveFileMan->listSavefiles(getSavegameFilePattern(target));
@@ -207,6 +213,14 @@ SaveStateList ParallactionMetaEngine::listSaves(const char *target) const {
 	return saveList;
 }
 
+SaveStateDescriptor ParallactionMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
+	// only Big Red Adventure uses the extended saves
+	if (ConfMan.get("gameid", target) == "bra")
+		return MetaEngine::querySaveMetaInfos(target, slot);
+
+	return SaveStateDescriptor();
+}
+
 int ParallactionMetaEngine::getMaximumSaveSlot() const { return 99; }
 
 bool ParallactionMetaEngine::removeSaveState(const char *target, int slot) const {
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index bb1b77d32d9..de45c4fe2ee 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -594,6 +594,11 @@ public:
 	Common::Error init() override;
 	Common::Error go() override;
 
+	bool hasFeature(EngineFeature f) const override;
+	Common::String getSaveStateName(int slot) const override;
+	bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
+	Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override;
+
 public:
 	void parseLocation(const char* name) override;
 	void changeLocation() override;
diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp
index 1261e0f073b..0c5dd6a6441 100644
--- a/engines/parallaction/parallaction_br.cpp
+++ b/engines/parallaction/parallaction_br.cpp
@@ -23,6 +23,8 @@
 #include "common/util.h"
 #include "common/textconsole.h"
 
+#include "engines/metaengine.h"
+
 #include "parallaction/parallaction.h"
 #include "parallaction/exec.h"
 #include "parallaction/input.h"
@@ -56,6 +58,22 @@ Parallaction_br::Parallaction_br(OSystem* syst, const PARALLACTIONGameDescriptio
 	_ferrcycleMode = 0;
 }
 
+bool Parallaction_br::hasFeature(EngineFeature f) const {
+	return Parallaction::hasFeature(f) ||
+		(f == kSupportsSavingDuringRuntime);
+}
+
+Common::String Parallaction_br::getSaveStateName(int slot) const {
+	return getMetaEngine()->getSavegameFile(slot, _targetName.c_str());
+}
+
+// When the in-game menu can be opened (see Input::updateGameInput)
+bool Parallaction_br::canSaveGameStateCurrently(Common::U32String *msg) {
+	return !(getFeatures() & GF_DEMO) && _char._ani->gfxobj &&
+		_input->_inputMode == Input::kInputModeGame && _input->isMouseEnabled() &&
+		!(g_engineFlags & (kEngineBlockInput | kEngineWalking | kEngineChangeLocation));
+}
+
 Common::Error Parallaction_br::init() {
 
 	_screenWidth = 640;
diff --git a/engines/parallaction/saveload.cpp b/engines/parallaction/saveload.cpp
index 3168d387e00..811109f9197 100644
--- a/engines/parallaction/saveload.cpp
+++ b/engines/parallaction/saveload.cpp
@@ -327,7 +327,90 @@ void SaveLoad_br::doLoadGame(uint16 slot) {
 }
 
 void SaveLoad_br::doSaveGame(uint16 slot, const char* name) {
-	// TODO: implement savegame
+	Common::Error result = _vm->saveGameState(slot, name);
+	if (result.getCode() != Common::kNoError) {
+		GUI::MessageDialog dialog(result.getDesc());
+		dialog.runModal();
+	}
+}
+
+static const uint32 kSavegameVersion = 1;
+static const int16 kNoFollowerPosition = -1000;
+static const int16 kNoCurrentInventory = -1;
+
+static void writeSaveString(Common::WriteStream *stream, const Common::String &str) {
+	stream->writeString(str);
+	stream->writeByte(0);
+}
+
+// Same data as savegame_ in the original
+Common::Error Parallaction_br::saveGameStream(Common::WriteStream *stream, bool isAutosave) {
+	// store the flags of the current location first
+	ZoneList::iterator zit = _location._zones.begin();
+	for ( ; zit != _location._zones.end(); ++zit) {
+		restoreOrSaveZoneFlags(*zit, false);
+	}
+	AnimationList::iterator ait = _location._animations.begin();
+	for ( ; ait != _location._animations.end(); ++ait) {
+		restoreOrSaveZoneFlags(*ait, false);
+	}
+
+	stream->writeUint32LE(kSavegameVersion);
+	stream->writeSint32LE(_part);
+	writeSaveString(stream, _locationNames[_currentLocationIndex]);
+	writeSaveString(stream, _char.getName());
+
+	Common::Point foot;
+	_char._ani->getFoot(foot);
+	stream->writeSint16LE(foot.x);
+	stream->writeSint16LE(foot.y);
+	stream->writeSint16LE(_char._ani->getF());
+
+	int16 followerFrame = 0;
+	foot.x = foot.y = kNoFollowerPosition;
+	if (_follower) {
+		_follower->getFoot(foot);
+		followerFrame = _follower->getF();
+	}
+	writeSaveString(stream, _followerName);
+	stream->writeSint16LE(foot.x);
+	stream->writeSint16LE(foot.y);
+	stream->writeSint16LE(followerFrame);
+
+	stream->writeUint32LE(g_globalFlags);
+
+	stream->writeUint16LE(_numLocations);
+	for (uint i = 0; i < _numLocations; i++) {
+		writeSaveString(stream, _locationNames[i]);
+		stream->writeUint32LE(_localFlags[i]);
+	}
+	for (uint i = 0; i < _numLocations; i++) {
+		for (uint j = 0; j < NUM_ZONES; j++)
+			stream->writeUint32LE(_zoneFlags[i][j]);
+	}
+
+	for (uint i = 0; i < ARRAYSIZE(_counters); i++)
+		stream->writeSint32LE(_counters[i]);
+
+	Inventory *inventories[] = { _dinoInventory, _dougInventory, _donnaInventory };
+	// characters without an inventory keep the current one (_AInventory in the original)
+	int16 currentInventory = kNoCurrentInventory;
+	for (uint i = 0; i < ARRAYSIZE(inventories); i++) {
+		if (inventories[i] == _inventory)
+			currentInventory = i;
+	}
+	stream->writeSint16LE(currentInventory);
+
+	for (uint i = 0; i < ARRAYSIZE(inventories); i++) {
+		stream->writeSint16LE(inventories[i]->getNumItems());
+		for (int j = 0; j < inventories[i]->getNumItems(); j++) {
+			const InventoryItem *item = inventories[i]->getItem(j);
+			stream->writeUint32LE(item->_id);
+			stream->writeUint16LE(item->_index);
+		}
+	}
+
+	return stream->err() ? Common::kWritingFailed : Common::kNoError;
 }
 
 void SaveLoad_br::getGamePartProgress(bool *complete, int size) {
diff --git a/engines/parallaction/saveload.h b/engines/parallaction/saveload.h
index cd918e133df..be413c28fc7 100644
--- a/engines/parallaction/saveload.h
+++ b/engines/parallaction/saveload.h
@@ -70,12 +70,13 @@ public:
 };
 
 class SaveLoad_br : public SaveLoad {
-//	Parallaction_br *_vm;
+	Parallaction_br *_vm;
 	void doLoadGame(uint16 slot) override;
 	void doSaveGame(uint16 slot, const char* name) override;
 
 public:
-	SaveLoad_br(Parallaction_br *vm, Common::SaveFileManager *saveFileMan) : SaveLoad(saveFileMan, "bra") { }
+	SaveLoad_br(Parallaction_br *vm, Common::SaveFileManager *saveFileMan) :
+		SaveLoad(saveFileMan, "bra"), _vm(vm) { }
 
 	void getGamePartProgress(bool *complete, int size) override;
 	void setPartComplete(const char *part) override;


Commit: 5154f6257507124b18a0faf5836947bcfa24d70d
    https://github.com/scummvm/scummvm/commit/5154f6257507124b18a0faf5836947bcfa24d70d
Author: Marketto (marco.ricupero at gmail.com)
Date: 2026-12-05T17:26:25+02:00

Commit Message:
PARALLACTION: BR: Implement load game

Implement load game using common load game feature loading the part and
then the save game as the original assembly

AI assisted changes, human review and comment

Changed paths:
    engines/parallaction/gui_br.cpp
    engines/parallaction/inventory.h
    engines/parallaction/parallaction.h
    engines/parallaction/parallaction_br.cpp
    engines/parallaction/saveload.cpp
    engines/parallaction/saveload.h


diff --git a/engines/parallaction/gui_br.cpp b/engines/parallaction/gui_br.cpp
index 54728544b0a..151efb1ae95 100644
--- a/engines/parallaction/gui_br.cpp
+++ b/engines/parallaction/gui_br.cpp
@@ -222,7 +222,6 @@ public:
 		}
 
 		case kMenuLoadGame:
-			warning("loadgame not yet implemented");
 			if (!_vm->_saveLoad->loadGame()) {
 				return this;
 			}
@@ -435,7 +434,6 @@ public:
 			break;
 
 		case 3:	// load
-			warning("Loading is not supported yet");
 			close = _vm->_saveLoad->loadGame();
 			break;
 
diff --git a/engines/parallaction/inventory.h b/engines/parallaction/inventory.h
index 651ab43170a..3ae8bcac423 100644
--- a/engines/parallaction/inventory.h
+++ b/engines/parallaction/inventory.h
@@ -77,6 +77,7 @@ public:
 	ItemPosition findItem(ItemName name) const;
 
 	int16	getNumItems() const { return _numItems; }
+	int		getMaxItems() const { return _maxItems; }
 };
 
 
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index de45c4fe2ee..951b124ddb6 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -187,12 +187,16 @@ public:
 
 
 class CharacterName {
+public:
+	static const uint kNameSize = 30;
+
+private:
 	const char *_prefix;
 	const char *_suffix;
 	bool _dummy;
-	char _name[30];
-	char _baseName[30];
-	char _fullName[30];
+	char _name[kNameSize];
+	char _baseName[kNameSize];
+	char _fullName[kNameSize];
 	static const char _prefixMini[];
 	static const char _suffixTras[];
 	static const char _empty[];
@@ -597,7 +601,9 @@ public:
 	bool hasFeature(EngineFeature f) const override;
 	Common::String getSaveStateName(int slot) const override;
 	bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
+	bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
 	Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override;
+	Common::Error loadGameStream(Common::SeekableReadStream *stream) override;
 
 public:
 	void parseLocation(const char* name) override;
diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp
index 0c5dd6a6441..1bf967f8511 100644
--- a/engines/parallaction/parallaction_br.cpp
+++ b/engines/parallaction/parallaction_br.cpp
@@ -19,6 +19,7 @@
  *
  */
 
+#include "common/config-manager.h"
 #include "common/system.h"
 #include "common/util.h"
 #include "common/textconsole.h"
@@ -60,6 +61,7 @@ Parallaction_br::Parallaction_br(OSystem* syst, const PARALLACTIONGameDescriptio
 
 bool Parallaction_br::hasFeature(EngineFeature f) const {
 	return Parallaction::hasFeature(f) ||
+		(f == kSupportsLoadingDuringRuntime) ||
 		(f == kSupportsSavingDuringRuntime);
 }
 
@@ -74,6 +76,10 @@ bool Parallaction_br::canSaveGameStateCurrently(Common::U32String *msg) {
 		!(g_engineFlags & (kEngineBlockInput | kEngineWalking | kEngineChangeLocation));
 }
 
+bool Parallaction_br::canLoadGameStateCurrently(Common::U32String *msg) {
+	return canSaveGameStateCurrently(msg);
+}
+
 Common::Error Parallaction_br::init() {
 
 	_screenWidth = 640;
@@ -175,6 +181,10 @@ bool Parallaction_br::processGameEvent(int event) {
 Common::Error Parallaction_br::go() {
 
 	bool splash = true;
+	int saveSlot = ConfMan.getInt("save_slot");
+	// the original loads only from its menus: characters without a pointer keep that one
+	if (saveSlot >= 0)
+		_input->setMenuPointer();
 
 	while (!shouldQuit()) {
 
@@ -182,12 +192,16 @@ Common::Error Parallaction_br::go() {
 			scheduleLocationSwitch("camalb");
 			_nextPart = 1;
 			_input->_inputMode = Input::kInputModeGame;
+		} else if (saveSlot >= 0 && loadGameState(saveSlot).getCode() == Common::kNoError) {
+			_input->_inputMode = Input::kInputModeGame;
+			splash = false;
 		} else {
 			_input->setMenuPointer();
 			startGui(splash);
 			 // don't show splash after first time
 			splash = false;
 		}
+		saveSlot = -1;
 
 //		initCharacter();
 
diff --git a/engines/parallaction/saveload.cpp b/engines/parallaction/saveload.cpp
index 811109f9197..279bf9be5a5 100644
--- a/engines/parallaction/saveload.cpp
+++ b/engines/parallaction/saveload.cpp
@@ -323,7 +323,25 @@ void SaveLoad_ns::renameOldSavefiles() {
 }
 
 void SaveLoad_br::doLoadGame(uint16 slot) {
-	// TODO: implement loadgame
+	_vm->loadGameState(slot);
+}
+
+// The menus stay open if the game was not loaded
+bool SaveLoad_br::loadGame() {
+	Common::String null;
+	int slot = selectSaveFile(null, false);
+	if (slot == -1) {
+		return false;
+	}
+
+	Common::Error result = _vm->loadGameState(slot);
+	if (result.getCode() != Common::kNoError) {
+		GUI::MessageDialog dialog(result.getDesc());
+		dialog.runModal();
+		return false;
+	}
+
+	return true;
 }
 
 void SaveLoad_br::doSaveGame(uint16 slot, const char* name) {
@@ -413,6 +431,141 @@ Common::Error Parallaction_br::saveGameStream(Common::WriteStream *stream, bool
 	return stream->err() ? Common::kWritingFailed : Common::kNoError;
 }
 
+// As restoregame_ in the original: reload the part, then the saved state
+Common::Error Parallaction_br::loadGameStream(Common::SeekableReadStream *stream) {
+	if (stream->readUint32LE() != kSavegameVersion)
+		return Common::Error(Common::kReadingFailed, "unknown savegame version");
+
+	int savedPart = stream->readSint32LE();
+	Common::String savedLocation = stream->readString();
+	Common::String savedCharacter = stream->readString();
+
+	Common::Point savedStartPosition;
+	savedStartPosition.x = stream->readSint16LE();
+	savedStartPosition.y = stream->readSint16LE();
+	int16 savedStartFrame = stream->readSint16LE();
+
+	Common::String savedFollowerName = stream->readString();
+	Common::Point savedFollowerPosition;
+	savedFollowerPosition.x = stream->readSint16LE();
+	savedFollowerPosition.y = stream->readSint16LE();
+	int16 savedFollowerFrame = stream->readSint16LE();
+
+	uint32 savedGlobalFlags = stream->readUint32LE();
+	uint16 savedNumLocations = stream->readUint16LE();
+
+	// the parts accepted by loadPart(); common.slf takes the first location slot,
+	// allocateLocationSlot() needs one for a new location and one for the terminator
+	bool validPart = (getFeatures() & GF_DEMO) ? (savedPart == 1) :
+		(savedPart >= 0 && savedPart <= 4);
+	bool validLocations = savedNumLocations > 0 && savedNumLocations < NUM_LOCATIONS - 1;
+	bool validCharacter = !savedCharacter.empty() &&
+		savedCharacter.size() < CharacterName::kNameSize;
+	if (!validPart || !validLocations || !validCharacter)
+		return Common::kReadingFailed;
+
+	// read everything before loadPart() clears the game state
+	Common::Array<Common::String> savedLocationNames;
+	Common::Array<uint32> savedLocalFlags;
+	bool locationFound = false;
+	for (uint i = 0; i < savedNumLocations; i++) {
+		savedLocationNames.push_back(stream->readString());
+		if (savedLocationNames[i].empty() ||
+			savedLocationNames[i].size() >= sizeof(_locationNames[i]))
+			return Common::kReadingFailed;
+		if (!scumm_stricmp(savedLocationNames[i].c_str(), savedLocation.c_str()))
+			locationFound = true;
+		savedLocalFlags.push_back(stream->readUint32LE());
+	}
+	if (!locationFound)
+		return Common::kReadingFailed;
+
+	Common::Array<uint32> savedZoneFlags;
+	for (uint i = 0; i < savedNumLocations * NUM_ZONES; i++)
+		savedZoneFlags.push_back(stream->readUint32LE());
+
+	int32 savedCounters[ARRAYSIZE(_counters)];
+	for (uint i = 0; i < ARRAYSIZE(savedCounters); i++)
+		savedCounters[i] = stream->readSint32LE();
+
+	Inventory *inventories[] = { _dinoInventory, _dougInventory, _donnaInventory };
+	int16 currentInventory = stream->readSint16LE();
+	if (currentInventory < kNoCurrentInventory || currentInventory >= (int16)ARRAYSIZE(inventories))
+		return Common::kReadingFailed;
+	// a character without its own inventory needs the current one
+	if (currentInventory == kNoCurrentInventory && !findInventory(savedCharacter.c_str()))
+		return Common::kReadingFailed;
+
+	Common::Array<InventoryItem> savedItems[ARRAYSIZE(inventories)];
+	for (uint i = 0; i < ARRAYSIZE(inventories); i++) {
+		int16 numItems = stream->readSint16LE();
+		if (numItems < 0 || numItems > inventories[i]->getMaxItems())
+			return Common::kReadingFailed;
+		for (int j = 0; j < numItems; j++) {
+			InventoryItem item;
+			item._id = stream->readUint32LE();
+			item._index = stream->readUint16LE();
+			savedItems[i].push_back(item);
+		}
+	}
+
+	if (stream->err() || stream->eos())
+		return Common::kReadingFailed;
+
+	_soundMan->execute(SC_SETMUSICFILE, "");
+	_soundManI->stopAllSfx();
+	loadPart(savedPart);
+
+	_location._startPosition = savedStartPosition;
+	_location._startFrame = savedStartFrame;
+
+	_followerName = savedFollowerName;
+	_location._followerStartPosition = savedFollowerPosition;
+	_location._followerStartFrame = savedFollowerFrame;
+
+	g_globalFlags = savedGlobalFlags;
+
+	_numLocations = savedNumLocations;
+	for (uint i = 0; i < _numLocations; i++) {
+		Common::strlcpy(_locationNames[i], savedLocationNames[i].c_str(),
+			sizeof(_locationNames[i]));
+		_localFlags[i] = savedLocalFlags[i];
+		for (uint j = 0; j < NUM_ZONES; j++)
+			_zoneFlags[i][j] = savedZoneFlags[i * NUM_ZONES + j];
+	}
+
+	memcpy(_counters, savedCounters, sizeof(_counters));
+
+	for (uint i = 0; i < ARRAYSIZE(inventories); i++) {
+		inventories[i]->clear(false);
+		for (uint j = 0; j < savedItems[i].size(); j++)
+			inventories[i]->addItem(savedItems[i][j]._index, savedItems[i][j]._id);
+	}
+
+	// changeCharacter() keeps it for characters without an inventory
+	_inventory = nullptr;
+	if (currentInventory != kNoCurrentInventory)
+		_inventory = inventories[currentInventory];
+	_inventoryRenderer->setInventory(_inventory);
+
+	changeCharacter(savedCharacter.c_str());
+	// changeLocation() sets the foot with the current frame
+	_char._ani->setF(savedStartFrame);
+
+	// the zones of common.slf stay loaded
+	ZoneList::iterator zit = _location._zones.begin();
+	for ( ; zit != _location._zones.end(); ++zit) {
+		restoreOrSaveZoneFlags(*zit, true);
+	}
+	AnimationList::iterator ait = _location._animations.begin();
+	for ( ; ait != _location._animations.end(); ++ait) {
+		restoreOrSaveZoneFlags(*ait, true);
+	}
+
+	scheduleLocationSwitch(savedLocation.c_str());
+	return Common::kNoError;
+}
+
 void SaveLoad_br::getGamePartProgress(bool *complete, int size) {
 	assert(complete && size >= 3);
 
diff --git a/engines/parallaction/saveload.h b/engines/parallaction/saveload.h
index be413c28fc7..8716e83617f 100644
--- a/engines/parallaction/saveload.h
+++ b/engines/parallaction/saveload.h
@@ -78,6 +78,8 @@ public:
 	SaveLoad_br(Parallaction_br *vm, Common::SaveFileManager *saveFileMan) :
 		SaveLoad(saveFileMan, "bra"), _vm(vm) { }
 
+	bool loadGame() override;
+
 	void getGamePartProgress(bool *complete, int size) override;
 	void setPartComplete(const char *part) override;
 };




More information about the Scummvm-git-logs mailing list