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

yuv422 yuv422 at users.noreply.github.com
Sat Feb 29 01:40:27 UTC 2020


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

Summary:
b5f14e5809 DRAGONS: General fixups


Commit: b5f14e58092131f00b194a45c55ed1a078feb762
    https://github.com/scummvm/scummvm/commit/b5f14e58092131f00b194a45c55ed1a078feb762
Author: Eric Fry (yuv422 at users.noreply.github.com)
Date: 2020-02-29T12:39:40+11:00

Commit Message:
DRAGONS: General fixups
- Fixed lockup bugs when walking in cutscenes
- Alow the cursor to move during Flicker's idle animation
- General code cleanup

Changed paths:
    engines/dragons/actor.cpp
    engines/dragons/actor.h
    engines/dragons/cutscene.cpp
    engines/dragons/cutscene.h
    engines/dragons/dragons.cpp
    engines/dragons/font.cpp
    engines/dragons/scriptopcodes.cpp
    engines/dragons/specialopcodes.cpp
    engines/dragons/talk.cpp
    engines/dragons/talk.h


diff --git a/engines/dragons/actor.cpp b/engines/dragons/actor.cpp
index c1ad563616..37d0e703f8 100644
--- a/engines/dragons/actor.cpp
+++ b/engines/dragons/actor.cpp
@@ -791,4 +791,11 @@ int16 Actor::getFrameYOffset() {
 	return _frame ? _frame->yOffset : 0;
 }
 
+void Actor::waitForWalkToFinish() {
+	DragonsEngine *vm = getEngine();
+	do {
+		vm->waitForFrames(1);
+	} while (isFlagSet(ACTOR_FLAG_10));
+}
+
 } // End of namespace Dragons
diff --git a/engines/dragons/actor.h b/engines/dragons/actor.h
index 74f7451950..a6dac1f768 100644
--- a/engines/dragons/actor.h
+++ b/engines/dragons/actor.h
@@ -131,6 +131,7 @@ public:
 	void waitUntilFlag8And4AreSet();
 	void waitUntilFlag8SetThenSet1000();
 	void waitUntilFlag8SetThenSet1000AndWaitFor4();
+	void waitForWalkToFinish();
 
 	bool waitUntilFlag4IsSetAllowSkip();
 	bool actorSetSequenceAndWaitAllowSkip(uint16 newSequenceID);
diff --git a/engines/dragons/cutscene.cpp b/engines/dragons/cutscene.cpp
index b2f08b6c3e..248044fc97 100644
--- a/engines/dragons/cutscene.cpp
+++ b/engines/dragons/cutscene.cpp
@@ -258,9 +258,7 @@ void CutScene::scene1() {
 																									_vm->waitForFramesAllowSkip(0xe);
 																									// call_fade_related_1f();
 																									_actor_80072df0->startWalk(0xe8, 0xa8, 2);
-																									while (_actor_80072df0->isFlagSet(ACTOR_FLAG_10)) {
-																										_vm->waitForFrames(1);
-																									}
+																									_actor_80072df0->waitForWalkToFinish();
 																									_actor_80072de8->startWalk(0x97, 0x37, 2);
 																									_actor_80072dec->startWalk(0x97, 0x37, 2);
 																									_actor_80072df4->startWalk(0x97, 0x37, 2);
@@ -276,15 +274,7 @@ void CutScene::scene1() {
 																									_actor_80072df0->_y_pos = 0x90;
 																									_actor_80072df0->startWalk(0x97, 0x37, 2);
 																									_actor_80072df0->updateSequence(7);
-//TODO
-//																									if (((_actor_8008e7e8 != 0) || (_actor_8008e848 != 0))
-//																										|| ((_actor_8008e844 != 0 || (_actor_8008e874 != 0)))
-//																											) {
-//																										clearTextDialog((uint)_actor_8008e7e8,
-//																													 (uint)_actor_8008e844,
-//																													 (uint)_actor_8008e848,
-//																													 (uint)_actor_8008e874);
-//																									}
+																									_vm->_talk->FUN_8001a7c4_clearDialogBoxMaybe();
 
 																									dialog[0] = 0;
 																									_vm->_talk->loadText(0x5ecc, dialog, 2000);
@@ -314,6 +304,7 @@ void CutScene::scene1() {
 			}
 		}
 	}
