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

yuv422 noreply at scummvm.org
Sun Jan 26 23:17:37 UTC 2025


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:
b31490a2cd DARKSEED: Add Dong Seo International splash screen to Korean version.


Commit: b31490a2cd74f8180e0f1901542375338f04ca29
    https://github.com/scummvm/scummvm/commit/b31490a2cd74f8180e0f1901542375338f04ca29
Author: Eric Fry (yuv422 at reversedgames.com)
Date: 2025-01-27T10:13:58+11:00

Commit Message:
DARKSEED: Add Dong Seo International splash screen to Korean version.

Changed paths:
  A engines/darkseed/kidpic.cpp
  A engines/darkseed/kidpic.h
    engines/darkseed/cutscene.cpp
    engines/darkseed/module.mk
    engines/darkseed/pal.cpp
    engines/darkseed/pal.h


diff --git a/engines/darkseed/cutscene.cpp b/engines/darkseed/cutscene.cpp
index 73998fb5671..d4714c22965 100644
--- a/engines/darkseed/cutscene.cpp
+++ b/engines/darkseed/cutscene.cpp
@@ -22,6 +22,7 @@
 #include "darkseed/cutscene.h"
 #include "darkseed/darkseed.h"
 #include "darkseed/langtext.h"
+#include "kidpic.h"
 
 namespace Darkseed {
 
@@ -118,12 +119,27 @@ static constexpr int CREDITS_DELAY = 25;
 bool Cutscene::introScene() {
 	auto lang = g_engine->getLanguage();
 	switch (_movieStep) {
-	case 1:
-		g_engine->fadeOut();
+	case 1: {
+		if (lang == Common::KO_KOR) {
+			g_engine->_screen->clear();
+			KidPic kidPic;
+			kidPic.draw();
+			g_engine->_screen->makeAllDirty();
+			registTime();
+		} else {
+			g_engine->fadeOut();
+		}
 		break;
+	}
 	case 2:
-		if (g_engine->fadeStep()) {
-			return true;
+		if (lang == Common::KO_KOR) {
+			if (waitTime(CREDITS_DELAY)) {
+				return true;
+			}
+		} else {
+			if (g_engine->fadeStep()) {
+				return true;
+			}
 		}
 		break;
 	case 3: {
diff --git a/engines/darkseed/kidpic.cpp b/engines/darkseed/kidpic.cpp
new file mode 100644
index 00000000000..ac4ca28a816
--- /dev/null
+++ b/engines/darkseed/kidpic.cpp
@@ -0,0 +1,96 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/debug.h"
+#include "common/file.h"
+#include "darkseed/darkseed.h"
+#include "darkseed/kidpic.h"
+
+namespace Darkseed {
+
+static constexpr int BYTES_PER_LINE = 320;
+static constexpr int BYTES_PER_PLANE = 80;
+
+static constexpr int KID_WIDTH = 640;
+static constexpr int KID_HEIGHT = 350;
+
+KidPic::KidPic() {
+	_pixels.resize(KID_WIDTH * KID_HEIGHT);
+	Common::File file;
+	if (!file.open("kid.pic")) {
+		error("Failed to open kid.pic");
+	}
+
+	file.seek(0x10);
+	Pal pal;
+	pal.loadFromStream(file, false);
+	pal.swapEntries(14, 4); // not sure why we need to swap these palette entries. All the other entries line up correctly.
+	pal.installPalette();
+	unpackRLE(file);
+}
+
+bool KidPic::unpackRLE(Common::SeekableReadStream &readStream) {
+	uint idx = 0;
+	uint unpackedSize = _pixels.size() / 2;
+
+	readStream.seek(0x80);
+
+	while (idx < unpackedSize && !readStream.eos()) {
+		uint8 byte = readStream.readByte();
+		assert(!readStream.err());
+
+		uint repeat = 1;
+		if ((byte & 192) == 192) {
+			repeat = (byte & 63);
+			byte = readStream.readByte();
+			assert(!readStream.err());
+		}
+
+		for (uint j = 0; j < repeat; j++) {
+			unpackByte(byte);
+		}
+		idx += repeat;
+	}
+
+	return true;
+}
+
+// image is stored as 4 x 1-bit planes per line.
+void KidPic::unpackByte(uint8 byte) {
+	int planeOffset = _lineByteIdx / BYTES_PER_PLANE;
+	int x = _lineByteIdx % BYTES_PER_PLANE;
+	for (int i = 0; i < 8; i++) {
+		if (byte & 1 << (7 - i)) {
+			_pixels[_lineNum * KID_WIDTH + (x * 8) + i] |= 1 << planeOffset;
+		}
+	}
+	_lineByteIdx++;
+	if (_lineByteIdx == BYTES_PER_LINE) {
+		_lineByteIdx = 0;
+		_lineNum++;
+	}
+}
+
+void KidPic::draw() {
+	g_engine->_screen->copyRectToSurface(_pixels.data(), KID_WIDTH, 0, 0, KID_WIDTH, KID_HEIGHT);
+}
+
+} // namespace Darkseed
diff --git a/engines/darkseed/kidpic.h b/engines/darkseed/kidpic.h
new file mode 100644
index 00000000000..708529fd770
--- /dev/null
+++ b/engines/darkseed/kidpic.h
@@ -0,0 +1,47 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef DARKSEED_KIDPIC_H
+#define DARKSEED_KIDPIC_H
+
+#include "common/array.h"
+#include "common/scummsys.h"
+#include "common/file.h"
+
+namespace Darkseed {
+
+class KidPic {
+	Common::Array<uint8> _pixels;
+	int _lineNum = 0;
+	int _lineByteIdx = 0;
+
+public:
+	KidPic();
+	void draw();
+
+private:
+	bool unpackRLE(Common::SeekableReadStream &readStream);
+	void unpackByte(uint8 byte);
+};
+
+} // namespace Darkseed
+
+#endif // DARKSEED_KIDPIC_H
diff --git a/engines/darkseed/module.mk b/engines/darkseed/module.mk
index 4b5867ed53f..e594df1b521 100644
--- a/engines/darkseed/module.mk
+++ b/engines/darkseed/module.mk
@@ -13,6 +13,7 @@ MODULE_OBJS = \
 	gamefont.o \
 	img.o \
 	inventory.o \
+	kidpic.o \
 	kofont.o \
 	langtext.o \
 	menu.o \
diff --git a/engines/darkseed/pal.cpp b/engines/darkseed/pal.cpp
index 312161e4200..054bba34830 100644
--- a/engines/darkseed/pal.cpp
+++ b/engines/darkseed/pal.cpp
@@ -49,7 +49,12 @@ bool Pal::load(const Common::Path &filename, bool shouldInstallPalette) {
 		loadFromScreen();
 		return false;
 	}
-	uint32 bytesRead = file.read(_palData, DARKSEED_PAL_SIZE);
+
+	return loadFromStream(file, shouldInstallPalette);
+}
+
+bool Pal::loadFromStream(Common::SeekableReadStream &readStream, bool shouldInstallPalette) {
+	uint32 bytesRead = readStream.read(_palData, DARKSEED_PAL_SIZE);
 	assert(bytesRead == DARKSEED_PAL_SIZE);
 
 	for (int i = 0; i < DARKSEED_PAL_SIZE; i++) {
@@ -58,6 +63,7 @@ bool Pal::load(const Common::Path &filename, bool shouldInstallPalette) {
 	if (shouldInstallPalette) {
 		installPalette();
 	}
+
 	return true;
 }
 
@@ -69,6 +75,21 @@ void Pal::clear() {
 	memset(_palData, 0, DARKSEED_PAL_SIZE);
 }
 
+void Pal::swapEntries(int idx1, int idx2) {
+	uint8 tmpEntry[3];
+	tmpEntry[0] = _palData[idx1 * 3];
+	tmpEntry[1] = _palData[idx1 * 3 + 1];
+	tmpEntry[2] = _palData[idx1 * 3 + 2];
+
+	_palData[idx1 * 3] = _palData[idx2 * 3];
+	_palData[idx1 * 3 + 1] = _palData[idx2 * 3 + 1];
+	_palData[idx1 * 3 + 2] = _palData[idx2 * 3 + 2];
+
+	_palData[idx2 * 3] = tmpEntry[0];
+	_palData[idx2 * 3 + 1] = tmpEntry[1];
+	_palData[idx2 * 3 + 2] = tmpEntry[2];
+}
+
 void Pal::updatePalette(int delta, const Pal &targetPal, bool shouldInstallPalette) {
 	for (int i = 0; i < DARKSEED_PAL_SIZE; i++) {
 		int c = _palData[i] + delta;
diff --git a/engines/darkseed/pal.h b/engines/darkseed/pal.h
index 1d50de751ca..ac884c4fbd5 100644
--- a/engines/darkseed/pal.h
+++ b/engines/darkseed/pal.h
@@ -23,6 +23,7 @@
 #define DARKSEED_PAL_H
 
 #include "common/path.h"
+#include "common/stream.h"
 
 namespace Darkseed {
 
@@ -40,7 +41,9 @@ public:
 	void loadFromScreen();
 	void load(const Pal &pal);
 	bool load(const Common::Path &filename, bool shouldInstallPalette = true);
+	bool loadFromStream(Common::SeekableReadStream &readStream, bool shouldInstallPalette = true);
 	void clear();
+	void swapEntries(int idx1, int idx2);
 	void updatePalette(int delta, const Pal &targetPal, bool shouldInstallPalette = true);
 	void installPalette() const;
 };




More information about the Scummvm-git-logs mailing list