[Scummvm-git-logs] scummvm master -> 93f9c456afda6e51f094a4968b53d9287ffd289e

mgerhardy martin.gerhardy at gmail.com
Sat Jan 9 21:18:18 UTC 2021


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:
252faf42f8 TWINE: helper method to dump a hqr entry into a file
7ac555ecea TWINE: parse fla movie frame information
93f9c456af TWINE: revert attempt to fix issue #12037


Commit: 252faf42f8c280792c0f2fe21f54c0602e5c3ec2
    https://github.com/scummvm/scummvm/commit/252faf42f8c280792c0f2fe21f54c0602e5c3ec2
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-01-09T22:17:56+01:00

Commit Message:
TWINE: helper method to dump a hqr entry into a file

Changed paths:
    engines/twine/resources/hqr.cpp
    engines/twine/resources/hqr.h
    engines/twine/resources/resources.h


diff --git a/engines/twine/resources/hqr.cpp b/engines/twine/resources/hqr.cpp
index 417f88d633..166a11f6ab 100644
--- a/engines/twine/resources/hqr.cpp
+++ b/engines/twine/resources/hqr.cpp
@@ -256,6 +256,26 @@ int32 getAllocEntry(uint8 **ptr, const char *filename, int32 index) {
 	return entrySize;
 }
 
