[Scummvm-git-logs] scummvm master -> 87c503692cc54fe1d83d7c323795a4ffaaceb3ed

mgerhardy martin.gerhardy at gmail.com
Mon Jan 11 18:59:06 UTC 2021


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:
c1ff3274e3 TWINE: reverted parts of commit 7ac555ecea93
87c503692c TWINE: allow to cycle between available holomap locations


Commit: c1ff3274e37c01536d2bdfd3e66ab55e9fbc6b16
    https://github.com/scummvm/scummvm/commit/c1ff3274e37c01536d2bdfd3e66ab55e9fbc6b16
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-01-11T19:58:14+01:00

Commit Message:
TWINE: reverted parts of commit 7ac555ecea93

this went in by accident and wasn't meant to be used at the moment

Changed paths:
    engines/twine/audio/music.h
    engines/twine/flamovies.cpp


diff --git a/engines/twine/audio/music.h b/engines/twine/audio/music.h
index a4a636e1b2..984e40eac3 100644
--- a/engines/twine/audio/music.h
+++ b/engines/twine/audio/music.h
@@ -76,7 +76,7 @@ public:
 	/**
 	 * Play MIDI music
 	 * @param midiIdx music index under mini_mi_win.hqr
-	 * @note valid indices for lba1 are [1-33]
+	 * @note valid indices for lba1 are [1-32]
 	 */
 	bool playMidiMusic(int32 midiIdx, int32 loop = 0);
 	/** Stop MIDI music */
diff --git a/engines/twine/flamovies.cpp b/engines/twine/flamovies.cpp
index dc437fd063..8329ec9ebb 100644
--- a/engines/twine/flamovies.cpp
+++ b/engines/twine/flamovies.cpp
@@ -232,6 +232,7 @@ void FlaMovies::processFrame() {
 FlaMovies::FlaMovies(TwinEEngine *engine) : _engine(engine) {}
 
 void FlaMovies::prepareGIF(int index) {
+	// TODO: version 87a 640x480
 #if 0
 	Image::GIFDecoder decoder;
 	Common::SeekableReadStream *stream = HQR::makeReadStream("FLA_GIF.HQR", index);
@@ -264,9 +265,39 @@ void FlaMovies::playGIFMovie(const char *flaName) {
 	}
 
 	debug("Play gif %s", flaName);
-	const Common::Array<int32>& frames = _engine->_resources->getFlaMovieInfo(flaName);
-	for (int32 frame : frames) {
-		prepareGIF(frame);
+	// TODO: use the HQR 23th entry (movies informations)
+	// TODO: there are gifs [1-18]
+	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);
 	}
 }
 


Commit: 87c503692cc54fe1d83d7c323795a4ffaaceb3ed
    https://github.com/scummvm/scummvm/commit/87c503692cc54fe1d83d7c323795a4ffaaceb3ed
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-01-11T19:58:14+01:00

Commit Message:
TWINE: allow to cycle between available holomap locations

Changed paths:
    engines/twine/debugger/console.cpp
    engines/twine/debugger/console.h
    engines/twine/holomap.cpp
    engines/twine/holomap.h
    engines/twine/twine.cpp


diff --git a/engines/twine/debugger/console.cpp b/engines/twine/debugger/console.cpp
index 98f689438a..c18661f8a1 100644
--- a/engines/twine/debugger/console.cpp
+++ b/engines/twine/debugger/console.cpp
@@ -25,6 +25,7 @@
 #include "common/util.h"
 #include "twine/debugger/debug_grid.h"
 #include "twine/debugger/debug_scene.h"
+#include "twine/holomap.h"
 #include "twine/scene/gamestate.h"
 #include "twine/scene/scene.h"
 #include "twine/text.h"
