[Scummvm-git-logs] scummvm master -> 09fcfc016e8392e4d85bda298a3eb6474dd223a0

whiterandrek whiterandrek at gmail.com
Sat May 30 22:31:38 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:
be563013ba PETKA: fixed kOperationCircle
09fcfc016e PETKA: simplified kPlay opcode


Commit: be563013baa46826b235bd8e144607ca7a431dc1
    https://github.com/scummvm/scummvm/commit/be563013baa46826b235bd8e144607ca7a431dc1
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2020-05-31T01:30:35+03:00

Commit Message:
PETKA: fixed kOperationCircle

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


diff --git a/engines/petka/big_dialogue.cpp b/engines/petka/big_dialogue.cpp
index b91dda72e8..27e39d2358 100644
--- a/engines/petka/big_dialogue.cpp
+++ b/engines/petka/big_dialogue.cpp
@@ -127,16 +127,9 @@ const Common::U32String *BigDialogue::getSpeechInfo(int *talkerId, const char **
 		*talkerId = _speeches[index].speakerId;
 		return &_speeches[index].text;
 	}
-	case kOperationCircle: {
-		const uint current = _currOp->circle.curr;
-		_currOp += 1;
-		for (uint i = 0; i < current; ++i) {
-			while (_currOp->type != kOperationBreak)
-				_currOp += 1;
-			_currOp += 1;
-		}
+	case kOperationCircle:
+		circleMoveTo(_currOp->circle.curr);
 		assert(_currOp->type == kOperationPlay);
-	}
 		// fall through
 	case kOperationPlay:
 		if (soundName)
@@ -379,11 +372,7 @@ void BigDialogue::next(int choice) {
 			if (!processed)
 				return;
 			_currOp->circle.curr = (byte)((_currOp->circle.curr + 1) % _currOp->circle.count);
-			for (uint i = 0; i < _currOp->circle.count; ++i) {
-				while (_currOp->type != kOperationBreak)
-					_currOp += 1;
-				_currOp += 1;
-			}
+			circleMoveTo(_currOp->circle.count);
 			processed = false;
 			break;
 		case kOperationUserMessage:
@@ -477,4 +466,13 @@ void BigDialogue::getMenuChoices(Common::Array<Common::U32String> &choices) {
 	}
 }
 
+void BigDialogue::circleMoveTo(byte index) {
+	_currOp += 1;
+	for (uint i = 0; i < index; ++i) {
+		while (_currOp->type != kOperationBreak)
+			_currOp += 1;
+		_currOp += 1;
+	}
+}
+
 } // End of namespace Petka
diff --git a/engines/petka/big_dialogue.h b/engines/petka/big_dialogue.h
index 991edda6e3..199b1f6cdd 100644
--- a/engines/petka/big_dialogue.h
+++ b/engines/petka/big_dialogue.h
@@ -125,6 +125,7 @@ private:
 	void loadSpeechesInfo();
 	bool checkMenu(uint opIndex);
 	bool findOperation(uint startOpIndex, uint opType, uint *resIndex);
+	void circleMoveTo(byte index);
 
 private:
 	Operation *_currOp;


Commit: 09fcfc016e8392e4d85bda298a3eb6474dd223a0
    https://github.com/scummvm/scummvm/commit/09fcfc016e8392e4d85bda298a3eb6474dd223a0
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2020-05-31T01:30:35+03:00

Commit Message:
PETKA: simplified kPlay opcode

Changed paths:
    engines/petka/objects/heroes.cpp
    engines/petka/objects/object.cpp
    engines/petka/objects/object.h


