[Scummvm-git-logs] scummvm master -> 56a58ecddf1d609320f1bd653477ac2f67306e8e

mgerhardy noreply at scummvm.org
Fri Sep 13 18:08:27 UTC 2024


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:
56a58ecddf TWINE: split holomap for lba1 and lba2


Commit: 56a58ecddf1d609320f1bd653477ac2f67306e8e
    https://github.com/scummvm/scummvm/commit/56a58ecddf1d609320f1bd653477ac2f67306e8e
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-09-13T20:08:22+02:00

Commit Message:
TWINE: split holomap for lba1 and lba2

Also fixed a few issues in loading the lba2 scene data

Changed paths:
  A engines/twine/holomap_v1.cpp
  A engines/twine/holomap_v1.h
  A engines/twine/holomap_v2.cpp
  A engines/twine/holomap_v2.h
  R engines/twine/holomap.cpp
    engines/twine/holomap.h
    engines/twine/menu/menu.cpp
    engines/twine/module.mk
    engines/twine/resources/resources.h
    engines/twine/scene/scene.cpp
    engines/twine/twine.cpp


diff --git a/engines/twine/holomap.h b/engines/twine/holomap.h
index 37d94577a77..51aabf75080 100644
--- a/engines/twine/holomap.h
+++ b/engines/twine/holomap.h
@@ -47,90 +47,35 @@ struct AnimTimerDataStruct;
  * text for the visible arrows.
  */
 class Holomap {
-private:
+protected:
 	TwinEEngine *_engine;
-
-	struct Location {
-		int16 alpha;
-		int16 beta;
-		int16 size;
-		TextId mess = TextId::kNone;
-		char name[30] = "";
-	};
-
-	IVec3 _holomapSurface[561];
-
-	// original game size: 2244 (lba1)
-	struct HolomapSort {
-		int16 z = 0;
-		uint16 projectedPosIdx = 0;
-	};
-	HolomapSort _holomapSort[16 * 32];
-
-	struct HolomapProjectedPos {
-		uint16 x1 = 0;
-		uint16 y1 = 0;
-		uint16 x2 = 0;
-		uint16 y2 = 0;
-	};
-	HolomapProjectedPos _projectedSurfacePositions[561];
-	int _projectedSurfaceIndex = 0;
-	//float _distanceModifier = 1.0f;
-
-	int32 _numHoloPos = 0;
-	Location _listHoloPos[MAX_HOLO_POS_2];
-
-	int32 _holomapPaletteIndex = 0;
-	uint8 _paletteHolomap[NUMOFCOLORS * 3]{0};
-
-	void drawHolomapText(int32 centerx, int32 top, const char *title);
-	int32 searchNextArrow(int32 num) const;
-	int32 searchPrevArrow(int32 num) const;
-
-	void drawListPos(int xRot, int yRot, int zRot, bool lower);
-
-	/**
-	 * Renders a holomap path with single path points appearing slowly one after another
-	 */
-	void drawHoloObj(const IVec3 &angle, int32 x, int32 y);
-	void computeCoorGlobe(Common::SeekableReadStream *holomapSurfaceStream);
-	void computeCoorMapping();
-	void computeGlobeProj();
-	void drawHoloMap(uint8 *holomapImage, uint32 holomapImageSize);
-	void renderHolomapVehicle(uint &frameNumber, ActorMoveStruct &move, AnimTimerDataStruct &animTimerData, BodyData &bodyData, AnimData &animData);
-
-	/**
-	 * Controls the size/zoom of the holomap planet
-	 */
-	int32 distance(float distance) const;
-	int32 scale(float val) const;
-
 public:
-	Holomap(TwinEEngine *engine);
+	Holomap(TwinEEngine *engine) : _engine(engine) {}
+	virtual ~Holomap() = default;
 
 	/**
 	 * Set Holomap location position
 	 * @param locationIdx Scene where position must be set
 	 */
-	bool setHoloPos(int32 locationIdx);
+	virtual bool setHoloPos(int32 locationIdx) = 0;
 
-	bool loadLocations();
+	virtual bool loadLocations() = 0;
 
-	const char *getLocationName(int index) const;
+	virtual const char *getLocationName(int index) const = 0;
 
 	/**
 	 * Clear Holomap location position
 	 * @param locationIdx Scene where position must be cleared
 	 */
-	void clrHoloPos(int32 locationIdx);
+	virtual void clrHoloPos(int32 locationIdx) = 0;
 
-	void drawHolomapTrajectory(int32 trajectoryIndex);
+	virtual void drawHolomapTrajectory(int32 trajectoryIndex) = 0;
 
 	/** Load Holomap content */
-	void initHoloDatas();
+	virtual void initHoloDatas() = 0;
 
 	/** Main holomap process loop */
-	void holoMap();
+	virtual void holoMap() = 0;
 };
 
 } // namespace TwinE