+	_vm->_talk->FUN_8001a7c4_clearDialogBoxMaybe();
 	// fade_related_calls_with_1f();
 	_vm->clearFlags(ENGINE_FLAG_20000);
 	// DisableVSyncEvent();
@@ -382,7 +373,7 @@ void CutScene::fun_8003d388() {
 		_actor_80072dfc = _vm->_actorManager->loadActor(0x7e, 0x12, 0xcd, 0x8e, 1);
 	}
 	if ((_actor_80063514 & 1) == 0) {
-		_actor_80072e04 = _vm->_actorManager->loadActor(0x7e, 0x19, 0x10e, 0x89, 1);
+		_flameActor = _vm->_actorManager->loadActor(0x7e, 0x19, 0x10e, 0x89, 1);
 	}
 	if ((_actor_80063514 & 2) == 0) {
 		_actor_80072e08 = _vm->_actorManager->loadActor(0x8f, 2, 100, 0xbc, 1);
@@ -578,15 +569,13 @@ void CutScene::knightsSavedBackAtCastle() {
 //			playSoundFromTxtIndex(0x78e8);
 			if (_vm->_talk->somethingTextAndSpeechAndAnimRelated(_actor_80072de8, 3, 0, 0x78e8, 0x2e01) != 2) {
 				wideAngleEveryoneAtTable();
-				if (_vm->_talk->somethingTextAndSpeechAndAnimRelated(_actor_80072e04, 0x1a, 0x19, 0x7a1e, 0x3e01) != 2) {
-					_actor_80072e04->_walkSpeed = 0x10000;
-					_actor_80072e04->setFlag(ACTOR_FLAG_800);
-					_actor_80072e04->updateSequence(0x21);
-					_actor_80072e04->startWalk(0x13f, 0x6e, 2);
+				if (_vm->_talk->somethingTextAndSpeechAndAnimRelated(_flameActor, 0x1a, 0x19, 0x7a1e, 0x3e01) != 2) {
+					_flameActor->_walkSpeed = 0x10000;
+					_flameActor->setFlag(ACTOR_FLAG_800);
+					_flameActor->updateSequence(0x21);
+					_flameActor->startWalk(0x13f, 0x6e, 2);
 					// wait for pathfinding to complete
-					while (_actor_80072e04->isFlagSet(ACTOR_FLAG_10)) { //TODO move to method on Actor waitForPathfinding() ??
-						//empty
-					}
+					_flameActor->waitForWalkToFinish();
 					_actor_80063514 = _actor_80063514 | 1;
 					closeUpShotOnActor(0xd3, 0, 0x233, 0x17a);
 //					playSoundFromTxtIndex(0x7aba);
@@ -675,28 +664,26 @@ void CutScene::flameReturnsCutScene() {
 	_actor_80063514 = (_actor_80063514 & 0xfffe) | 0x600;
 	fun_8003d388();
 	_actor_80072de8->updateSequence(0x1f);
-	_actor_80072e04->_x_pos = 0x10b;
-	_actor_80072e04->_y_pos = 99;
+	_flameActor->_x_pos = 0x10b;
+	_flameActor->_y_pos = 99;
 	_actor_80072de8->_x_pos = 0x10a;
 	_actor_80072de8->_y_pos = 0x5a;
 	_actor_80072de8->_walkSpeed = 0x10000;
-	_actor_80072e04->_walkSpeed = 0x10000;
+	_flameActor->_walkSpeed = 0x10000;
 	_actor_80072de8->setFlag(ACTOR_FLAG_800);
-	_actor_80072e04->setFlag(ACTOR_FLAG_800);
+	_flameActor->setFlag(ACTOR_FLAG_800);
 	//	call_fade_related_1f();
 	_vm->setFlags(ENGINE_FLAG_20000);
 	if (_vm->_talk->somethingTextAndSpeechAndAnimRelated(_actor_80072dec, 4, 0, 0x8ab2, 0x2e01) != 2) {
 		_actor_80072de8->updateSequence(0x1e);
 		_actor_80072de8->startWalk(0xb0, 0x6b, 2);
-		do {
-		} while (_actor_80072de8->isFlagSet(ACTOR_FLAG_10));
+		_actor_80072de8->waitForWalkToFinish();
 		_actor_80072de8->updateSequence(0x1f);
 		if (_vm->_talk->somethingTextAndSpeechAndAnimRelated(_actor_80072dec, 4, 0, 0x8b40, 0x2e01) != 2) {
-			_actor_80072e04->updateSequence(0x1b);
-			_actor_80072e04->startWalk(0xd5, 0x6b, 2);
-			do {
-			} while (_actor_80072e04->isFlagSet(ACTOR_FLAG_10));
-			if (_vm->_talk->somethingTextAndSpeechAndAnimRelated(_actor_80072e04, 0x1a, 0x19, 0x8bb6, 0x3e01) != 2) {
+			_flameActor->updateSequence(0x1b);
+			_flameActor->startWalk(0xd5, 0x6b, 2);
+			_flameActor->waitForWalkToFinish();
+			if (_vm->_talk->somethingTextAndSpeechAndAnimRelated(_flameActor, 0x1a, 0x19, 0x8bb6, 0x3e01) != 2) {
 				if (_vm->_talk->somethingTextAndSpeechAndAnimRelated(_actor_80072dec, 4, 0, 0x8bd8, 0x2e01) != 2) {
 					closeUpShotOnActor(0xd8, 0, 0xfd, 0x60);
 //					playSoundFromTxtIndex(0x8c70);
diff --git a/engines/dragons/cutscene.h b/engines/dragons/cutscene.h
index 88252b5dbf..83ab2ddf70 100644
--- a/engines/dragons/cutscene.h
+++ b/engines/dragons/cutscene.h
@@ -47,7 +47,7 @@ private:
 	Actor *_actor_800830a0;
 	Actor *_actor_800830d4;
 	Actor *_actor_800830dc;
-	Actor *_actor_80072e04;
+	Actor *_flameActor;
 
 	uint16 _actor_80063514; //flags
 
diff --git a/engines/dragons/dragons.cpp b/engines/dragons/dragons.cpp
index 44de724785..3a4ded3692 100644
--- a/engines/dragons/dragons.cpp
+++ b/engines/dragons/dragons.cpp
@@ -860,7 +860,7 @@ void DragonsEngine::engineFlag0x20UpdateFunction() {
 		return;
 	}
 
-	if (isFlagSet(ENGINE_FLAG_8) && !isFlagSet(ENGINE_FLAG_80000000)) {
+	if (isFlagSet(ENGINE_FLAG_8) && !isFlagSet(ENGINE_FLAG_8000000)) {
 		_cursor->update();
 	}
 
diff --git a/engines/dragons/font.cpp b/engines/dragons/font.cpp
index 5aa331b2e4..3e352c3451 100644
--- a/engines/dragons/font.cpp
+++ b/engines/dragons/font.cpp
@@ -142,8 +142,7 @@ Font *FontManager::loadFont(uint16 index, Common::SeekableReadStream &stream) {
 	fd.seek(_vm->getFontOffsetFromDragonEXE());
 	fd.skip((index * 2)  * 28);
 
-//	fd->read(info.filename, 16);
-	fd.skip(16);
+	fd.skip(16); //filename
 	uint32 mapOffset = fd.readUint32LE();
 	uint32 mapSize = fd.readUint32LE();
 	fd.skip(4); //unk
@@ -165,11 +164,10 @@ void updatePalEntry(uint16 *pal, uint16 index, uint16 newValue) {
 }
 
 void FontManager::updatePalette() {
-//	if (( != 0 && ((engine_flags_maybe & 0x200) != 0))) {
 	uint16 *palette_f2_font_maybe = (uint16 *)_screen->getPalette(2);
-	uint16 cursor3 = 0x14a5 | 0x8000;
+	const uint16 cursor3 = 0x14a5 | 0x8000;
 	if (_vm->isFlagSet(ENGINE_FLAG_200)) {
-		updatePalEntry(palette_f2_font_maybe, 3, cursor3);
+		updatePalEntry(palette_f2_font_maybe, 3, cursor3); //TODO move this to palette initialisation
 		if (!_vm->isUnkFlagSet(ENGINE_UNK1_FLAG_1)) {
 			updatePalEntry(palette_f2_font_maybe, 16, cursor3);
 		} else {
@@ -202,7 +200,6 @@ void FontManager::updatePalette() {
 }
 
 void FontManager::drawTextDialogBox(uint32 x1, uint32 y1, uint32 x2, uint32 y2) {
-	const uint16 kTextColCount = 0x28;
 	const uint16 kTileBaseIndex = 1;
 	const uint16 kTileIndexTop = kTileBaseIndex + 10;
 	const uint16 kTileIndexBottom = kTileBaseIndex + 16;
@@ -237,7 +234,9 @@ void FontManager::drawTextDialogBox(uint32 x1, uint32 y1, uint32 x2, uint32 y2)
 }
 
 void FontManager::clearTextDialog(uint32 x1, uint32 y1, uint32 x2, uint32 y2) {
-
+	//TODO clear just specified Area.
+	debug("Clear text (%d,%d) -> (%d,%d)", x1, y1, x2, y2);
+	clearText();
 }
 
 void FontManager::drawBoxChar(uint32 x, uint32 y, uint8 tileIndex) {
diff --git a/engines/dragons/scriptopcodes.cpp b/engines/dragons/scriptopcodes.cpp
index 666f14e806..053e0ce2f6 100644
--- a/engines/dragons/scriptopcodes.cpp
+++ b/engines/dragons/scriptopcodes.cpp
@@ -714,9 +714,7 @@ void ScriptOpcodes::opMoveActorToPoint(ScriptOpCall &scriptOpCall) {
 		ini->actor->startWalk(point.x, point.y, isFlicker ? 0 : 1);
 
 		if (waitForWalkToComplete) {
-			while (ini->actor->isFlagSet(ACTOR_FLAG_10)) {
-				_vm->waitForFrames(1);
-			}
+			ini->actor->waitForWalkToFinish();
 		}
 		ini->x = point.x;
 		ini->y = point.y;
@@ -767,9 +765,7 @@ void ScriptOpcodes::opMoveActorToXY(ScriptOpCall &scriptOpCall) {
 		ini->actor->startWalk(destX, destY, isFlicker ? 0 : 1);
 
 		if (waitForWalkToComplete) {
-			while (ini->actor->isFlagSet(ACTOR_FLAG_10)) {
-				_vm->waitForFrames(1);
-			}
+			ini->actor->waitForWalkToFinish();
 		}
 		ini->x = destX;
 		ini->y = destY;
@@ -875,9 +871,7 @@ void ScriptOpcodes::opMoveActorToObject(ScriptOpCall &scriptOpCall) {
 	}
 	secondIni->actor->startWalk(newXPosAgain, newYPosAgain, someBooleanFlag);
 	if (!bVar1) {
-		while (secondIni->actor->_flags & ACTOR_FLAG_10) {
-			_vm->waitForFrames(1);
-		}
+		secondIni->actor->waitForWalkToFinish();
 	}
 
 	secondIni->actor->_direction = firstIni->direction;
@@ -1207,9 +1201,7 @@ void ScriptOpcodes::opWaitForActorToFinishWalking(ScriptOpCall &scriptOpCall) {
 
 	DragonINI *ini = _vm->getINI(iniId - 1);
 	if (ini->flags & 1) {
-		while (ini->actor->isFlagSet(ACTOR_FLAG_10)) {
-			_vm->waitForFrames(1);
-		}
+		ini->actor->waitForWalkToFinish();
 	}
 }
 
diff --git a/engines/dragons/specialopcodes.cpp b/engines/dragons/specialopcodes.cpp
index 611b9f32d8..c814a10fb2 100644
--- a/engines/dragons/specialopcodes.cpp
+++ b/engines/dragons/specialopcodes.cpp
@@ -301,7 +301,7 @@ void SpecialOpcodes::spcUnk9() {
 	assert(flicker);
 	flicker->flags |= INI_FLAG_20;
 	assert(flicker->actor);
-	flicker->actor->_flags |= ACTOR_FLAG_100;
+	flicker->actor->setFlag(ACTOR_FLAG_100);
 	flicker->actor->_priorityLayer = 0;
 	_vm->getINI(1)->flags |= INI_FLAG_20;
 }
@@ -310,7 +310,7 @@ void SpecialOpcodes::spcUnk9() {
 void SpecialOpcodes::spcUnkA() {
 	DragonINI *flicker = _vm->_dragonINIResource->getFlickerRecord();
 	flicker->flags &= ~INI_FLAG_20;
-	flicker->actor->_flags &= ~ACTOR_FLAG_100;
+	flicker->actor->clearFlag(ACTOR_FLAG_100);
 	_vm->getINI(1)->flags &= ~INI_FLAG_20;
 }
 
@@ -1052,6 +1052,7 @@ void SpecialOpcodes::spcInsideBlackDragonScreenShake() {
 		_vm->_screen->setScreenShakeOffset(0, shakeTbl[i]);
 		_vm->waitForFrames(1);
 	}
+	_vm->_screen->setScreenShakeOffset(0, 0);
 }
 
 void SpecialOpcodes::spc85SetScene1To0x35() {
diff --git a/engines/dragons/talk.cpp b/engines/dragons/talk.cpp
index 9ccee91927..ad29e95087 100644
--- a/engines/dragons/talk.cpp
+++ b/engines/dragons/talk.cpp
@@ -413,7 +413,7 @@ uint8 Talk::conversation_related_maybe(uint16 *dialogText, uint16 x, uint16 y, u
 			LAB_80032e18:
 			//TODO CheckIfCdShellIsOpen();
 			if (!_vm->isUnkFlagSet(ENGINE_UNK1_FLAG_1)) {
-				clearTextDialog((uint) _dat_8008e7e8_dialogBox_x1, (uint) _dat_8008e844_dialogBox_y1,
+				_vm->_fontManager->clearTextDialog((uint) _dat_8008e7e8_dialogBox_x1, (uint) _dat_8008e844_dialogBox_y1,
 								(uint) _dat_8008e848_dialogBox_x2, (uint) _dat_8008e874_dialogBox_y2);
 			}
 		} while (!_vm->isUnkFlagSet(ENGINE_UNK1_FLAG_1) &&
@@ -1003,7 +1003,6 @@ uint32 Talk::strlenUTF16(uint16 *text) {
 }
 
 void Talk::drawDialogBox(uint32 x1, uint32 y1, uint32 x2, uint32 y2, uint16 unk) {
-	//TODO this might be rendering the box under the text.
 	debug("drawTextDialogBox(%d, %d, %d, %d, %d)", x1, y1, x2, y2, unk);
 	_vm->_fontManager->drawTextDialogBox(x1, y1, x2, y2);
 }
@@ -1035,12 +1034,6 @@ uint16 *Talk::UTF16ToUTF16Z(uint16 *dest, uint16 *src) {
 	return dest;
 }
 
-void Talk::clearTextDialog(uint32 x1, uint32 y1, uint32 x2, uint32 y2) {
-	//TODO
-	debug("Clear text (%d,%d) -> (%d,%d)", x1, y1, x2, y2);
-	_vm->_fontManager->clearText();
-}
-
 uint16 Talk::FindLastPositionOf5cChar(uint16 *text) {
 	uint16 len = strlenUTF16(text);
 	for (int i = len - 1; i >= 0; i--) {
@@ -1111,7 +1104,7 @@ void Talk::clearDialogEntries() {
 }
 
 void Talk::FUN_8001a7c4_clearDialogBoxMaybe() {
-	clearTextDialog((uint) _dat_8008e7e8_dialogBox_x1, (uint) _dat_8008e844_dialogBox_y1,
+	_vm->_fontManager->clearTextDialog((uint) _dat_8008e7e8_dialogBox_x1, (uint) _dat_8008e844_dialogBox_y1,
 					(uint) _dat_8008e848_dialogBox_x2, (uint) _dat_8008e874_dialogBox_y2);
 }
 
diff --git a/engines/dragons/talk.h b/engines/dragons/talk.h
index b9748828f0..aa985fd06a 100644
--- a/engines/dragons/talk.h
+++ b/engines/dragons/talk.h
@@ -93,7 +93,6 @@ public:
 	void playDialogAudioDontWait(uint32 textIndex);
 
 private:
-	void clearTextDialog(uint32 x1, uint32 y1, uint32 x2, uint32 y2); //clear box maybe?
 	void copyTextToBuffer(uint16 *destBuffer, byte *src, uint32 destBufferLength);
 	uint32 wideStrLen(uint16 *text);
 	TalkDialogEntry *displayTalkDialogMenu(Common::Array<TalkDialogEntry*> dialogEntries);




More information about the Scummvm-git-logs mailing list