+bool dumpEntry(const char *filename, int32 index, const char *targetFileName) {
+	Common::DumpFile out;
+	if (!out.open(targetFileName)) {
+		warning("Failed to save to %s", targetFileName);
+		return false;
+	}
+
+	uint8 *content = nullptr;
+	const int size = getAllocEntry(&content, filename, index);
+	if (size == 0) {
+		warning("Could not get hqr entry in %s for index %i", filename, index);
+		return false;
+	}
+	out.write(content, size);
+	out.flush();
+	out.close();
+	free(content);
+	return true;
+}
+
 int32 getVoxEntry(uint8 *ptr, const char *filename, int32 index, int32 hiddenIndex) {
 	if (!ptr) {
 		return 0;
diff --git a/engines/twine/resources/hqr.h b/engines/twine/resources/hqr.h
index 79a6d4416e..c217bd097b 100644
--- a/engines/twine/resources/hqr.h
+++ b/engines/twine/resources/hqr.h
@@ -71,6 +71,11 @@ int32 numEntries(const char *filename);
  */
 int32 getAllocEntry(uint8 **ptr, const char *filename, int32 index);
 
+/**
+ * @brief Helper method to dump the content of the given hqr index to a file
+ */
+bool dumpEntry(const char *filename, int32 index, const char *targetFileName);
+
 /**
  * Get a HQR entry pointer
  * @param ptr pointer to save the entry
diff --git a/engines/twine/resources/resources.h b/engines/twine/resources/resources.h
index b6766803eb..e9e6a9baa0 100644
--- a/engines/twine/resources/resources.h
+++ b/engines/twine/resources/resources.h
@@ -55,6 +55,7 @@ namespace TwinE {
 #define RESSHQR_GAMEOVERMDL 21
 
 #define RESSHQR_ALARMREDPAL 22
+#define RESSHQR_FLAINFO 23
 #define RESSHQR_DARKPAL 24
 #define RESSHQR_TWINSEN_ZOE_SENDELLIMG  25
 #define RESSHQR_TWINSEN_ZOE_SENDELLPAL  26


Commit: 7ac555ecea930fb8d258f92bf9693f512e27bc7b
    https://github.com/scummvm/scummvm/commit/7ac555ecea930fb8d258f92bf9693f512e27bc7b
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-01-09T22:17:56+01:00

Commit Message:
TWINE: parse fla movie frame information

Changed paths:
    engines/twine/flamovies.cpp
    engines/twine/resources/resources.cpp
    engines/twine/resources/resources.h


diff --git a/engines/twine/flamovies.cpp b/engines/twine/flamovies.cpp
index 9444c45a62..9f6d2a5025 100644
--- a/engines/twine/flamovies.cpp
+++ b/engines/twine/flamovies.cpp
@@ -264,38 +264,9 @@ void FlaMovies::playGIFMovie(const char *flaName) {
 	}
 
 	debug("Play gif %s", flaName);
-	// TODO: use the HQR 23th entry (movies informations)
-	if (!strcmp(flaName, FLA_INTROD)) {
-		prepareGIF(3);
-		prepareGIF(4);
-		prepareGIF(5);
-	} else if (!strcmp(flaName, "BAFFE") || !strcmp(flaName, "BAFFE2") || !strcmp(flaName, "BAFFE3") || !strcmp(flaName, "BAFFE4")) {
-		prepareGIF(6);
-	} else if (!strcmp(flaName, "bateau") || !strcmp(flaName, "bateau2")) {
-		prepareGIF(7);
-	} else if (!strcmp(flaName, "navette")) {
-		prepareGIF(15);
-	} else if (!strcmp(flaName, "templebu")) {
-		prepareGIF(12);
-	} else if (!strcmp(flaName, "flute2")) {
-		prepareGIF(8); // TODO: same as glass2?
-	} else if (!strcmp(flaName, "glass2")) {
-		prepareGIF(8); // TODO: same as flute2?
-	} else if (!strcmp(flaName, "surf")) {
-		prepareGIF(9);
-	} else if (!strcmp(flaName, "verser") || !strcmp(flaName, "verser2")) {
-		prepareGIF(10);
-	} else if (!strcmp(flaName, "neige2")) {
-		prepareGIF(11);
-	} else if (!strcmp(flaName, "capture")) {
-		prepareGIF(14); // TODO: same as sendel?
-	} else if (!strcmp(flaName, "sendel")) {
-		prepareGIF(14); // TODO: same as capture?
-	} else if (!strcmp(flaName, "sendel2")) {
-		prepareGIF(17);
-	} else if (!strcmp(flaName, FLA_DRAGON3)) {
-		prepareGIF(1);
-		prepareGIF(2);
+	const Common::Array<int32>& frames = _engine->_resources->getFlaMovieInfo(flaName);
+	for (int32 frame : frames) {
+		prepareGIF(frame);
 	}
 }
 
diff --git a/engines/twine/resources/resources.cpp b/engines/twine/resources/resources.cpp
index e24dac791c..31e21261e4 100644
--- a/engines/twine/resources/resources.cpp
+++ b/engines/twine/resources/resources.cpp
@@ -21,6 +21,7 @@
  */
 
 #include "twine/resources/resources.h"
+#include "common/tokenizer.h"
 #include "common/util.h"
 #include "twine/audio/sound.h"
 #include "twine/renderer/screens.h"
@@ -172,6 +173,39 @@ void Resources::initResources() {
 	preloadAnimations();
 	preloadSamples();
 	preloadInventoryItems();
+
+	loadFlaInfo();
+}
+
+void Resources::loadFlaInfo() {
+	uint8 *content = nullptr;
+	const int32 size = HQR::getAllocEntry(&content, Resources::HQR_RESS_FILE, RESSHQR_FLAINFO);
+	if (size == 0) {
+		return;
+	}
+	const Common::String str((const char*)content, size);
+	free(content);
+
+	Common::StringTokenizer tok(str, "\r\n");
+	while (!tok.empty()) {
+		const Common::String &line = tok.nextToken();
+		Common::StringTokenizer lineTok(line);
+		if (lineTok.empty()) {
+			continue;
+		}
+		const Common::String &name = lineTok.nextToken();
+		Common::Array<int32> frames;
+		while (!lineTok.empty()) {
+			const Common::String &frame = lineTok.nextToken();
+			const int32 frameIdx = atoi(frame.c_str());
+			frames.push_back(frameIdx);
+		}
+		_flaMovieFrames.setVal(name, frames);
+	}
+}
+
+const Common::Array<int32>& Resources::getFlaMovieInfo(const Common::String &name) const {
+	return _flaMovieFrames.getVal(name);
 }
 
 } // namespace TwinE
diff --git a/engines/twine/resources/resources.h b/engines/twine/resources/resources.h
index e9e6a9baa0..b0b1ca175a 100644
--- a/engines/twine/resources/resources.h
+++ b/engines/twine/resources/resources.h
@@ -23,6 +23,7 @@
 #ifndef TWINE_RESOURCES_H
 #define TWINE_RESOURCES_H
 
+#include "common/hashmap.h"
 #include "common/scummsys.h"
 #include "twine/parser/sprite.h"
 #include "twine/scene/gamestate.h"
@@ -142,11 +143,17 @@ private:
 	/** Preload all animations */
 	void preloadAnimations();
 	void preloadSamples();
+	void loadFlaInfo();
+
+	using MovieInfoMap = Common::HashMap<Common::String, Common::Array<int32>>;
+	MovieInfoMap _flaMovieFrames;
 
 public:
 	Resources(TwinEEngine *engine) : _engine(engine) {}
 	~Resources();
 
+	const Common::Array<int32>& getFlaMovieInfo(const Common::String &name) const;
+
 	/** Table with all loaded samples */
 	uint8 *inventoryTable[NUM_INVENTORY_ITEMS] {nullptr};
 	/** Table with all loaded samples sizes */


Commit: 93f9c456afda6e51f094a4968b53d9287ffd289e
    https://github.com/scummvm/scummvm/commit/93f9c456afda6e51f094a4968b53d9287ffd289e
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-01-09T22:17:56+01:00

Commit Message:
TWINE: revert attempt to fix issue #12037

This reverts commit 66a69367653e684e1a97482928c5958ec38b4fd3.

Acoording to user feedback this doesn't match

Changed paths:
    engines/twine/flamovies.cpp


diff --git a/engines/twine/flamovies.cpp b/engines/twine/flamovies.cpp
index 9f6d2a5025..dc437fd063 100644
--- a/engines/twine/flamovies.cpp
+++ b/engines/twine/flamovies.cpp
@@ -307,7 +307,6 @@ void FlaMovies::playFlaMovie(const char *flaName) {
 	samplesInFla = file.readUint16LE();
 	const uint16 unk2 = file.readUint16LE();
 	debug(2, "Unknown uint16 in fla file: %i", unk2);
-	_engine->_music->playMidiMusic(unk2);
 
 	file.skip(4 * samplesInFla);
 




More information about the Scummvm-git-logs mailing list