[Scummvm-git-logs] scummvm master -> 43a82189a5705ad4fa3e1a36d5e8cbf44d6ebb91

yuv422 yuv422 at users.noreply.github.com
Tue Aug 25 13:14:57 UTC 2020


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

Summary:
7c7ece5a94 DRAGONS: Fixed flicker sprite rendering issues in Lake scene
028312588b DRAGONS: Fixed up logic to clear text dialogs from the screen.
43a82189a5 DRAGONS: Don't allow load/save while player doesn't have control. #11606


Commit: 7c7ece5a946b109863eb8901b3fdab728ac8491b
    https://github.com/scummvm/scummvm/commit/7c7ece5a946b109863eb8901b3fdab728ac8491b
Author: Eric Fry (yuv422 at users.noreply.github.com)
Date: 2020-08-25T21:51:55+10:00

Commit Message:
DRAGONS: Fixed flicker sprite rendering issues in Lake scene

Changed paths:
    engines/dragons/screen.cpp


diff --git a/engines/dragons/screen.cpp b/engines/dragons/screen.cpp
index 91e9a5d58d..c3ce18aeaf 100644
--- a/engines/dragons/screen.cpp
+++ b/engines/dragons/screen.cpp
@@ -205,6 +205,8 @@ void Screen::copyRectToSurface8bpp(const void *buffer, const byte* palette, int
 
 void Screen::drawScaledSprite(Graphics::Surface *destSurface, const byte *source, int sourceWidth, int sourceHeight,
 		int destX, int destY, int destWidth, int destHeight, const byte *palette, bool flipX, uint8 alpha) {
+	//TODO this logic is pretty messy. It should probably be re-written. It is trying to scale, clip, flip and blend at once.
+
 	// Based on the GNAP engine scaling code
 	if (destWidth == 0 || destHeight == 0) {
 		return;
@@ -218,9 +220,7 @@ void Screen::drawScaledSprite(Graphics::Surface *destSurface, const byte *source
 		destX = 0;
 		destWidth -= clipX;
 	}
-	if (destX + destWidth >= destSurface->w) {
-		destWidth = destSurface->w - destX;
-	}
+
 	if (destY < 0) {
 		clipY = -destY;
 		destY = 0;
@@ -236,20 +236,24 @@ void Screen::drawScaledSprite(Graphics::Surface *destSurface, const byte *source
 	const byte *hsrc = source + sourceWidth * ((yi + 0x8000) >> 16);
 	for (int yc = 0; yc < destHeight; ++yc) {
 		byte *wdst = flipX ? dst + (destWidth - 1) * 2 : dst;
+		int16 currX = flipX ? destX + (destWidth - 1) : destX;
 		int xi = flipX ? xs : xs * clipX;
 		const byte *wsrc = hsrc + ((xi + 0x8000) >> 16);
 		for (int xc = 0; xc < destWidth; ++xc) {
-			byte colorIndex = *wsrc;
-			uint16 c = READ_LE_UINT16(&palette[colorIndex * 2]);
-			if (c != 0) {
-				if (!(c & 0x8000) || alpha == 255) {
-					// only copy opaque pixels
-					WRITE_LE_UINT16(wdst, c & ~0x8000);
-				} else {
-					WRITE_LE_UINT16(wdst, alphaBlendRGB555(c, READ_LE_INT16(wdst), alpha));
-					// semi-transparent pixels.
+			if (currX >= 0 && currX < destSurface->w) {
+				byte colorIndex = *wsrc;
+				uint16 c = READ_LE_UINT16(&palette[colorIndex * 2]);
+				if (c != 0) {
+					if (!(c & 0x8000) || alpha == 255) {
+						// only copy opaque pixels
+						WRITE_LE_UINT16(wdst, c & ~0x8000);
+					} else {
+						WRITE_LE_UINT16(wdst, alphaBlendRGB555(c, READ_LE_INT16(wdst), alpha));
+						// semi-transparent pixels.
+					}
 				}
 			}
+			currX += (flipX ? -1 : 1);
 			wdst += (flipX ? -2 : 2);
 			xi += xs;
 			wsrc = hsrc + ((xi + 0x8000) >> 16);


Commit: 028312588b6dc119df8a61b00bd538093839e49e
    https://github.com/scummvm/scummvm/commit/028312588b6dc119df8a61b00bd538093839e49e
Author: Eric Fry (yuv422 at users.noreply.github.com)
Date: 2020-08-25T22:54:39+10:00

Commit Message:
DRAGONS: Fixed up logic to clear text dialogs from the screen.

Changed paths:
    engines/dragons/cutscene.cpp
    engines/dragons/dragons.cpp
    engines/dragons/dragons.h
    engines/dragons/minigame1.cpp
    engines/dragons/minigame2.cpp
    engines/dragons/minigame3.cpp
    engines/dragons/minigame5.cpp
    engines/dragons/specialopcodes.cpp
    engines/dragons/specialopcodes.h
    engines/dragons/talk.cpp


diff --git a/engines/dragons/cutscene.cpp b/engines/dragons/cutscene.cpp
index 3a03ed8b2d..e5cfe393c2 100644
--- a/engines/dragons/cutscene.cpp
+++ b/engines/dragons/cutscene.cpp
@@ -127,7 +127,7 @@ void CutScene::scene1() {
 		if (fun_8003dab8(0x52d6, 0, 0, 0x701, 1) == 2)
 			break;
 
-		// TODO callMaybeResetData();
+		_vm->clearAllText();
 		//playSoundFromTxtIndex(0x530c);
 
 		if (_vm->_talk->somethingTextAndSpeechAndAnimRelated(_actor_80072dec, 2, 0, 0x530c, 0x3c01) == 2)
diff --git a/engines/dragons/dragons.cpp b/engines/dragons/dragons.cpp
index 23552264fa..ab85d7fd29 100644
--- a/engines/dragons/dragons.cpp
+++ b/engines/dragons/dragons.cpp
@@ -1785,6 +1785,10 @@ bool DragonsEngine::checkForWheelDown() {
 	return _mouseWheel == MOUSE_WHEEL_DOWN;
 }
 
+void DragonsEngine::clearAllText() {
+	_fontManager->clearText();
+}
+
 void (*DragonsEngine::getSceneUpdateFunction())() {
 	return _sceneUpdateFunction;
 }
diff --git a/engines/dragons/dragons.h b/engines/dragons/dragons.h
index cceb8ffa9c..6048e33c42 100644
--- a/engines/dragons/dragons.h
+++ b/engines/dragons/dragons.h
@@ -324,6 +324,8 @@ public:
 
 	void loadingScreenUpdate();
 
+	void clearAllText();
+
 	//TODO this logic should probably go in its own class.
 	uint32 getBigFileInfoTblFromDragonEXE();
 	uint32 getFontOffsetFromDragonEXE();
diff --git a/engines/dragons/minigame1.cpp b/engines/dragons/minigame1.cpp
index 92aaf5e331..91ffc139a4 100644
--- a/engines/dragons/minigame1.cpp
+++ b/engines/dragons/minigame1.cpp
@@ -843,7 +843,7 @@ void Minigame1::run() {
 		}
 	} while (true);
 
-	//TODO callMaybeResetData();
+	_vm->clearAllText();
 	flickerActor->updateSequence(0x15);
 	// DisableVSyncEvent();
 	catActor->reset_maybe();
diff --git a/engines/dragons/minigame2.cpp b/engines/dragons/minigame2.cpp
index e198b0e015..4b0cb049f2 100644
--- a/engines/dragons/minigame2.cpp
+++ b/engines/dragons/minigame2.cpp
@@ -734,6 +734,7 @@ void Minigame2::run(int16 param_1, uint16 param_2, int16 param_3) {
 		_vm->setAllFlags((origEngineFlags & 0xfefdffff) | (_vm->getAllFlags() & 0x1000000) | 0x40);
 		_vm->fadeFromBlack();
 	}
+	_vm->_fontManager->clearText();
 }
 
 void Minigame2::fun_80093aec_dialog(uint32 textId, int16 x, int16 y) {
diff --git a/engines/dragons/minigame3.cpp b/engines/dragons/minigame3.cpp
index 6df42746ff..06171470ef 100644
--- a/engines/dragons/minigame3.cpp
+++ b/engines/dragons/minigame3.cpp
@@ -22,6 +22,7 @@
 #include "common/scummsys.h"
 #include "common/rect.h"
 #include "dragons/actor.h"
+#include "dragons/font.h"
 #include "dragons/minigame3.h"
 #include "dragons/dragonini.h"
 #include "dragons/inventory.h"
@@ -124,7 +125,7 @@ void Minigame3::run() {
 
 	Common::File *fd = new Common::File();
 	if (!fd->open("arc3.bin")) {
-		error("Failed to open arc1.bin");
+		error("Failed to open arc3.bin");
 	}
 
 	for (int i = 0; i < 21; i++) {
diff --git a/engines/dragons/minigame5.cpp b/engines/dragons/minigame5.cpp
index 66d96fed75..bc533a9fcd 100644
--- a/engines/dragons/minigame5.cpp
+++ b/engines/dragons/minigame5.cpp
@@ -374,7 +374,7 @@ void Minigame5::run() {
 					_vm->waitForFrames(0x12);
 					_vm->_talk->loadText(DAT_80063e38, auStack2120, 1000);
 					_vm->_talk->displayDialogAroundPoint(auStack2120, 0xf, 2, 0x501, 0, DAT_80063e38);
-//						TODO	callMaybeResetData();
+					_vm->clearAllText();
 					_vm->_dragonINIResource->getRecord(DAT_80063bd0 + -1)->actor->updateSequence(3);
 					_vm->_dragonINIResource->getRecord(DAT_80063bd0 + -1)->actor->waitUntilFlag8And4AreSet();
 					pusherActor->updateSequence(7);
@@ -485,7 +485,7 @@ void Minigame5::run() {
 			_vm->waitForFrames(0x1e);
 			_vm->_dragonINIResource->getRecord(DAT_80063a40 + -1)->actor->clearFlag(ACTOR_FLAG_100);
 			LAB_8009157c:
-//			callMaybeResetData();
+			_vm->clearAllText();
 			flickerActor->updateSequence(0x15);
 			local_46 = 0;
 			//local_44 = 0;
diff --git a/engines/dragons/specialopcodes.cpp b/engines/dragons/specialopcodes.cpp
index 09175f6d42..0e766b9f72 100644
--- a/engines/dragons/specialopcodes.cpp
+++ b/engines/dragons/specialopcodes.cpp
@@ -204,7 +204,7 @@ void SpecialOpcodes::initOpcodes() {
 	OPCODE(0x7f, spcFlickerPutOnStGeorgeArmor);
 	OPCODE(0x80, spcUnk80FlickerArmorOn);
 	OPCODE(0x81, spcShakeScreenSceneLogic);
-	OPCODE(0x82, spc82CallResetDataMaybe);
+	OPCODE(0x82, spcClearTextFromScreen);
 	OPCODE(0x83, spcStopScreenShakeUpdater);
 	OPCODE(0x84, spcInsideBlackDragonScreenShake);
 	OPCODE(0x85, spc85SetScene1To0x35);
@@ -1038,8 +1038,8 @@ void SpecialOpcodes::spcFlickerPutOnStGeorgeArmor() {
 	actor->_priorityLayer = 1;
 }
 
-void SpecialOpcodes::spc82CallResetDataMaybe() {
-	//TODO callMaybeResetData(); LOOKS like it clears text from the screen.
+void SpecialOpcodes::spcClearTextFromScreen() {
+	_vm->clearAllText();
 }
 
 void SpecialOpcodes::spcStopScreenShakeUpdater() {
diff --git a/engines/dragons/specialopcodes.h b/engines/dragons/specialopcodes.h
index a241226306..5cb705404f 100644
--- a/engines/dragons/specialopcodes.h
+++ b/engines/dragons/specialopcodes.h
@@ -208,7 +208,7 @@ protected:
 	void spcFlickerPutOnStGeorgeArmor(); //0x7f
 	void spcUnk80FlickerArmorOn(); //0x80
 	void spcShakeScreenSceneLogic(); //0x81
-	void spc82CallResetDataMaybe(); // 0x82
+	void spcClearTextFromScreen(); // 0x82
 	void spcStopScreenShakeUpdater(); // 0x83
 	void spcInsideBlackDragonScreenShake(); // 0x84
 	void spc85SetScene1To0x35(); //0x85
diff --git a/engines/dragons/talk.cpp b/engines/dragons/talk.cpp
index 70ed61f52b..d8f314bf27 100644
--- a/engines/dragons/talk.cpp
+++ b/engines/dragons/talk.cpp
@@ -574,7 +574,7 @@ bool Talk::talkToActor(ScriptOpCall &scriptOpCall) {
 
 	_vm->setFlags(ENGINE_FLAG_100);
 	do {
-		callMaybeResetData();
+		_vm->clearAllText();
 		int numActiveDialogEntries = 0;
 		for (Common::Array<TalkDialogEntry*>::iterator it = dialogEntries.begin(); it != dialogEntries.end(); it++) {
 			if (!((*it)->flags & 1)) {
@@ -589,7 +589,7 @@ bool Talk::talkToActor(ScriptOpCall &scriptOpCall) {
 
 		selectedDialogText = displayTalkDialogMenu(dialogEntries);
 		if (selectedDialogText == nullptr) {
-			callMaybeResetData();
+			_vm->clearAllText();
 			exitTalkMenu(isFlag8Set, isFlag100Set, dialogEntries);
 			return true;
 		}
@@ -611,7 +611,7 @@ bool Talk::talkToActor(ScriptOpCall &scriptOpCall) {
 		if ((selectedDialogText->flags & 2) == 0) {
 			selectedDialogText->flags = selectedDialogText->flags | 1;
 		}
-		callMaybeResetData();
+		_vm->clearAllText();
 		if (loadText(selectedDialogText->textIndex1, local_800, 1000)) {
 			if (selectedDialogText->field_26c == -1) {
 				displayDialogAroundINI(_vm->_cursor->_iniUnderCursor, local_800, selectedDialogText->textIndex1);
@@ -735,7 +735,7 @@ TalkDialogEntry *Talk::displayTalkDialogMenu(Common::Array<TalkDialogEntry*> dia
 
 			_vm->clearFlags(ENGINE_FLAG_8);
 			y = 0;
-			callMaybeResetData();
+			_vm->clearAllText();
 			if (hasDialogEntries) {
 				uVar3 = 0;
 				do {


Commit: 43a82189a5705ad4fa3e1a36d5e8cbf44d6ebb91
    https://github.com/scummvm/scummvm/commit/43a82189a5705ad4fa3e1a36d5e8cbf44d6ebb91
Author: Eric Fry (yuv422 at users.noreply.github.com)
Date: 2020-08-25T23:12:09+10:00

Commit Message:
DRAGONS: Don't allow load/save while player doesn't have control. #11606

Changed paths:
    engines/dragons/dragons.cpp


diff --git a/engines/dragons/dragons.cpp b/engines/dragons/dragons.cpp
index ab85d7fd29..b9e906d7c5 100644
--- a/engines/dragons/dragons.cpp
+++ b/engines/dragons/dragons.cpp
@@ -1231,11 +1231,12 @@ void DragonsEngine::reset_screen_maybe() {
 }
 
 bool DragonsEngine::canLoadGameStateCurrently() {
-	return isInputEnabled();
+	//player has control and not currently talking to anyone.
+	return isInputEnabled() && isFlagSet(ENGINE_FLAG_8) && !isFlagSet(Dragons::ENGINE_FLAG_100);
 }
 
 bool DragonsEngine::canSaveGameStateCurrently() {
-	return isInputEnabled() && !_inventory->isOpen();
+	return isInputEnabled() && !_inventory->isOpen() && isFlagSet(ENGINE_FLAG_8) && !isFlagSet(Dragons::ENGINE_FLAG_100);
 }
 
 bool DragonsEngine::hasFeature(Engine::EngineFeature f) const {




More information about the Scummvm-git-logs mailing list