@@ -48,7 +49,10 @@ TwinEConsole::TwinEConsole(TwinEEngine *engine) : _engine(engine), GUI::Debugger
 	registerCmd("hero_pos", WRAP_METHOD(TwinEConsole, doSetHeroPosition));
 	registerCmd("set_game_flag", WRAP_METHOD(TwinEConsole, doSetGameFlag));
 	registerCmd("show_game_flag", WRAP_METHOD(TwinEConsole, doPrintGameFlag));
-	registerCmd("inventory_flag", WRAP_METHOD(TwinEConsole, doSetInventoryFlag));
+	registerCmd("set_inventory_flag", WRAP_METHOD(TwinEConsole, doSetInventoryFlag));
+	registerCmd("show_inventory_flag", WRAP_METHOD(TwinEConsole, doPrintGameFlag));
+	registerCmd("set_holomap_flag", WRAP_METHOD(TwinEConsole, doSetHolomapFlag));
+	registerCmd("show_holomap_flag", WRAP_METHOD(TwinEConsole, doPrintGameFlag));
 }
 
 TwinEConsole::~TwinEConsole() {
@@ -111,13 +115,13 @@ bool TwinEConsole::doToggleSceneChanges(int argc, const char **argv) {
 bool TwinEConsole::doSetInventoryFlag(int argc, const char **argv) {
 	if (argc <= 1) {
 		debugPrintf("Expected to get a inventory flag index as first parameter\n");
-		return false;
+		return true;
 	}
 
 	const uint8 idx = atoi(argv[1]);
 	if (idx >= NUM_INVENTORY_ITEMS) {
 		debugPrintf("given index exceeds the max allowed value of %i\n", NUM_INVENTORY_ITEMS - 1);
-		return false;
+		return true;
 	}
 	const uint8 val = argc == 3 ? atoi(argv[2]) : 0;
 	_engine->_gameState->inventoryFlags[idx] = val;
@@ -125,10 +129,25 @@ bool TwinEConsole::doSetInventoryFlag(int argc, const char **argv) {
 	return true;
 }
 
+bool TwinEConsole::doSetHolomapFlag(int argc, const char **argv) {
+	if (argc <= 1) {
+		debugPrintf("Expected to get a holomap flag index as first parameter\n");
+		return true;
+	}
+
+	const uint8 idx = atoi(argv[1]);
+	if (idx >= NUM_LOCATIONS) {
+		debugPrintf("given index exceeds the max allowed value of %i\n", NUM_LOCATIONS - 1);
+		return true;
+	}
+	_engine->_holomap->setHolomapPosition(idx);
+	return true;
+}
+
 bool TwinEConsole::doSetGameFlag(int argc, const char **argv) {
 	if (argc <= 1) {
 		debugPrintf("Expected to get a game flag index as first parameter\n");
-		return false;
+		return true;
 	}
 
 	const uint8 idx = atoi(argv[1]);
@@ -152,6 +171,38 @@ bool TwinEConsole::doPrintGameFlag(int argc, const char **argv) {
 	return true;
 }
 
+bool TwinEConsole::doPrintInventoryFlag(int argc, const char **argv) {
+	if (argc <= 1) {
+		for (int i = 0; i < NUM_INVENTORY_ITEMS; ++i) {
+			debugPrintf("[%03d] = %d\n", i, _engine->_gameState->inventoryFlags[i]);
+		}
+		return true;
+	}
+
+	const uint8 idx = atoi(argv[1]);
+	if (idx < NUM_INVENTORY_ITEMS) {
+		debugPrintf("[%03d] = %d\n", idx, _engine->_gameState->inventoryFlags[idx]);
+	}
+
+	return true;
+}
+
+bool TwinEConsole::doPrintHolomapFlag(int argc, const char **argv) {
+	if (argc <= 1) {
+		for (int i = 0; i < NUM_LOCATIONS; ++i) {
+			debugPrintf("[%03d] = %d\n", i, _engine->_gameState->holomapFlags[i]);
+		}
+		return true;
+	}
+
+	const uint8 idx = atoi(argv[1]);
+	if (idx < NUM_LOCATIONS) {
+		debugPrintf("[%03d] = %d\n", idx, _engine->_gameState->holomapFlags[idx]);
+	}
+
+	return true;
+}
+
 bool TwinEConsole::doGiveKey(int argc, const char **argv) {
 	int amount = 1;
 	if (argc >= 2) {
diff --git a/engines/twine/debugger/console.h b/engines/twine/debugger/console.h
index d3f16bd525..7199d1aeca 100644
--- a/engines/twine/debugger/console.h
+++ b/engines/twine/debugger/console.h
@@ -36,6 +36,8 @@ private:
 
 	bool doPlayVideo(int argc, const char **argv);
 	bool doPrintGameFlag(int argc, const char **argv);
+	bool doPrintInventoryFlag(int argc, const char **argv);
+	bool doPrintHolomapFlag(int argc, const char **argv);
 	bool doSetHeroPosition(int argc, const char **argv);
 	bool doGiveAllItems(int argc, const char **argv);
 	bool doChangeScene(int argc, const char **argv);
@@ -49,6 +51,7 @@ private:
 	bool doSkipSceneActorsBut(int argc, const char **argv);
 	bool doSetGameFlag(int argc, const char **argv);
 	bool doSetInventoryFlag(int argc, const char **argv);
+	bool doSetHolomapFlag(int argc, const char **argv);
 	bool doAddMagicPoints(int argc, const char **argv);
 public:
 	TwinEConsole(TwinEEngine *engine);
diff --git a/engines/twine/holomap.cpp b/engines/twine/holomap.cpp
index 529a851cce..35a3c58f96 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -41,7 +41,7 @@ namespace TwinE {
 Holomap::Holomap(TwinEEngine *engine) : _engine(engine) {}
 
 bool Holomap::loadLocations() {
-	uint8 *locationsPtr;
+	uint8 *locationsPtr = nullptr;
 	const int32 locationsSize = HQR::getAllocEntry(&locationsPtr, Resources::HQR_RESS_FILE, RESSHQR_HOLOARROWINFO);
 	if (locationsSize == 0) {
 		warning("Could not find holomap locations at index %i in %s", RESSHQR_HOLOARROWINFO, Resources::HQR_RESS_FILE);
@@ -137,9 +137,10 @@ void Holomap::drawHolomapText(int32 centerx, int32 top, const char *title) {
 	const int32 size = _engine->_text->getTextSize(title);
 	const int32 x = centerx - size / 2;
 	const int32 y = top;
-	_engine->_text->setFontColor(15);
+	_engine->_text->setFontColor(COLOR_WHITE);
+	// TODO: handle @ newline
+	// TODO: faded in?
 	_engine->_text->drawText(x, y, title);
-	_engine->copyBlockPhys(x, y, x + 400, y + 100);
 }
 
 void Holomap::drawHolomapTrajectory(int32 trajectoryIndex) {
@@ -147,26 +148,34 @@ void Holomap::drawHolomapTrajectory(int32 trajectoryIndex) {
 	// TODO
 }
 
-void Holomap::drawHolomapLocation() {
+void Holomap::drawHolomapLocation(int32 location) {
 	char title[256] = "";
-	for (int i = 0; i < NUM_LOCATIONS; ++i) {
-		if (!(_engine->_gameState->holomapFlags[i] & 0x81)) {
-			continue;
-		}
-		_engine->_text->getMenuText(200 + _locations[i].textIndex, title, sizeof(title));
-		break;
-	}
+	_engine->_text->getMenuText(_locations[location].textIndex, title, sizeof(title));
 	const int padding = 17;
 	Common::Rect rect;
 	rect.left = padding - 1;
 	rect.top = _engine->height() - 146;
 	rect.right = _engine->width() - padding;
 	rect.bottom = _engine->height() - padding;
+	_engine->_interface->blitBox(rect, _engine->workVideoBuffer, _engine->frontVideoBuffer);
 	_engine->_menu->drawBox(rect);
 	rect.grow(-1);
 	_engine->_interface->drawTransparentBox(rect, 3);
+	_engine->_interface->blitBox(rect, _engine->frontVideoBuffer, _engine->workVideoBuffer);
 	const int32 height = _engine->_text->getCharHeight(title[0]);
 	drawHolomapText(rect.left + (rect.right - rect.left) / 2, rect.top + (rect.bottom - rect.top) / 2 - height / 2, title);
+	rect.grow(1);
+	_engine->copyBlockPhys(rect);
+}
+
+int32 Holomap::getNextHolomapLocation(int32 currentLocation, int dir) const {
+	const uint32 idx = currentLocation;
+	for (uint32 i = currentLocation + dir; i != idx; i = (i + dir) % NUM_LOCATIONS) {
+		if (_engine->_gameState->holomapFlags[i % NUM_LOCATIONS] & 0x81) {
+			return i;
+		}
+	}
+	return -1;
 }
 
 void Holomap::processHolomap() {
@@ -188,10 +197,14 @@ void Holomap::processHolomap() {
 	_engine->_text->initTextBank(TextBankId::Inventory_Intro_and_Holomap);
 	_engine->_text->setFontCrossColor(9);
 
-	drawHolomapText(_engine->width() / 2, 25, "Holomap"); // TODO: fix the index
-	drawHolomapLocation();
+	drawHolomapText(_engine->width() / 2, 25, "HoloMap"); // TODO: fix the index
+	int currentLocation = _engine->_scene->currentSceneIdx;
+	drawHolomapLocation(currentLocation);
 	_engine->flip();
 
+	// TODO: load RESSHQR_HOLOSURFACE and project the texture to the surface
+	//_engine->_screens->loadImage(RESSHQR_HOLOIMG, RESSHQR_HOLOPAL);
+
 	ScopedKeyMap holomapKeymap(_engine, holomapKeyMapId);
 	for (;;) {
 		FrameMarker frame;
@@ -202,7 +215,17 @@ void Holomap::processHolomap() {
 		}
 
 		if (_engine->_input->toggleActionIfActive(TwinEActionType::HolomapLeft)) {
+			const int32 nextLocation = getNextHolomapLocation(currentLocation, -1);
+			if (nextLocation != -1) {
+				currentLocation = nextLocation;
+				drawHolomapLocation(currentLocation);
+			}
 		} else if (_engine->_input->toggleActionIfActive(TwinEActionType::HolomapRight)) {
+			const int32 nextLocation = getNextHolomapLocation(currentLocation, 1);
+			if (nextLocation != -1) {
+				currentLocation = nextLocation;
+				drawHolomapLocation(currentLocation);
+			}
 		}
 
 		if (_engine->_input->toggleActionIfActive(TwinEActionType::HolomapUp)) {
diff --git a/engines/twine/holomap.h b/engines/twine/holomap.h
index 532aabda05..60a15c7637 100644
--- a/engines/twine/holomap.h
+++ b/engines/twine/holomap.h
@@ -55,7 +55,8 @@ private:
 	uint8 paletteHolomap[NUMOFCOLORS * 3]{0};
 
 	void drawHolomapText(int32 centerx, int32 top, const char *title);
-	void drawHolomapLocation();
+	void drawHolomapLocation(int32 location);
+	int32 getNextHolomapLocation(int32 currentLocation, int32 dir) const;
 
 public:
 	Holomap(TwinEEngine *engine);
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 8a65ae3bce..e005bff76f 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -219,6 +219,7 @@ Common::Error TwinEEngine::run() {
 	_screens->copyScreen(frontVideoBuffer, workVideoBuffer);
 
 	_menu->init();
+	_holomap->loadLocations();
 
 	if (ConfMan.hasKey("save_slot")) {
 		const int saveSlot = ConfMan.getInt("save_slot");




More information about the Scummvm-git-logs mailing list