[Scummvm-git-logs] scummvm master -> 1474d02f25cb11e49b5c6769d870bbaa9be165e6

bluegr bluegr at gmail.com
Sun Jun 27 08:59:50 UTC 2021


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

Summary:
4615b62d22 PARALLACTION: allow changing the inventory drawn by the renderer.
30476902ec PARALLACTION: name BRA inventories after the characters.
6e3cc6915d PARALLACTION: add helper to select inventory in BRA.
f8f61fd4dd PARALLACTION: select inventory when changing character.
f1ea51c9bb PARALLACTION: cleanInventory is game specific.
bfb795b66e PARALLACTION: make BRA findInventory public.
1474d02f25 PARALLACTION: implement most of BRA 'swap' command.


Commit: 4615b62d22c0cd0dbe651b4dba98e711bd3c985c
    https://github.com/scummvm/scummvm/commit/4615b62d22c0cd0dbe651b4dba98e711bd3c985c
Author: peres (peres at scummvm.org)
Date: 2021-06-27T11:59:43+03:00

Commit Message:
PARALLACTION: allow changing the inventory drawn by the renderer.

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


diff --git a/engines/parallaction/inventory.cpp b/engines/parallaction/inventory.cpp
index fcac9f08e2..683b464763 100644
--- a/engines/parallaction/inventory.cpp
+++ b/engines/parallaction/inventory.cpp
@@ -137,7 +137,7 @@ void Parallaction::closeInventory() {
 
 
 
-InventoryRenderer::InventoryRenderer(Parallaction *vm, InventoryProperties *props, Inventory *inv) : _vm(vm), _props(props), _inv(inv) {
+InventoryRenderer::InventoryRenderer(Parallaction *vm, InventoryProperties *props) : _vm(vm), _props(props) {
 	_surf.create(_props->_width, _props->_height, Graphics::PixelFormat::createFormatCLUT8());
 }
 
@@ -145,6 +145,10 @@ InventoryRenderer::~InventoryRenderer() {
 	_surf.free();
 }
 
+void InventoryRenderer::setInventory(Inventory *inventory) {
+	_inv = inventory;
+}
+
 void InventoryRenderer::showInventory() {
 	if (!_inv)
 		error("InventoryRenderer not bound to inventory");
@@ -338,15 +342,17 @@ const InventoryItem* Inventory::getItem(ItemPosition pos) const {
 void Parallaction_ns::initInventory() {
 	_inventory = new Inventory(_invProps_NS._maxItems, _verbs_NS);
 	assert(_inventory);
-	_inventoryRenderer = new InventoryRenderer(this, &_invProps_NS, _inventory);
+	_inventoryRenderer = new InventoryRenderer(this, &_invProps_NS);
 	assert(_inventoryRenderer);
+	_inventoryRenderer->setInventory(_inventory);
 }
 
 void Parallaction_br::initInventory() {
 	_inventory = new Inventory(_invProps_BR._maxItems, _verbs_BR);
 	assert(_inventory);
-	_inventoryRenderer = new InventoryRenderer(this, &_invProps_BR, _inventory);
+	_inventoryRenderer = new InventoryRenderer(this, &_invProps_BR);
 	assert(_inventoryRenderer);
+	_inventoryRenderer->setInventory(_inventory);
 
 	_charInventories[0] = new Inventory(_invProps_BR._maxItems, _verbs_BR);
 	_charInventories[1] = new Inventory(_invProps_BR._maxItems, _verbs_BR);
diff --git a/engines/parallaction/inventory.h b/engines/parallaction/inventory.h
index 832bd7bf36..cc75c45bd9 100644
--- a/engines/parallaction/inventory.h
+++ b/engines/parallaction/inventory.h
@@ -98,9 +98,11 @@ protected:
 	void refresh();
 
 public:
-	InventoryRenderer(Parallaction *vm, InventoryProperties *props, Inventory *inv);
+	InventoryRenderer(Parallaction *vm, InventoryProperties *props);
 	virtual ~InventoryRenderer();
 
+	void setInventory(Inventory *inventory);
+
 	void showInventory();
 	void hideInventory();
 


Commit: 30476902ecee1ed8535af78d341e4d6d6a6d8581
    https://github.com/scummvm/scummvm/commit/30476902ecee1ed8535af78d341e4d6d6a6d8581
Author: peres (peres at scummvm.org)
Date: 2021-06-27T11:59:43+03:00

Commit Message:
PARALLACTION: name BRA inventories after the characters.

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


diff --git a/engines/parallaction/inventory.cpp b/engines/parallaction/inventory.cpp
index 683b464763..8ec2430c39 100644
--- a/engines/parallaction/inventory.cpp
+++ b/engines/parallaction/inventory.cpp
@@ -354,9 +354,9 @@ void Parallaction_br::initInventory() {
 	assert(_inventoryRenderer);
 	_inventoryRenderer->setInventory(_inventory);
 
-	_charInventories[0] = new Inventory(_invProps_BR._maxItems, _verbs_BR);
-	_charInventories[1] = new Inventory(_invProps_BR._maxItems, _verbs_BR);
-	_charInventories[2] = new Inventory(_invProps_BR._maxItems, _verbs_BR);
+	_dinoInventory = new Inventory(_invProps_BR._maxItems, _verbs_BR);
+	_donnaInventory = new Inventory(_invProps_BR._maxItems, _verbs_BR);
+	_dougInventory = new Inventory(_invProps_BR._maxItems, _verbs_BR);
 }
 
 void Parallaction_ns::destroyInventory() {
@@ -372,12 +372,12 @@ void Parallaction_br::destroyInventory() {
 	_inventory = 0;
 	_inventoryRenderer = 0;
 
-	delete _charInventories[0];
-	delete _charInventories[1];
-	delete _charInventories[2];
-	_charInventories[0] = 0;
-	_charInventories[1] = 0;
-	_charInventories[2] = 0;
+	delete _dinoInventory;
+	delete _donnaInventory;
+	delete _dougInventory;
+	_dinoInventory = 0;
+	_donnaInventory = 0;
+	_dougInventory = 0;
 }
 
 
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index 694007bfe2..c81e6f369d 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -547,7 +547,9 @@ private:
 	LocationParser_br		*_locationParser;
 	ProgramParser_br		*_programParser;
 	SoundMan_br				*_soundManI;
-	Inventory				*_charInventories[3];	// all the inventories
+	Inventory				*_dinoInventory;
+	Inventory				*_donnaInventory;
+	Inventory				*_dougInventory;
 
 	int32		_counters[32];
 	Table		*_countersNames;
diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp
index 0662894623..31db37fba7 100644
--- a/engines/parallaction/parallaction_br.cpp
+++ b/engines/parallaction/parallaction_br.cpp
@@ -51,9 +51,6 @@ Parallaction_br::Parallaction_br(OSystem* syst, const PARALLACTIONGameDescriptio
 	_subtitleY = 0;
 	_subtitle[0] = 0;
 	_subtitle[1] = 0;
-	_charInventories[0] = 0;
-	_charInventories[1] = 0;
-	_charInventories[2] = 0;
 	_countersNames = 0;
 	_callables = 0;
 	_walker = 0;


Commit: 6e3cc6915d5f57f6bb213ce6bf7eb8167904dc5d
    https://github.com/scummvm/scummvm/commit/6e3cc6915d5f57f6bb213ce6bf7eb8167904dc5d
Author: peres (peres at scummvm.org)
Date: 2021-06-27T11:59:43+03:00

Commit Message:
PARALLACTION: add helper to select inventory in BRA.

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


diff --git a/engines/parallaction/inventory.cpp b/engines/parallaction/inventory.cpp
index 8ec2430c39..547b4201d4 100644
--- a/engines/parallaction/inventory.cpp
+++ b/engines/parallaction/inventory.cpp
@@ -134,8 +134,18 @@ void Parallaction::closeInventory() {
 	_inventoryRenderer->hideInventory();
 }
 
-
-
+Inventory *Parallaction_br::findInventory(const char *name) {
+	if (!scumm_stricmp(name, "dino")) {
+		return _dinoInventory;
+	}
+	if (!scumm_stricmp(name, "donna")) {
+		return _donnaInventory;
+	}
+	if (!scumm_stricmp(name, "doug")) {
+		return _dougInventory;
+	}
+	return 0;
+}
 
 InventoryRenderer::InventoryRenderer(Parallaction *vm, InventoryProperties *props) : _vm(vm), _props(props) {
 	_surf.create(_props->_width, _props->_height, Graphics::PixelFormat::createFormatCLUT8());
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index c81e6f369d..c7b6ce7ee3 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -558,6 +558,7 @@ private:
 	void	initResources();
 	void	initInventory();
 	void	destroyInventory();
+	Inventory *findInventory(const char *name);
 	void	setupBalloonManager();
 	void	initFonts();
 	void	freeFonts();


Commit: f8f61fd4dd28b448e0abefb4f984e207f780f810
    https://github.com/scummvm/scummvm/commit/f8f61fd4dd28b448e0abefb4f984e207f780f810
Author: peres (peres at scummvm.org)
Date: 2021-06-27T11:59:43+03:00

Commit Message:
PARALLACTION: select inventory when changing character.

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


diff --git a/engines/parallaction/inventory.cpp b/engines/parallaction/inventory.cpp
index 547b4201d4..862d3545ef 100644
--- a/engines/parallaction/inventory.cpp
+++ b/engines/parallaction/inventory.cpp
@@ -358,11 +358,8 @@ void Parallaction_ns::initInventory() {
 }
 
 void Parallaction_br::initInventory() {
-	_inventory = new Inventory(_invProps_BR._maxItems, _verbs_BR);
-	assert(_inventory);
 	_inventoryRenderer = new InventoryRenderer(this, &_invProps_BR);
 	assert(_inventoryRenderer);
-	_inventoryRenderer->setInventory(_inventory);
 
 	_dinoInventory = new Inventory(_invProps_BR._maxItems, _verbs_BR);
 	_donnaInventory = new Inventory(_invProps_BR._maxItems, _verbs_BR);
@@ -378,7 +375,6 @@ void Parallaction_ns::destroyInventory() {
 
 void Parallaction_br::destroyInventory() {
 	delete _inventoryRenderer;
-	delete _inventory;
 	_inventory = 0;
 	_inventoryRenderer = 0;
 
diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp
index 31db37fba7..f5e06d96ee 100644
--- a/engines/parallaction/parallaction_br.cpp
+++ b/engines/parallaction/parallaction_br.cpp
@@ -471,10 +471,8 @@ void Parallaction_br::changeCharacter(const char *name) {
 		_char._ani->gfxobj = _gfx->loadCharacterAnim(name);
 		_char._talk = _disk->loadTalk(name);
 
-		/* TODO: adjust inventories as following
-		 * 1) if not on game load, then copy _inventory to the right slot of _charInventories
-		 * 2) copy the new inventory from the right slot of _charInventories
-		 */
+		_inventory = findInventory(name);
+		_inventoryRenderer->setInventory(_inventory);
 	}
 
 	_char._ani->_flags |= kFlagsActive;


Commit: f1ea51c9bbdaf93343c1a0942c8592ebaf64f86d
    https://github.com/scummvm/scummvm/commit/f1ea51c9bbdaf93343c1a0942c8592ebaf64f86d
Author: peres (peres at scummvm.org)
Date: 2021-06-27T11:59:43+03:00

Commit Message:
PARALLACTION: cleanInventory is game specific.

Changed paths:
    engines/parallaction/callables_ns.cpp
    engines/parallaction/inventory.cpp
    engines/parallaction/parallaction.h


diff --git a/engines/parallaction/callables_ns.cpp b/engines/parallaction/callables_ns.cpp
index 66e3fd6fd9..a75c5146a3 100644
--- a/engines/parallaction/callables_ns.cpp
+++ b/engines/parallaction/callables_ns.cpp
@@ -377,7 +377,7 @@ void Parallaction_ns::_c_finito(void *parm) {
 
 	_saveLoad->setPartComplete(_char.getBaseName());
 
-	cleanInventory();
+	cleanInventory(true);
 	cleanupGame();
 
 	_gfx->setPalette(_gfx->_palette);
diff --git a/engines/parallaction/inventory.cpp b/engines/parallaction/inventory.cpp
index 862d3545ef..1bb96a26be 100644
--- a/engines/parallaction/inventory.cpp
+++ b/engines/parallaction/inventory.cpp
@@ -122,10 +122,16 @@ int16 Parallaction::getInventoryItemIndex(int16 pos) {
 	return _inventory->getItemName(pos);
 }
 
-void Parallaction::cleanInventory(bool keepVerbs) {
+void Parallaction_ns::cleanInventory(bool keepVerbs) {
 	_inventory->clear(keepVerbs);
 }
 
+void Parallaction_br::cleanInventory(bool keepVerbs) {
+	_dinoInventory->clear(keepVerbs);
+	_donnaInventory->clear(keepVerbs);
+	_dougInventory->clear(keepVerbs);
+}
+
 void Parallaction::openInventory() {
 	_inventoryRenderer->showInventory();
 }
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index c7b6ce7ee3..4542c95d70 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -358,7 +358,6 @@ public:
 	bool		isItemInInventory(int32 v);
 	const		InventoryItem* getInventoryItem(int16 pos);
 	int16		getInventoryItemIndex(int16 pos);
-	void		cleanInventory(bool keepVerbs = true);
 	void		openInventory();
 	void		closeInventory();
 
@@ -403,7 +402,7 @@ public:
 	void scheduleWalk(int16 x, int16 y, bool fromUser) override;
 	DialogueManager *createDialogueManager(ZonePtr z) override;
 	bool processGameEvent(int event) override;
-
+	void cleanInventory(bool keepVerbs);
 	void	changeBackground(const char *background, const char *mask = 0, const char *path = 0);
 
 private:
@@ -559,6 +558,7 @@ private:
 	void	initInventory();
 	void	destroyInventory();
 	Inventory *findInventory(const char *name);
+	void	cleanInventory(bool keepVerbs);
 	void	setupBalloonManager();
 	void	initFonts();
 	void	freeFonts();


Commit: bfb795b66e7d6a50b2f9d450f77a5462e6f40490
    https://github.com/scummvm/scummvm/commit/bfb795b66e7d6a50b2f9d450f77a5462e6f40490
Author: peres (peres at scummvm.org)
Date: 2021-06-27T11:59:43+03:00

Commit Message:
PARALLACTION: make BRA findInventory public.

Changed paths:
    engines/parallaction/parallaction.h


diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index 4542c95d70..c05e2dfb89 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -511,6 +511,8 @@ public:
 	void setupSubtitles(const char *s, const char *s2, int y);
 	void clearSubtitles();
 
+	Inventory *findInventory(const char *name);
+
 	void testCounterCondition(const Common::String &name, int op, int value);
 	void restoreOrSaveZoneFlags(ZonePtr z, bool restore);
 
@@ -541,7 +543,6 @@ public:
 	ZonePtr		_activeZone2;
 	uint32		_zoneFlags[NUM_LOCATIONS][NUM_ZONES];
 
-
 private:
 	LocationParser_br		*_locationParser;
 	ProgramParser_br		*_programParser;
@@ -557,7 +558,7 @@ private:
 	void	initResources();
 	void	initInventory();
 	void	destroyInventory();
-	Inventory *findInventory(const char *name);
+
 	void	cleanInventory(bool keepVerbs);
 	void	setupBalloonManager();
 	void	initFonts();


Commit: 1474d02f25cb11e49b5c6769d870bbaa9be165e6
    https://github.com/scummvm/scummvm/commit/1474d02f25cb11e49b5c6769d870bbaa9be165e6
Author: peres (peres at scummvm.org)
Date: 2021-06-27T11:59:43+03:00

Commit Message:
PARALLACTION: implement most of BRA 'swap' command.

I left out follower adjustments (need to find where it's used),
and mouse pointer swap.

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


diff --git a/engines/parallaction/exec_br.cpp b/engines/parallaction/exec_br.cpp
index 0fd2ed37ab..c51ab2ecf9 100644
--- a/engines/parallaction/exec_br.cpp
+++ b/engines/parallaction/exec_br.cpp
@@ -272,7 +272,29 @@ DECLARE_COMMAND_OPCODE(scroll) {
 
 
 DECLARE_COMMAND_OPCODE(swap) {
-	warning("Parallaction_br::cmdOp_swap not yet implemented");
+	warning("Parallaction_br::cmdOp_swap does not handle a follower yet");
+
+	/*
+		TODO:
+		- fixup follower
+		- change mouse pointer
+	*/
+
+	const char *newCharacterName = ctxt._cmd->_string.c_str();
+	AnimationPtr newCharacterAnimation = _vm->_location.findAnimation(newCharacterName);
+	AnimationPtr oldCharaterAnimation = _vm->_char._ani;
+
+	strlcpy(oldCharaterAnimation->_name, _vm->_char.getName(), ZONENAME_LENGTH);
+	_vm->_char.setName(newCharacterName);
+
+	_vm->_char._ani = newCharacterAnimation;
+	_vm->_char._talk = _vm->_disk->loadTalk(newCharacterName);
+	strlcpy(_vm->_char._ani->_name, "yourself", ZONENAME_LENGTH);
+
+	_vm->linkUnlinkedZoneAnimations();
+
+	_vm->_inventory = _vm->findInventory(newCharacterName);
+	_vm->_inventoryRenderer->setInventory(_vm->_inventory);
 }
 
 
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index c05e2dfb89..f0c134ce89 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -512,6 +512,7 @@ public:
 	void clearSubtitles();
 
 	Inventory *findInventory(const char *name);
+	void linkUnlinkedZoneAnimations();
 
 	void testCounterCondition(const Common::String &name, int op, int value);
 	void restoreOrSaveZoneFlags(ZonePtr z, bool restore);
diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp
index f5e06d96ee..a2095498c9 100644
--- a/engines/parallaction/parallaction_br.cpp
+++ b/engines/parallaction/parallaction_br.cpp
@@ -456,7 +456,14 @@ void Parallaction_br::loadProgram(AnimationPtr a, const char *filename) {
 	return;
 }
 
-
+void Parallaction_br::linkUnlinkedZoneAnimations() {
+	ZoneList::iterator zit = _location._zones.begin();
+	for ( ; zit != _location._zones.end(); ++zit) {
+		if ((*zit)->_flags & kFlagsActive) {
+			(*zit)->_linkedAnim = _location.findAnimation((*zit)->_linkedName.c_str());
+		}
+	}
+}
 
 void Parallaction_br::changeCharacter(const char *name) {
 




More information about the Scummvm-git-logs mailing list