[Scummvm-git-logs] scummvm master -> b4b46779d48011b930ffb697f90731dea7cb118e

whiterandrek whiterandrek at gmail.com
Fri Jun 5 17:57:48 UTC 2020


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

Summary:
a36e9c6970 PETKA: added Engine field to QSystem
b4b46779d4 PETKA: removed usage of g_vm in Engine methods


Commit: a36e9c6970b2beb7e08fc45d16b7d1f266d992b6
    https://github.com/scummvm/scummvm/commit/a36e9c6970b2beb7e08fc45d16b7d1f266d992b6
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2020-06-05T20:55:55+03:00

Commit Message:
PETKA: added Engine field to QSystem

Changed paths:
    engines/petka/petka.cpp
    engines/petka/q_system.cpp
    engines/petka/q_system.h


diff --git a/engines/petka/petka.cpp b/engines/petka/petka.cpp
index 5e9dba76d0..e2d2051433 100644
--- a/engines/petka/petka.cpp
+++ b/engines/petka/petka.cpp
@@ -238,7 +238,7 @@ void PetkaEngine::loadPart(byte part) {
 	_resMgr.reset(new QManager(*this));
 	_resMgr->init();
 	_dialogMan.reset(new BigDialogue(*this));
-	_qsystem.reset(new QSystem());
+	_qsystem.reset(new QSystem(*this));
 	_qsystem->init();
 }
 
diff --git a/engines/petka/q_system.cpp b/engines/petka/q_system.cpp
index 3601889808..4a47530f3b 100644
--- a/engines/petka/q_system.cpp
+++ b/engines/petka/q_system.cpp
@@ -43,8 +43,8 @@
 
 namespace Petka {
 
-QSystem::QSystem()
-	: _mainInterface(nullptr), _currInterface(nullptr), _prevInterface(nullptr),
+QSystem::QSystem(PetkaEngine &vm)
+	: _vm(vm), _mainInterface(nullptr), _currInterface(nullptr), _prevInterface(nullptr),
 	_totalInit(false), _sceneWidth(640) {}
 
 QSystem::~QSystem() {
@@ -54,12 +54,12 @@ QSystem::~QSystem() {
 }
 
 bool QSystem::init() {
-	Common::ScopedPtr<Common::SeekableReadStream> stream(g_vm->openFile("script.dat", true));
+	Common::ScopedPtr<Common::SeekableReadStream> stream(_vm.openFile("script.dat", true));
 	if (!stream)
 		return false;
-	Common::ScopedPtr<Common::SeekableReadStream> namesStream(g_vm->openFile("Names.ini", true));
-	Common::ScopedPtr<Common::SeekableReadStream> castStream(g_vm->openFile("Cast.ini", true));
-	Common::ScopedPtr<Common::SeekableReadStream> bgsStream(g_vm->openFile("BGs.ini", true));
+	Common::ScopedPtr<Common::SeekableReadStream> namesStream(_vm.openFile("Names.ini", true));
+	Common::ScopedPtr<Common::SeekableReadStream> castStream(_vm.openFile("Cast.ini", true));
+	Common::ScopedPtr<Common::SeekableReadStream> bgsStream(_vm.openFile("BGs.ini", true));
 
 	Common::INIFile namesIni;
 	Common::INIFile castIni;
@@ -106,7 +106,7 @@ bool QSystem::init() {
 	_panelInterface.reset(new InterfacePanel());
 	_mapInterface.reset(new InterfaceMap());
 
-	if (g_vm->getPart() == 0) {
+	if (_vm.getPart() == 0) {
 		_prevInterface = _currInterface = _startupInterface.get();
 	} else {
 		_prevInterface = _currInterface = _mainInterface.get();
@@ -237,7 +237,7 @@ void QSystem::load(Common::ReadStream *s) {
 		_mainInterface->loadRoom(_room->_id, true);
 	}
 
-	g_vm->getBigDialogue()->load(s);
+	_vm.getBigDialogue()->load(s);
 
 	QObjectCursor *cursor = getCursor();
 	cursor->_resourceId = s->readUint32LE();
@@ -249,7 +249,7 @@ void QSystem::load(Common::ReadStream *s) {
 		cursor->_invObj = nullptr;
 	}
 
-	g_vm->videoSystem()->makeAllDirty();
+	_vm.videoSystem()->makeAllDirty();
 }
 
 void QSystem::save(Common::WriteStream *s) {
@@ -277,7 +277,7 @@ void QSystem::save(Common::WriteStream *s) {
 
 	// heroes (no impl)
 
-	g_vm->getBigDialogue()->save(s);
+	_vm.getBigDialogue()->save(s);
 
 	QObjectCursor *cursor = getCursor();
 	s->writeUint32LE(cursor->_resourceId);
@@ -382,11 +382,11 @@ void QSystem::onEvent(const Common::Event &event) {
 #if 1
 		case Common::KEYCODE_RIGHT:
 			_xOffset += 6;
-			g_vm->videoSystem()->makeAllDirty();
+			_vm.videoSystem()->makeAllDirty();
 			break;
 		case Common::KEYCODE_LEFT:
 			_xOffset -= 6;
-			g_vm->videoSystem()->makeAllDirty();
+			_vm.videoSystem()->makeAllDirty();
 			break;
 #endif
 		default:
diff --git a/engines/petka/q_system.h b/engines/petka/q_system.h
index 9fe98561f8..c1979ad297 100644
--- a/engines/petka/q_system.h
+++ b/engines/petka/q_system.h
@@ -50,7 +50,7 @@ class Interface;
 
 class QSystem {
 public:
-	explicit QSystem();
+	QSystem(PetkaEngine &vm);
 	~QSystem();
 
 	bool init();
@@ -85,6 +85,8 @@ public:
 	void onEvent(const Common::Event &event);
 
 public:
+	PetkaEngine &_vm;
+
 	Common::Array<QMessageObject *> _allObjects;
 	Common::List<QMessage> _messages;
 	Common::ScopedPtr<InterfaceMain> _mainInterface;


Commit: b4b46779d48011b930ffb697f90731dea7cb118e
    https://github.com/scummvm/scummvm/commit/b4b46779d48011b930ffb697f90731dea7cb118e
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2020-06-05T20:57:07+03:00

Commit Message:
PETKA: removed usage of g_vm in Engine methods

Changed paths:
    engines/petka/petka.cpp


diff --git a/engines/petka/petka.cpp b/engines/petka/petka.cpp
index e2d2051433..44e4fd84e8 100644
--- a/engines/petka/petka.cpp
+++ b/engines/petka/petka.cpp
@@ -266,8 +266,8 @@ void PetkaEngine::loadChapter(byte chapter) {
 
 	_fileMgr->openStore(_chapterStoreName);
 
-	Common::ScopedPtr<Common::SeekableReadStream> namesStream(g_vm->openFile("Names.ini", true));
-	Common::ScopedPtr<Common::SeekableReadStream> castStream(g_vm->openFile("Cast.ini", true));
+	Common::ScopedPtr<Common::SeekableReadStream> namesStream(openFile("Names.ini", true));
+	Common::ScopedPtr<Common::SeekableReadStream> castStream(openFile("Cast.ini", true));
 
 	Common::INIFile namesIni;
 	Common::INIFile castIni;




More information about the Scummvm-git-logs mailing list