diff --git a/engines/twine/holomap.cpp b/engines/twine/holomap_v1.cpp
similarity index 94%
rename from engines/twine/holomap.cpp
rename to engines/twine/holomap_v1.cpp
index f81d7132711..46109233a3f 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap_v1.cpp
@@ -19,7 +19,7 @@
  *
  */
 
-#include "twine/holomap.h"
+#include "twine/holomap_v1.h"
 #include "common/algorithm.h"
 #include "common/debug.h"
 #include "common/memstream.h"
@@ -46,37 +46,35 @@
 namespace TwinE {
 
 // these are lba1 specific
-#define HOLOMAP_ARROW		(1 << 0)
-#define HOLOMAP_VISITED		(1 << 1)
-#define HOLOMAP_UNK3		(1 << 2)
-#define HOLOMAP_UNK4		(1 << 3)
-#define HOLOMAP_UNK5		(1 << 4)
-#define HOLOMAP_UNK6		(1 << 5)
-#define HOLOMAP_CUBE_DONE	(1 << 6)
-#define HOLOMAP_CAN_FOCUS	(1 << 7)
-#define HOLOMAP_ACTIVE		(HOLOMAP_CAN_FOCUS | HOLOMAP_ARROW)
+#define HOLOMAP_ARROW (1 << 0)
+#define HOLOMAP_VISITED (1 << 1)
+#define HOLOMAP_UNK3 (1 << 2)
+#define HOLOMAP_UNK4 (1 << 3)
+#define HOLOMAP_UNK5 (1 << 4)
+#define HOLOMAP_UNK6 (1 << 5)
+#define HOLOMAP_CUBE_DONE (1 << 6)
+#define HOLOMAP_CAN_FOCUS (1 << 7)
+#define HOLOMAP_ACTIVE (HOLOMAP_CAN_FOCUS | HOLOMAP_ARROW)
 
 static const float ZOOM_BIG_HOLO = 9500.0f;
 static const float zDistanceTrajectory = 5300.0f;
 static const int SIZE_CURSOR = 20;
 
-Holomap::Holomap(TwinEEngine *engine) : _engine(engine) {}
-
-int32 Holomap::distance(float distance) const {
+int32 HolomapV1::distance(float distance) const {
 	const float w = (float)_engine->width() / (float)_engine->originalWidth();
 	const float h = (float)_engine->height() / (float)_engine->originalHeight();
 	const float f = MIN<float>(w, h);
 	return (int32)(distance / f);
 }
 
-int32 Holomap::scale(float val) const {
+int32 HolomapV1::scale(float val) const {
 	const float w = (float)_engine->width() / (float)_engine->originalWidth();
 	const float h = (float)_engine->height() / (float)_engine->originalHeight();
 	const float f = MIN<float>(w, h);
 	return (int32)(val * f);
 }
 
-bool Holomap::loadLocations() {
+bool HolomapV1::loadLocations() {
 	uint8 *locationsPtr = nullptr;
 	const int32 locationsSize = HQR::getAllocEntry(&locationsPtr, Resources::HQR_RESS_FILE, RESSHQR_HOLOARROWINFO);
 	if (locationsSize == 0) {
@@ -107,7 +105,7 @@ bool Holomap::loadLocations() {
 	return true;
 }
 
-bool Holomap::setHoloPos(int32 locationIdx) {
+bool HolomapV1::setHoloPos(int32 locationIdx) {
 	assert(locationIdx >= 0 && locationIdx < _engine->numHoloPos());
 	if (_engine->isLBA1()) {
 		_engine->_gameState->_holomapFlags[locationIdx] = HOLOMAP_ACTIVE;
@@ -118,13 +116,13 @@ bool Holomap::setHoloPos(int32 locationIdx) {
 	return true;
 }
 
-void Holomap::clrHoloPos(int32 locationIdx) {
+void HolomapV1::clrHoloPos(int32 locationIdx) {
 	assert(locationIdx >= 0 && locationIdx <= ARRAYSIZE(_engine->_gameState->_holomapFlags));
 	_engine->_gameState->_holomapFlags[locationIdx] &= ~HOLOMAP_ACTIVE;
 	_engine->_gameState->_holomapFlags[locationIdx] |= HOLOMAP_CUBE_DONE;
 }
 
-void Holomap::initHoloDatas() {
+void HolomapV1::initHoloDatas() {
 	constexpr TwineResource resource(Resources::HQR_RESS_FILE, RESSHQR_HOLOPAL);
 	_engine->_screens->loadCustomPalette(resource);
 
@@ -154,7 +152,7 @@ void Holomap::initHoloDatas() {
 	_holomapPaletteIndex = 0;
 }
 
-void Holomap::computeCoorGlobe(Common::SeekableReadStream *holomapSurfaceStream) {
+void HolomapV1::computeCoorGlobe(Common::SeekableReadStream *holomapSurfaceStream) {
 	int holomapSurfaceArrayIdx = 0;
 	_engine->_renderer->setAngleCamera(0, 0, 0);
 	for (int alpha = -LBAAngles::ANGLE_90; alpha <= LBAAngles::ANGLE_90; alpha += LBAAngles::ANGLE_11_25) {
@@ -183,7 +181,7 @@ void Holomap::computeCoorGlobe(Common::SeekableReadStream *holomapSurfaceStream)
 	assert(holomapSurfaceStream->eos());
 }
 
-void Holomap::computeCoorMapping() {
+void HolomapV1::computeCoorMapping() {
 	int projectedIndex = 0;
 	for (int32 alpha = -LBAAngles::ANGLE_90; alpha <= LBAAngles::ANGLE_90; alpha += LBAAngles::ANGLE_11_25) {
 		for (int32 beta = 0; beta < LBAAngles::ANGLE_360; beta += LBAAngles::ANGLE_11_25) {
@@ -205,7 +203,7 @@ void Holomap::computeCoorMapping() {
 	}
 }
 
-void Holomap::computeGlobeProj() {
+void HolomapV1::computeGlobeProj() {
 	int holomapSortArrayIdx = 0;
 	int holomapSurfaceArrayIdx = 0;
 	_projectedSurfaceIndex = 0;
@@ -237,7 +235,7 @@ void Holomap::computeGlobeProj() {
 }
 
 #define SURFACE_POS_OFFSET ((LBAAngles::ANGLE_360 / LBAAngles::ANGLE_11_25) + 1)
-void Holomap::drawHoloMap(uint8 *holomapImage, uint32 holomapImageSize) {
+void HolomapV1::drawHoloMap(uint8 *holomapImage, uint32 holomapImageSize) {
 	computeGlobeProj();
 	for (int32 i = 0; i < ARRAYSIZE(_holomapSort); ++i) {
 		assert(_holomapSort[i].projectedPosIdx + 34 < _projectedSurfaceIndex);
@@ -283,7 +281,7 @@ void Holomap::drawHoloMap(uint8 *holomapImage, uint32 holomapImageSize) {
 	}
 }
 
-void Holomap::drawHolomapText(int32 centerx, int32 top, const char *title) {
+void HolomapV1::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;
@@ -291,7 +289,7 @@ void Holomap::drawHolomapText(int32 centerx, int32 top, const char *title) {
 	_engine->_text->drawText(x, y, title);
 }
 
-void Holomap::drawHoloObj(const IVec3 &angle, int32 alpha, int32 beta) {
+void HolomapV1::drawHoloObj(const IVec3 &angle, int32 alpha, int32 beta) {
 	_engine->_renderer->setAngleCamera(alpha, beta, 0);
 	const IVec3 &m = _engine->_renderer->worldRotatePoint(IVec3(0, 0, 1000));
 	_engine->_renderer->setFollowCamera(0, 0, 0, angle.x, angle.y, angle.z, distance(zDistanceTrajectory));
@@ -301,7 +299,7 @@ void Holomap::drawHoloObj(const IVec3 &angle, int32 alpha, int32 beta) {
 	_engine->copyBlockPhys(dirtyRect);
 }
 
-void Holomap::renderHolomapVehicle(uint &frameNumber, ActorMoveStruct &move, AnimTimerDataStruct &animTimerData, BodyData &bodyData, AnimData &animData) {
+void HolomapV1::renderHolomapVehicle(uint &frameNumber, ActorMoveStruct &move, AnimTimerDataStruct &animTimerData, BodyData &bodyData, AnimData &animData) {
 	const int16 newAngle = move.getRealAngle(_engine->timerRef);
 	if (move.timeValue == 0) {
 		_engine->_movements->initRealAngle(LBAAngles::ANGLE_0, -LBAAngles::ANGLE_90, 500, &move);
@@ -324,7 +322,7 @@ void Holomap::renderHolomapVehicle(uint &frameNumber, ActorMoveStruct &move, Ani
 	_engine->copyBlockPhys(rect);
 }
 
-void Holomap::drawHolomapTrajectory(int32 trajectoryIndex) {
+void HolomapV1::drawHolomapTrajectory(int32 trajectoryIndex) {
 	if (_engine->isDemo()) {
 		return;
 	}
@@ -434,7 +432,7 @@ void Holomap::drawHolomapTrajectory(int32 trajectoryIndex) {
 	free(holomapImagePtr);
 }
 
-int32 Holomap::searchNextArrow(int32 num) const {
+int32 HolomapV1::searchNextArrow(int32 num) const {
 	const int maxLocations = _engine->numHoloPos();
 	for (int32 n = num + 1; n < maxLocations; ++n) {
 		if ((_engine->_gameState->_holomapFlags[n] & HOLOMAP_ACTIVE) != 0u) {
@@ -444,7 +442,7 @@ int32 Holomap::searchNextArrow(int32 num) const {
 	return -1;
 }
 
-int32 Holomap::searchPrevArrow(int32 num) const {
+int32 HolomapV1::searchPrevArrow(int32 num) const {
 	int32 n;
 	const int maxLocations = _engine->numHoloPos();
 
@@ -460,7 +458,7 @@ int32 Holomap::searchPrevArrow(int32 num) const {
 	return -1;
 }
 
-void Holomap::drawListPos(int calpha, int cbeta, int cgamma, bool pos) {
+void HolomapV1::drawListPos(int calpha, int cbeta, int cgamma, bool pos) {
 	int nbobjets = 0;
 	DrawListStruct listTri[MAX_HOLO_POS_2];
 	const int numCube = _engine->_scene->_currentSceneIdx;
@@ -523,7 +521,7 @@ void Holomap::drawListPos(int calpha, int cbeta, int cgamma, bool pos) {
 	}
 }
 
-void Holomap::holoMap() {
+void HolomapV1::holoMap() {
 	const int32 alphaLightTmp = _engine->_scene->_alphaLight;
 	const int32 betaLightTmp = _engine->_scene->_betaLight;
 
@@ -692,7 +690,7 @@ void Holomap::holoMap() {
 	free(holomapImagePtr);
 }
 
-const char *Holomap::getLocationName(int index) const {
+const char *HolomapV1::getLocationName(int index) const {
 	assert(index >= 0 && index <= ARRAYSIZE(_listHoloPos));
 	return _listHoloPos[index].name;
 }
diff --git a/engines/twine/holomap_v1.h b/engines/twine/holomap_v1.h
new file mode 100644
index 00000000000..e3d8b896239
--- /dev/null
+++ b/engines/twine/holomap_v1.h
@@ -0,0 +1,127 @@
+/* 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 TWINE_HOLOMAPV1_H
+#define TWINE_HOLOMAPV1_H
+
+#include "twine/holomap.h"
+
+#define NUM_HOLOMAPCOLORS 32
+#define HOLOMAP_PALETTE_INDEX 192
+
+namespace TwinE {
+
+/**
+ * The Holomap shows the hero position. The arrows (@c RESSHQR_HOLOARROWMDL) represent important places in your quest - they automatically disappear once that part of
+ * the quest is done (@c clearHolomapPosition()). You can rotate the holoamp by pressing ctrl+cursor keys - but only using the cursor keys, you can scroll through the
+ * text for the visible arrows.
+ */
+class HolomapV1 : public Holomap {
+private:
+	using Super = Holomap;
+
+	struct Location {
+		int16 alpha;
+		int16 beta;
+		int16 size;
+		TextId mess = TextId::kNone;
+		char name[30] = "";
+	};
+
+	IVec3 _holomapSurface[561];
+
+	// original game size: 2244 (lba1)
+	struct HolomapSort {
+		int16 z = 0;
+		uint16 projectedPosIdx = 0;
+	};
+	HolomapSort _holomapSort[16 * 32];
+
+	struct HolomapProjectedPos {
+		uint16 x1 = 0;
+		uint16 y1 = 0;
+		uint16 x2 = 0;
+		uint16 y2 = 0;
+	};
+	HolomapProjectedPos _projectedSurfacePositions[561];
+	int _projectedSurfaceIndex = 0;
+	// float _distanceModifier = 1.0f;
+
+	int32 _numHoloPos = 0;
+	Location _listHoloPos[MAX_HOLO_POS_2];
+
+	int32 _holomapPaletteIndex = 0;
+	uint8 _paletteHolomap[NUMOFCOLORS * 3]{0};
+
+	void drawHolomapText(int32 centerx, int32 top, const char *title);
+	int32 searchNextArrow(int32 num) const;
+	int32 searchPrevArrow(int32 num) const;
+
+	void drawListPos(int xRot, int yRot, int zRot, bool lower);
+
+	/**
+	 * Renders a holomap path with single path points appearing slowly one after another
+	 */
+	void drawHoloObj(const IVec3 &angle, int32 x, int32 y);
+	void computeCoorGlobe(Common::SeekableReadStream *holomapSurfaceStream);
+	void computeCoorMapping();
+	void computeGlobeProj();
+	void drawHoloMap(uint8 *holomapImage, uint32 holomapImageSize);
+	void renderHolomapVehicle(uint &frameNumber, ActorMoveStruct &move, AnimTimerDataStruct &animTimerData, BodyData &bodyData, AnimData &animData);
+
+	/**
+	 * Controls the size/zoom of the holomap planet
+	 */
+	int32 distance(float distance) const;
+	int32 scale(float val) const;
+
+public:
+	HolomapV1(TwinEEngine *engine) : Super(engine) {}
+	virtual ~HolomapV1() = default;
+
+	/**
+	 * Set Holomap location position
+	 * @param locationIdx Scene where position must be set
+	 */
+	bool setHoloPos(int32 locationIdx) override;
+
+	bool loadLocations() override;
+
+	const char *getLocationName(int index) const override;
+
+	/**
+	 * Clear Holomap location position
+	 * @param locationIdx Scene where position must be cleared
+	 */
+	void clrHoloPos(int32 locationIdx) override;
+
+	void drawHolomapTrajectory(int32 trajectoryIndex) override;
+
+	/** Load Holomap content */
+	void initHoloDatas() override;
+
+	/** Main holomap process loop */
+	void holoMap() override;
+};
+
+} // namespace TwinE
+
+#endif
diff --git a/engines/twine/holomap_v2.cpp b/engines/twine/holomap_v2.cpp
new file mode 100644
index 00000000000..03c8d185f53
--- /dev/null
+++ b/engines/twine/holomap_v2.cpp
@@ -0,0 +1,56 @@
+/* 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 "twine/holomap_v2.h"
+#include "twine/resources/hqr.h"
+#include "twine/resources/resources.h"
+
+namespace TwinE {
+
+bool HolomapV2::setHoloPos(int32 locationIdx) {
+	return false;
+}
+
+bool HolomapV2::loadLocations() {
+	// _locations[MAX_OBJECTIF + 67].FlagHolo = 1; //	Desert Globe
+	return HQR::getEntry((uint8 *)_locations, Resources::HQR_HOLOMAP_FILE, RESSHQR_ARROWBIN) != 0;
+}
+
+const char *HolomapV2::getLocationName(int index) const {
+	if (index >= 0 && index < ARRAYSIZE(_locations)) {
+		// TODO: return _locations[index].;
+	}
+	return "";
+}
+
+void HolomapV2::clrHoloPos(int32 locationIdx) {
+}
+
+void HolomapV2::drawHolomapTrajectory(int32 trajectoryIndex) {
+}
+
+void HolomapV2::initHoloDatas() {
+}
+
+void HolomapV2::holoMap() {
+}
+
+} // namespace TwinE
diff --git a/engines/twine/holomap_v2.h b/engines/twine/holomap_v2.h
new file mode 100644
index 00000000000..3de4ece4758
--- /dev/null
+++ b/engines/twine/holomap_v2.h
@@ -0,0 +1,88 @@
+/* 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 TWINE_HOLOMAPV2_H
+#define TWINE_HOLOMAPV2_H
+
+#include "twine/holomap.h"
+
+#define MAX_OBJECTIF 50
+#define MAX_CUBE 255
+
+namespace TwinE {
+
+/**
+ * The Holomap shows the hero position. The arrows (@c RESSHQR_HOLOARROWMDL) represent important places in your quest - they automatically disappear once that part of
+ * the quest is done (@c clearHolomapPosition()). You can rotate the holoamp by pressing ctrl+cursor keys - but only using the cursor keys, you can scroll through the
+ * text for the visible arrows.
+ */
+class HolomapV2 : public Holomap {
+private:
+	using Super = Holomap;
+
+public:
+	HolomapV2(TwinEEngine *engine) : Super(engine) {}
+	virtual ~HolomapV2() = default;
+
+	struct Location {
+		int32 X; // Position Island X Y Z
+		int32 Y;
+		int32 Z;
+		int32 Alpha; // Position Planet Alpha, Beta and Altitude
+		int32 Beta;
+		int32 Alt;
+		int32 Mess;
+		int8 ObjFix;    // Eventual Obj Inventory 3D (FREE NOT USED!)
+		uint8 FlagHolo; // Flag for Planet display, active, etc.
+		uint8 Planet;
+		uint8 Island;
+	};
+	static_assert(sizeof(Location) == 32, "Invalid Location size");
+	Location _locations[MAX_OBJECTIF + MAX_CUBE];
+
+	/**
+	 * Set Holomap location position
+	 * @param locationIdx Scene where position must be set
+	 */
+	bool setHoloPos(int32 locationIdx) override;
+
+	bool loadLocations() override;
+
+	const char *getLocationName(int index) const override;
+
+	/**
+	 * Clear Holomap location position
+	 * @param locationIdx Scene where position must be cleared
+	 */
+	void clrHoloPos(int32 locationIdx) override;
+
+	void drawHolomapTrajectory(int32 trajectoryIndex) override;
+
+	/** Load Holomap content */
+	void initHoloDatas() override;
+
+	/** Main holomap process loop */
+	void holoMap() override;
+};
+
+} // namespace TwinE
+
+#endif
diff --git a/engines/twine/menu/menu.cpp b/engines/twine/menu/menu.cpp
index e043b9ca7df..c01b8ec06cc 100644
--- a/engines/twine/menu/menu.cpp
+++ b/engines/twine/menu/menu.cpp
@@ -94,8 +94,6 @@ static MenuSettings createMainMenu(bool lba1) {
 		settings.setButtonsBoxHeight(335);
 		settings.addButton(TextId::toContinueGame);
 		settings.addButton(TextId::toNewGame);
-		settings.addButton(TextId::toLoadGame);
-		settings.addButton(TextId::toSauver);
 		settings.addButton(TextId::toOptions);
 		settings.addButton(TextId::toQuit);
 	}
diff --git a/engines/twine/module.mk b/engines/twine/module.mk
index 5e4c4e35e40..0518d107fef 100644
--- a/engines/twine/module.mk
+++ b/engines/twine/module.mk
@@ -52,7 +52,8 @@ MODULE_OBJS := \
 	resources/resources.o \
 	\
 	movies.o \
-	holomap.o \
+	holomap_v1.o \
+	holomap_v2.o \
 	input.o \
 	metaengine.o \
 	shared.o \
diff --git a/engines/twine/resources/resources.h b/engines/twine/resources/resources.h
index 1567ef08a52..b4667a90246 100644
--- a/engines/twine/resources/resources.h
+++ b/engines/twine/resources/resources.h
@@ -51,6 +51,7 @@ namespace TwinE {
 
 #define RESSHQR_BLACKPAL 9   // lba2
 #define RESSHQR_ECLAIRPAL 10 // lba2
+#define RESSHQR_ARROWBIN 12  // lba2
 #define SAMPLE_RAIN 13
 
 #define RESSHQR_GAMEOVERMDL 21
@@ -242,6 +243,8 @@ public:
 	static constexpr const char *HQR_ANIM3DS_FILE = "anim3ds.hqr";
 	// inventory objects
 	static constexpr const char *HQR_INVOBJ_FILE = "invobj.hqr";
+	// lba2 holomap
+	static constexpr const char *HQR_HOLOMAP_FILE = "holomap.hqr";
 
 	/**
 	 * @brief Floppy version of the game uses gifs for replacing the videos
diff --git a/engines/twine/scene/scene.cpp b/engines/twine/scene/scene.cpp
index 8e97158c254..246d4742719 100644
--- a/engines/twine/scene/scene.cpp
+++ b/engines/twine/scene/scene.cpp
@@ -202,8 +202,8 @@ bool Scene::loadSceneLBA2() {
 
 	/*uint8 n =*/ stream.readByte();
 
-	_alphaLight = ClampAngle((int16)stream.readUint16LE());
-	_betaLight = ClampAngle((int16)stream.readUint16LE());
+	_alphaLight = ClampAngle(stream.readSint16LE());
+	_betaLight = ClampAngle(stream.readSint16LE());
 	debug(2, "Using %i and %i as light vectors", _alphaLight, _betaLight);
 
 	for (int i = 0; i < 4; ++i) {
@@ -232,8 +232,6 @@ bool Scene::loadSceneLBA2() {
 	_sceneHero->_lifeScript = _currentScene + stream.pos();
 	stream.skip(_sceneHero->_lifeScriptSize);
 
-	/*uint32 checksum =*/ stream.readUint32LE();
-
 	_nbObjets = (int16)stream.readUint16LE();
 	int cnt = 1;
 	for (int32 a = 1; a < _nbObjets; a++, cnt++) {
@@ -243,8 +241,8 @@ bool Scene::loadSceneLBA2() {
 
 		loadModel(*act, (int16)stream.readUint16LE(), false);
 
-		act->_genBody = (BodyType)stream.readSint16LE();
-		act->_genAnim = (AnimationTypes)stream.readByte();
+		act->_genBody = (BodyType)stream.readByte();
+		act->_genAnim = (AnimationTypes)stream.readSint16LE();
 		act->_sprite = (int16)stream.readUint16LE();
 		act->_posObj.x = (int16)stream.readUint16LE();
 		act->_posObj.y = (int16)stream.readUint16LE();
@@ -253,8 +251,8 @@ bool Scene::loadSceneLBA2() {
 		act->_strengthOfHit = stream.readByte();
 		setBonusParameterFlags(act, stream.readUint16LE());
 		act->_beta = (int16)stream.readUint16LE();
-		act->_speed = (int16)stream.readUint16LE();
-		act->_controlMode = (ControlMode)stream.readByte();
+		act->_speed = (int16)stream.readUint16LE(); // srot
+		act->_controlMode = (ControlMode)stream.readByte(); // move
 		act->_cropLeft = stream.readSint16LE();
 		act->_delayInMillis = act->_cropLeft; // TODO: this might not be needed
 		act->_cropTop = stream.readSint16LE();
@@ -285,6 +283,8 @@ bool Scene::loadSceneLBA2() {
 		}
 	}
 
+	/* uint32 checksum = */stream.readUint32LE();
+
 	_sceneNumZones = (int16)stream.readUint16LE();
 	for (int32 i = 0; i < _sceneNumZones; i++) {
 		ZoneStruct *zone = &_sceneZones[i];
@@ -317,7 +317,7 @@ bool Scene::loadSceneLBA2() {
 		point->z = stream.readSint32LE();
 	}
 
-	uint16 sceneNumPatches = stream.readUint16LE();
+	uint16 sceneNumPatches = stream.readUint32LE();
 	for (uint16 i = 0; i < sceneNumPatches; i++) {
 		/*size = */stream.readUint16LE();
 		/*offset = */stream.readUint16LE();
@@ -560,11 +560,7 @@ void Scene::changeCube() {
 	_previousSceneIdx = _currentSceneIdx;
 	_currentSceneIdx = _needChangeScene;
 
-	if (_engine->isLBA1() && _currentSceneIdx >= LBA1SceneId::Citadel_Island_Prison && _currentSceneIdx < LBA1SceneId::SceneIdMax) {
-		snprintf(_engine->_gameState->_sceneName, sizeof(_engine->_gameState->_sceneName), "%i %s", _currentSceneIdx, _engine->_holomap->getLocationName(_currentSceneIdx));
-	} else {
-		snprintf(_engine->_gameState->_sceneName, sizeof(_engine->_gameState->_sceneName), "%i", _currentSceneIdx);
-	}
+	snprintf(_engine->_gameState->_sceneName, sizeof(_engine->_gameState->_sceneName), "%i %s", _currentSceneIdx, _engine->_holomap->getLocationName(_currentSceneIdx));
 	debug(2, "Entering scene %s (came from %i)", _engine->_gameState->_sceneName, _previousSceneIdx);
 
 	if (_engine->isLBA1()) {
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index e4c12f999ce..923fd7a4b20 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -45,7 +45,8 @@
 #include "twine/debugger/debug_grid.h"
 #include "twine/debugger/debug_scene.h"
 #include "twine/detection.h"
-#include "twine/holomap.h"
+#include "twine/holomap_v1.h"
+#include "twine/holomap_v2.h"
 #include "twine/input.h"
 #include "twine/menu/interface.h"
 #include "twine/menu/menu.h"
@@ -210,6 +211,7 @@ TwinEEngine::TwinEEngine(OSystem *system, Common::Language language, uint32 flag
 	if (isLBA1()) {
 		_scriptLife = new ScriptLifeV1(this);
 		_scriptMove = new ScriptMoveV1(this);
+		_holomap = new HolomapV1(this);
 	} else {
 		_scriptLife = new ScriptLifeV2(this);
 		_scriptMove = new ScriptMoveV2(this);
@@ -217,8 +219,8 @@ TwinEEngine::TwinEEngine(OSystem *system, Common::Language language, uint32 flag
 		_dart = new Dart(this);
 		_rain = new Rain(this);
 		_wagon = new Wagon(this);
+		_holomap = new HolomapV2(this);
 	}
-	_holomap = new Holomap(this);
 	_sound = new Sound(this);
 	_text = new Text(this);
 	_debugGrid = new DebugGrid(this);




More information about the Scummvm-git-logs mailing list