diff --git a/engines/petka/objects/heroes.cpp b/engines/petka/objects/heroes.cpp
index 2530e0c0c9..c186cee354 100644
--- a/engines/petka/objects/heroes.cpp
+++ b/engines/petka/objects/heroes.cpp
@@ -133,8 +133,8 @@ void QObjectPetka::draw() {
 
 	if (_animate && _startSound) {
 		if (_sound) {
-			_sound->play(!_notLoopedSound);
-			if (!_notLoopedSound) {
+			_sound->play(_loopedSound);
+			if (_loopedSound) {
 				_sound = nullptr;
 			}
 		}
diff --git a/engines/petka/objects/object.cpp b/engines/petka/objects/object.cpp
index e1d3e2361d..36073f5076 100644
--- a/engines/petka/objects/object.cpp
+++ b/engines/petka/objects/object.cpp
@@ -64,7 +64,7 @@ QMessageObject::QMessageObject() {
 	_isActive = true;
 	_updateZ = false;
 	_holdMessages = false;
-	_notLoopedSound = true;
+	_loopedSound = false;
 	_startSound = false;
 	_reaction = nullptr;
 }
@@ -329,38 +329,27 @@ void QMessageObject::processReaction(QReaction *r, const QMessage *msg) {
 void QMessageObject::play(int id, int type) {
 	if (g_vm->getQSystem()->_totalInit) {
 		_resourceId = id;
-	} else {
-		if (!_notLoopedSound || g_vm->isDemo()) {
-			removeSound();
-		}
+		_loopedSound = (type == 5);
+		return;
+	}
 
-		FlicDecoder *flc = g_vm->resMgr()->loadFlic(_resourceId);
-		if (flc) {
-			g_vm->videoSystem()->addDirtyRect(Common::Point(_x, _y), *flc);
-		}
+	if (_loopedSound || g_vm->isDemo()) {
+		removeSound();
+	}
 
-		_resourceId = id;
+	FlicDecoder *flc = g_vm->resMgr()->loadFlic(_resourceId);
+	if (flc) {
+		g_vm->videoSystem()->addDirtyRect(Common::Point(_x, _y), *flc);
+	}
 
-		loadSound();
+	_resourceId = id;
 
-		flc = g_vm->resMgr()->loadFlic(id);
-		flc->setFrame(1);
-		_time = 0;
-	}
-	switch (type) {
-	case 1: {
-		FlicDecoder *flc = g_vm->resMgr()->loadFlic(_resourceId);
-		flc->setFrame(1);
-		g_vm->videoSystem()->makeAllDirty();
-		break;
-	}
-	case 2:
-		g_vm->resMgr()->loadFlic(_resourceId);
-		break;
-	default:
-		break;
-	}
-	_notLoopedSound = type != 5;
+	loadSound();
+
+	flc = g_vm->resMgr()->loadFlic(id);
+	flc->setFrame(1);
+	_time = 0;
+	_loopedSound = (type == 5);
 }
 
 void QMessageObject::loadSound() {
@@ -402,6 +391,11 @@ void QMessageObject::readScriptData(Common::SeekableReadStream &stream) {
 			msg->arg1 = stream.readUint16LE();
 			msg->arg2 = stream.readUint16LE();
 			msg->arg3 = stream.readUint16LE();
+			if (msg->opcode == kPlay || msg->opcode == kSet) {
+				if (msg->arg2 != 1 && msg->arg2 != -1 && msg->arg2 != 5) {
+					debug("MSG PLAY 2 5");
+				}
+			}
 		}
 	}
 }
@@ -457,8 +451,8 @@ void QObject::draw() {
 	}
 	if (_animate && _startSound) {
 		if (_sound) {
-			_sound->play(!_notLoopedSound);
-			if (!_notLoopedSound) {
+			_sound->play(_loopedSound);
+			if (_loopedSound) {
 				_sound = nullptr;
 			}
 		}
diff --git a/engines/petka/objects/object.h b/engines/petka/objects/object.h
index 9ff3229cbe..a55001c1f2 100644
--- a/engines/petka/objects/object.h
+++ b/engines/petka/objects/object.h
@@ -85,7 +85,7 @@ public:
 	bool _holdMessages;
 	bool _isActive;
 	bool _startSound;
-	bool _notLoopedSound;
+	bool _loopedSound;
 	Sound *_sound;
 	int8 _status;
 	uint16 _id;




More information about the Scummvm-git-logs mailing list