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

mduggan noreply at scummvm.org
Mon Feb 27 02:38:41 UTC 2023


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

Summary:
569286c9c7 TETRAEDGE: Drop error to warning as it happens in Syberia 2
6b97ff2cff TETRAEDGE: Syberia 2 doesn't claim to be Android
f11ad9852a TETRAEDGE: Optimize renderer array resizing a little
14e6169542 TETRAEDGE: Initialize array to the right size
51c76a1953 TETRAEDGE: Implement Syberia 2 particles
7b6118c497 TETRAEDGE: Fix loading uncompressed Syberia 2 models
30f84f65fa TETRAEDGE: Fix SetModelPlayer for Syberia 2
3e1ffd43a7 TETRAEDGE: Silence some overly chatty debug messages
1a15289668 TETRAEDGE: Correct marker scale on scrolling Syberia 2 scenes
c7c2141d0a TETRAEDGE: Add workaround for PlaySound lua bug in Syberia 2


Commit: 569286c9c7423cafdf46f67cfa43c7a93b07b123
    https://github.com/scummvm/scummvm/commit/569286c9c7423cafdf46f67cfa43c7a93b07b123
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-02-27T11:37:31+09:00

Commit Message:
TETRAEDGE: Drop error to warning as it happens in Syberia 2

Changed paths:
    engines/tetraedge/game/dialog2.cpp


diff --git a/engines/tetraedge/game/dialog2.cpp b/engines/tetraedge/game/dialog2.cpp
index 2d762d73091..04b32693c29 100644
--- a/engines/tetraedge/game/dialog2.cpp
+++ b/engines/tetraedge/game/dialog2.cpp
@@ -69,17 +69,17 @@ void Dialog2::launchNextDialog() {
 		if (!_currentDialogData._charname.empty()) {
 			Character *c = game->scene().character(_currentDialogData._charname);
 			if (!c) {
-				error("[Dialog2::launchNextDialog] Character's \"%s\" doesn't exist", _currentDialogData._charname.c_str());
-			}
-
-			if (_currentDialogData._animBlend == 0.0f) {
-				if (!c->setAnimation(_currentDialogData._animfile, false, true))
-					error("[Dialog2::launchNextDialog] Character's animation \"%s\" doesn't exist for the character\"%s\"",
-							_currentDialogData._animfile.c_str(), _currentDialogData._charname.c_str());
+				warning("[Dialog2::launchNextDialog] Character's \"%s\" doesn't exist", _currentDialogData._charname.c_str());
 			} else {
-				if (!c->blendAnimation(_currentDialogData._animfile, _currentDialogData._animBlend, false, true))
-					error("[Dialog2::launchNextDialog] Character's animation \"%s\" doesn't exist for the character\"%s\"",
-							_currentDialogData._animfile.c_str(), _currentDialogData._charname.c_str());
+				if (_currentDialogData._animBlend == 0.0f) {
+					if (!c->setAnimation(_currentDialogData._animfile, false, true))
+						error("[Dialog2::launchNextDialog] Character's animation \"%s\" doesn't exist for the character\"%s\"",
+								_currentDialogData._animfile.c_str(), _currentDialogData._charname.c_str());
+				} else {
+					if (!c->blendAnimation(_currentDialogData._animfile, _currentDialogData._animBlend, false, true))
+						error("[Dialog2::launchNextDialog] Character's animation \"%s\" doesn't exist for the character\"%s\"",
+								_currentDialogData._animfile.c_str(), _currentDialogData._charname.c_str());
+				}
 			}
 		}
 		lockBtn->setVisible(true);


Commit: 6b97ff2cff013660b2f36ea57ad57e505cf5a511
    https://github.com/scummvm/scummvm/commit/6b97ff2cff013660b2f36ea57ad57e505cf5a511
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-02-27T11:37:31+09:00

Commit Message:
TETRAEDGE: Syberia 2 doesn't claim to be Android

Changed paths:
    engines/tetraedge/game/lua_binds.cpp


diff --git a/engines/tetraedge/game/lua_binds.cpp b/engines/tetraedge/game/lua_binds.cpp
index b0f0dc3bf51..d9a6ede9344 100644
--- a/engines/tetraedge/game/lua_binds.cpp
+++ b/engines/tetraedge/game/lua_binds.cpp
@@ -1536,7 +1536,9 @@ static int tolua_ExportedFunctions_SetVisibleButtonHelp00(lua_State *L) {
 }
 
 static bool TestFileFlagSystemFlag(const Common::String &flagname, const Common::String &val) {
-	if (flagname == "platform" && val == "Android")
+	// Syberia 1 always returns that it is Android. Syberia 2 doesn't.
+	if (g_engine->gameType() == TetraedgeEngine::kSyberia
+			&& flagname == "platform" && val == "Android")
 		return true;
 	return g_engine->getCore()->fileFlagSystemFlag(flagname) == val;
 }


Commit: f11ad9852aa5c229331010bb2598f4531064960d
    https://github.com/scummvm/scummvm/commit/f11ad9852aa5c229331010bb2598f4531064960d
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-02-27T11:37:31+09:00

Commit Message:
TETRAEDGE: Optimize renderer array resizing a little

Changed paths:
    engines/tetraedge/te/te_renderer.cpp


diff --git a/engines/tetraedge/te/te_renderer.cpp b/engines/tetraedge/te/te_renderer.cpp
index a8fbc0c0a56..1444ff9b49e 100644
--- a/engines/tetraedge/te/te_renderer.cpp
+++ b/engines/tetraedge/te/te_renderer.cpp
@@ -49,13 +49,19 @@ void TeRenderer::addTransparentMesh(const TeMesh &mesh, uint i1, uint tricount,
 		if (!tricount)
 			return;
 	}
-	_transparentMeshVertexes.resize((_numTransparentMeshes + tricount) * 3);
-	_transparentMeshNormals.resize((_numTransparentMeshes + tricount) * 3);
-	_transparentMeshCoords.resize((_numTransparentMeshes + tricount) * 3);
-	_transparentMeshColors.resize((_numTransparentMeshes + tricount) * 3);
-	_transparentMeshVertexNums.resize((_numTransparentMeshes + tricount) * 3);
 
-	int newPropsSize = _pendingTransparentMeshProperties + (mesh.shouldDrawMaybe() ? tricount : 1);
+	uint vertcount = (_numTransparentMeshes + tricount) * 3;
+	_transparentMeshVertexes.resize(vertcount);
+	_transparentMeshNormals.resize(vertcount);
+	_transparentMeshCoords.resize(vertcount);
+	_transparentMeshColors.resize(vertcount);
+	_transparentMeshVertexNums.resize(vertcount);
+
+	uint newPropsSize = _pendingTransparentMeshProperties + (mesh.shouldDrawMaybe() ? tricount : 1);
+	// Reserve blocks of 64 to avoid reallocating too much.
+	uint newPropsReserve = (newPropsSize / 64 + 1) * 64;
+	assert(newPropsReserve >= newPropsSize);
+	_transparentMeshProps.reserve(newPropsReserve);
 	_transparentMeshProps.resize(newPropsSize);
 	if (meshMode == TeMesh::MeshMode_Triangles) {
 		for (uint i = 0; i < tricount; i++) {


Commit: 14e6169542d6ba20a1d3398deaf99c2fb05d4b26
    https://github.com/scummvm/scummvm/commit/14e6169542d6ba20a1d3398deaf99c2fb05d4b26
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-02-27T11:37:31+09:00

Commit Message:
TETRAEDGE: Initialize array to the right size

Changed paths:
    engines/tetraedge/te/te_model.cpp


diff --git a/engines/tetraedge/te/te_model.cpp b/engines/tetraedge/te/te_model.cpp
index 6b16fbe5e24..baf975c08fa 100644
--- a/engines/tetraedge/te/te_model.cpp
+++ b/engines/tetraedge/te/te_model.cpp
@@ -186,8 +186,7 @@ void TeModel::update() {
 	//if (name().contains("Kate"))
 	//	debug("TeModel::update model %s", name().c_str());
 	if (_bones.size()) {
-		Common::Array<TeMatrix4x4> matricies;
-		matricies.resize(_bones.size());
+		Common::Array<TeMatrix4x4> matricies(_bones.size());
 		for (uint i = 0; i < _bones.size(); i++) {
 			const Bone &b = _bones[i];
 			const TeMatrix4x4 matrix = TeMatrix4x4::fromTRS(b._trs);
@@ -570,6 +569,7 @@ bool TeModel::loadMesh(Common::SeekableReadStream &stream, TeMesh &mesh) {
 }
 
 void TeModel::setQuad(const TeIntrusivePtr<Te3DTexture> &tex, const Common::Array<TeVector3f32> &verts, const TeColor &col) {
+	_meshes.clear();
 	Common::SharedPtr<TeMesh> mesh(TeMesh::makeInstance());
 	mesh->setConf(4, 4, TeMesh::MeshMode_TriangleStrip, 0, 0);
 	mesh->defaultMaterial(tex);


Commit: 51c76a1953f00fb20af4aaea18ab967243c52a9d
    https://github.com/scummvm/scummvm/commit/51c76a1953f00fb20af4aaea18ab967243c52a9d
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-02-27T11:37:31+09:00

Commit Message:
TETRAEDGE: Implement Syberia 2 particles

Changed paths:
    engines/tetraedge/game/in_game_scene.cpp
    engines/tetraedge/te/te_3d_object2.cpp
    engines/tetraedge/te/te_3d_object2.h
    engines/tetraedge/te/te_particle.cpp
    engines/tetraedge/te/te_particle.h


diff --git a/engines/tetraedge/game/in_game_scene.cpp b/engines/tetraedge/game/in_game_scene.cpp
index 36e2c6727a8..46ff7ba4561 100644
--- a/engines/tetraedge/game/in_game_scene.cpp
+++ b/engines/tetraedge/game/in_game_scene.cpp
@@ -554,6 +554,9 @@ void InGameScene::freeSceneObjects() {
 
 	// TODO: Clean up snows, waterCones, smokes, snowCones
 
+	_particles.clear();
+	TeParticle::deleteAll();
+
 	deleteAllCallback();
 	_markers.clear();
 
@@ -821,6 +824,15 @@ bool InGameScene::loadXml(const Common::String &zone, const Common::String &scen
 			error("InGameScene::loadXml: Can't parse %s", pnode.getPath().c_str());
 	}
 
+
+	TeMatrix4x4 camMatrix = currentCamera() ?
+		currentCamera()->worldTransformationMatrix() : TeMatrix4x4();
+	for (auto particle : _particles) {
+		particle->setMatrix(camMatrix);
+		particle->realTimer().start();
+		particle->update(particle->startLoop());
+	}
+
 	return true;
 }
 
diff --git a/engines/tetraedge/te/te_3d_object2.cpp b/engines/tetraedge/te/te_3d_object2.cpp
index 51b2a7f7894..a0c10113ab1 100644
--- a/engines/tetraedge/te/te_3d_object2.cpp
+++ b/engines/tetraedge/te/te_3d_object2.cpp
@@ -216,6 +216,10 @@ void Te3DObject2::setPosition(const TeVector3f32 &pos) {
 	_onParentWorldTransformationMatrixChangedSignal.call();
 }
 
+void Te3DObject2::setPositionFast(const TeVector3f32 &pos) {
+	_position = pos;
+}
+
 void Te3DObject2::setRotation(const TeQuaternion &rot) {
 	if (_rotation == rot)
 		return;
diff --git a/engines/tetraedge/te/te_3d_object2.h b/engines/tetraedge/te/te_3d_object2.h
index 0af3b054ca1..0b2631b0c44 100644
--- a/engines/tetraedge/te/te_3d_object2.h
+++ b/engines/tetraedge/te/te_3d_object2.h
@@ -118,6 +118,7 @@ public:
 	}
 	virtual void setParent(Te3DObject2 *newparent);  // note, probably should be Te*I*3DObject2 arg
 	virtual void setPosition(const TeVector3f32 &pos);
+	virtual void setPositionFast(const TeVector3f32 &pos);
 	virtual void setRotation(const TeQuaternion &rot);
 	virtual void setScale(const TeVector3f32 &newScale);
 	virtual void setSize(const TeVector3f32 &newSize);
diff --git a/engines/tetraedge/te/te_particle.cpp b/engines/tetraedge/te/te_particle.cpp
index 89878b2edda..55e0614608e 100644
--- a/engines/tetraedge/te/te_particle.cpp
+++ b/engines/tetraedge/te/te_particle.cpp
@@ -25,16 +25,19 @@
 
 namespace Tetraedge {
 
-//static const char *TE_PARTICLE_RANDOM_TABLE = "http://www.arkham-development.com/";
+static const char TE_PARTICLE_RANDOM_TABLE[] = "http://www.arkham-development.com/";
 
 
-TeParticle::TeParticle(TeScene *scene) : /*_scene(scene),*/ _size(0),
+TeParticle::TeParticle(TeScene *scene) : _scene(scene), _size(0),
 _colorTime(0), _time(0), _period(0), _particlePerPeriod(0),
 _enabled(false), _startLoop(0), _gravity(0), _randomDir(false) {
 	indexedParticles()->push_back(this);
+	_elementsPending.reserve(32);
 }
 
 TeParticle::~TeParticle() {
+	_elements.clear();
+	_elementsPending.clear();
 	Common::Array<TeParticle *> *parts = indexedParticles();
 	for (uint i = 0; i < parts->size(); i++) {
 		if ((*parts)[i] == this) {
@@ -53,14 +56,132 @@ bool TeParticle::loadTexture(const Common::String &filename) {
 	return _texture->load(texnode);
 }
 
+void TeParticle::setOrientation(const TeVector3f32 &orientation) {
+	// Divergence from original.. orientation is only ever used
+	// to calculate this matrix during update(), so just do it now.
+	_orientMatrix = TeMatrix4x4();
+	_orientMatrix.rotate(TeQuaternion::fromAxisAndAngle(TeVector3f32(1,  0, 0),
+							orientation.x() * M_PI / 180));
+	_orientMatrix.rotate(TeQuaternion::fromAxisAndAngle(TeVector3f32(0, -1, 0),
+							orientation.y() * M_PI / 180));
+	_orientMatrix.rotate(TeQuaternion::fromAxisAndAngle(TeVector3f32(0,  0, 1),
+							orientation.z() * M_PI / 180));
+}
+
+static const double PART_EPSILON = 4.656613e-10;
+
+// A kind of weird randomizer, but that's what the original does..
+static double _particleRandom() {
+	int i = g_engine->getRandomNumber(INT_MAX);
+	byte b = TE_PARTICLE_RANDOM_TABLE[g_engine->getRandomNumber(0x21)];
+	return (float)(i ^ b) * -2 * PART_EPSILON + 1;
+}
+
 void TeParticle::update(int val) {
 	if (val <= 0) {
 		_realTimer.timeElapsed();
 		return;
 	}
+
 	for (int i = 0; i < val; i++) {
-		// TODO: Finish me.
+		float timeOffset = (val < 2 ? _realTimer.timeFromLastTimeElapsed() / 1000.0f : _period);
+
+		_lastTime += timeOffset;
+		_lastTime = CLIP(_lastTime, 0, _period * 10);
+		if (_enabled && _period <= _lastTime) {
+			// Diverge from original.. precalculate these values to avoid
+			// redoing the math on every particle.
+			Common::Array<TeVector3f32> quad(4);
+			quad[0] = _matrix.mult3x3(TeVector3f32(-1, -1, 0));
+			quad[1] = _matrix.mult3x3(TeVector3f32( 1, -1, 0));
+			quad[2] = _matrix.mult3x3(TeVector3f32( 1,  1, 0));
+			quad[3] = _matrix.mult3x3(TeVector3f32(-1,  1, 0));
+			const TeQuaternion norot = TeQuaternion::fromEuler(TeVector3f32(0, 0, 0));
+			_lastTime = fmod(_lastTime, _period);
+			for (int p = 0; p < _particlePerPeriod; p++) {
+				TeIntrusivePtr<TeElement> elem;
+				if (_elementsPending.empty()) {
+					elem = new TeElement();
+					_elements.push_back(elem);
+				} else {
+					elem = _elementsPending.back();
+					_elements.push_back(elem);
+					_elementsPending.pop_back();
+					elem->_elapsedTime = 0;
+					elem->_yOffset = 0;
+				}
+
+				const TeVector3f32 posoffset(_particleRandom() * _volumeSize.x(),
+								_particleRandom() * _volumeSize.y(),
+								_particleRandom() * _volumeSize.z());
+				elem->setPositionFast(_position + (_orientMatrix * posoffset));
+
+				if (!_randomDir) {
+					elem->_direction = TeVector3f32(0, 0, 0);
+				} else {
+					const TeVector3f32 dirmod(_particleRandom(), _particleRandom(), _particleRandom());
+					if (_direction.length() >= 0.001f) {
+						elem->_direction = dirmod * _direction.length() / 2;
+					} else {
+						elem->_direction = dirmod / 4;
+					}
+				}
+
+				elem->setQuad(_texture, quad, TeColor(255, 0, 0, 0));
+				elem->setRotation(norot);
+				float sz = _size / 10;
+				elem->setScale(TeVector3f32(sz, sz, sz));
+				elem->_elapsedTime = 0;
+				_scene->models().push_back(elem.get());
+
+				if (_colorTime == 0) {
+					elem->setColor(_startColor);
+				} else {
+					elem->setColor(TeColor(0, 0, 0, 0));
+				}
+			}
+		}
+
+		for (auto eiter = _elements.begin(); eiter != _elements.end(); eiter++) {
+			TeIntrusivePtr<TeElement> elem = *eiter;
+			TeVector3f32 newpos = elem->position() + (_direction + elem->_direction) * timeOffset / 1000;
+			elem->setPositionFast(newpos);
+			float newTime = elem->_elapsedTime + timeOffset;
+			elem->_elapsedTime = newTime;
+			if (newTime <= _time) {
+				float alpha = _startColor.a();
+				if (newTime < _colorTime) {
+					alpha = (alpha * newTime) / _colorTime;
+				}
+				float endScale = newTime / _time;
+				float startScale = 1.0 - endScale;
+				elem->setColor(TeColor(_endColor.r() * endScale + _startColor.r() * startScale,
+								 _endColor.g() * endScale + _startColor.g() * startScale,
+								 _endColor.b() * endScale + _startColor.b() * startScale,
+								 _endColor.a() * endScale + alpha * startScale));
+				for (int i = -1; i < timeOffset / 100; i++) {
+					elem->_yOffset += _gravity / 1000;
+					elem->setPositionFast(elem->position() + TeVector3f32(0, elem->_yOffset, 0));
+				}
+			} else {
+				// This element is done.
+				_elementsPending.push_back(elem);
+				eiter = _elements.erase(eiter);
+				for (uint i = 0; i < _scene->models().size(); i++) {
+					if (_scene->models()[i].get() == elem.get()) {
+						_scene->models().remove_at(i);
+						break;
+					}
+				}
+			}
+		}
 	}
+
+	//debug("Updated particle texture %s, %d active %d pending",
+	//	_texture->getAccessName().c_str(), _elements.size(),
+	//	_elementsPending.size());
+
+	_realTimer.timeElapsed();
 }
 
 /*static*/
@@ -87,6 +208,15 @@ TeParticle *TeParticle::getIndexedParticle(int idx) {
 	return (*parts)[idx];
 }
 
+/*static*/
+void TeParticle::deleteAll() {
+	// Divergence from original - we keep auto pointers
+	// to the particles in the scene so don't delete
+	// them here.
+	Common::Array<TeParticle *> *parts = indexedParticles();
+	parts->clear();
+}
+
 /*static*/
 void TeParticle::updateAll(int val) {
 	Common::Array<TeParticle *> *parts = indexedParticles();
diff --git a/engines/tetraedge/te/te_particle.h b/engines/tetraedge/te/te_particle.h
index 39e45cddae7..f6493136ff2 100644
--- a/engines/tetraedge/te/te_particle.h
+++ b/engines/tetraedge/te/te_particle.h
@@ -33,7 +33,13 @@ namespace Tetraedge {
 
 class TeParticle : public TeReferencesCounter {
 public:
-	class TeElement : public TeReferencesCounter {};
+	class TeElement : public TeModel {
+		public:
+		TeElement() : _elapsedTime(0), _yOffset(0) {}
+		float _elapsedTime;
+		float _yOffset;
+		TeVector3f32 _direction;
+	};
 
 	TeParticle(TeScene *scene);
 	~TeParticle();
@@ -54,19 +60,25 @@ public:
 	void setStartLoop(int startloop) { _startLoop = startloop; }
 	void setGravity(float gravity) { _gravity = gravity; }
 	void setRandomDir(bool val) { _randomDir = val; }
-	void setOrientation(const TeVector3f32 &orientation) { _orientation = orientation; }
+	void setOrientation(const TeVector3f32 &orientation);
+	void setMatrix(const TeMatrix4x4 &mat) { _matrix = mat; }
 
 	void update(int val);
 
+	int startLoop() const { return _startLoop; }
+	TeRealTimer realTimer() { return _realTimer; }
+
 	static int getIndex(const Common::String &name);
 	static TeParticle *getIndexedParticle(int idx);
 	static void cleanup();
 
+	static void deleteAll();
 	static void updateAll(int val);
 
 private:
-	Common::Array<TeIntrusivePtr<TeElement>> _elements;
-	//TeScene *_scene;
+	Common::List<TeIntrusivePtr<TeElement>> _elements;
+	Common::Array<TeIntrusivePtr<TeElement>> _elementsPending;
+	TeScene *_scene;
 	TeRealTimer _realTimer;
 	Common::String _name;
 	TeIntrusivePtr<Te3DTexture> _texture;
@@ -76,15 +88,17 @@ private:
 	TeVector3f32 _volumeSize;
 	TeColor _startColor;
 	TeColor _endColor;
-	int	_colorTime;
-	int	_time;
-	int	_period;
-	int	_particlePerPeriod;
+	int _colorTime;
+	int _time;
+	int _lastTime;
+	int _period;
+	int _particlePerPeriod;
 	bool _enabled;
 	int _startLoop;
 	float _gravity;
 	bool _randomDir;
-	TeVector3f32 _orientation;
+	TeMatrix4x4 _matrix;
+	TeMatrix4x4 _orientMatrix;
 
 	static Common::Array<TeParticle *> *indexedParticles();
 	static Common::Array<TeParticle *> *_indexedParticles;


Commit: 7b6118c49786541ee355826dffad75b6a33bfb6a
    https://github.com/scummvm/scummvm/commit/7b6118c49786541ee355826dffad75b6a33bfb6a
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-02-27T11:37:31+09:00

Commit Message:
TETRAEDGE: Fix loading uncompressed Syberia 2 models

Changed paths:
    engines/tetraedge/te/te_3d_object2.cpp
    engines/tetraedge/te/te_model.cpp


diff --git a/engines/tetraedge/te/te_3d_object2.cpp b/engines/tetraedge/te/te_3d_object2.cpp
index a0c10113ab1..aa4e8611e83 100644
--- a/engines/tetraedge/te/te_3d_object2.cpp
+++ b/engines/tetraedge/te/te_3d_object2.cpp
@@ -327,7 +327,10 @@ bool Te3DObject2::loadAndCheckFourCC(Common::ReadStream &stream, const char *str
 	char buf[5];
 	buf[4] = '\0';
 	stream.read(buf, 4);
-	return !strncmp(buf, str, 4);
+	bool result = !strncmp(buf, str, 4);
+	if (!result)
+		debug("loadAndCheckFourCC: Look for %s, got %s", str, buf);
+	return result;
 }
 
 /*static*/
diff --git a/engines/tetraedge/te/te_model.cpp b/engines/tetraedge/te/te_model.cpp
index baf975c08fa..ab33b99d768 100644
--- a/engines/tetraedge/te/te_model.cpp
+++ b/engines/tetraedge/te/te_model.cpp
@@ -396,7 +396,7 @@ bool TeModel::load(Common::SeekableReadStream &stream) {
 		loadAlign(stream);
 		_bones[i]._parentBone = stream.readUint32LE();
 		TeTRS::deserialize(stream, _bones[i]._trs);
-		if (!_skipSkinOffsets) {
+		if (!_skipSkinOffsets || g_engine->gameType() == TetraedgeEngine::kSyberia2) {
 			_skinOffsets[i].deserialize(stream);
 		}
 	}


Commit: 30f84f65faefa667357c0bf6fd4c611f442c7471
    https://github.com/scummvm/scummvm/commit/30f84f65faefa667357c0bf6fd4c611f442c7471
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-02-27T11:37:31+09:00

Commit Message:
TETRAEDGE: Fix SetModelPlayer for Syberia 2

Changed paths:
    engines/tetraedge/game/character.h
    engines/tetraedge/game/game.cpp
    engines/tetraedge/game/in_game_scene.cpp
    engines/tetraedge/game/lua_binds.cpp


diff --git a/engines/tetraedge/game/character.h b/engines/tetraedge/game/character.h
index 5667f012051..68cdad9d33b 100644
--- a/engines/tetraedge/game/character.h
+++ b/engines/tetraedge/game/character.h
@@ -38,7 +38,7 @@
 
 namespace Tetraedge {
 
-class Character : public TeAnimation {
+class Character : public TeAnimation, public TeObject {
 public:
 	Character();
 	virtual ~Character();
diff --git a/engines/tetraedge/game/game.cpp b/engines/tetraedge/game/game.cpp
index 7798037169f..b4506292778 100644
--- a/engines/tetraedge/game/game.cpp
+++ b/engines/tetraedge/game/game.cpp
@@ -874,6 +874,8 @@ bool Game::loadPlayerCharacter(const Common::String &name) {
 		_scene._character->_characterAnimPlayerFinishedSignal.add(this, &Game::onCharacterAnimationPlayerFinished);
 		_scene._character->onFinished().remove(this, &Game::onDisplacementPlayerFinished);
 		_scene._character->onFinished().add(this, &Game::onDisplacementPlayerFinished);
+	} else {
+		debug("failed to load player character %s", name.c_str());
 	}
 	return result;
 }
diff --git a/engines/tetraedge/game/in_game_scene.cpp b/engines/tetraedge/game/in_game_scene.cpp
index 46ff7ba4561..09d43e4ed24 100644
--- a/engines/tetraedge/game/in_game_scene.cpp
+++ b/engines/tetraedge/game/in_game_scene.cpp
@@ -995,16 +995,31 @@ bool InGameScene::loadPlayerCharacter(const Common::String &name) {
 
 		_playerCharacterModel = _character->_model;
 
-		if (!findKate()) {
-			models().push_back(_character->_model);
-			if (_character->_shadowModel[0]) {
-				models().push_back(_character->_shadowModel[0]);
-				models().push_back(_character->_shadowModel[1]);
+		bool kateFound = findKate();
+
+		if (g_engine->gameType() == TetraedgeEngine::kSyberia) {
+			if (!kateFound) {
+				models().push_back(_character->_model);
+				if (_character->_shadowModel[0]) {
+					models().push_back(_character->_shadowModel[0]);
+					models().push_back(_character->_shadowModel[1]);
+				}
+			}
+		} else {
+			if (kateFound) {
+				for (uint i = 0; i < models().size(); i++) {
+					if (models()[i] == _character->_model) {
+						models().remove_at(i);
+						break;
+					}
+				}
 			}
+			models().push_back(_character->_model);
 		}
 	}
 
 	_character->_model->setVisible(true);
+	_character->setFreeMoveZone(nullptr);
 	return true;
 }
 
@@ -1539,7 +1554,7 @@ void InGameScene::unloadCharacter(const Common::String &name) {
 		if (_character->_model->anim())
 			_character->_model->anim()->stop(); // TODO: added this
 		_character->setFreeMoveZone(nullptr); // TODO: added this
-		// TODO: deleteLater() something here..
+		_character->deleteLater();
 		_character = nullptr;
 	}
 	for (uint i = 0; i < _characters.size(); i++) {
@@ -1548,7 +1563,7 @@ void InGameScene::unloadCharacter(const Common::String &name) {
 			c->removeAnim();
 			c->deleteAnim();
 			c->deleteAllCallback();
-			// TODO: deleteLater() something here..
+			c->deleteLater();
 			if (c->_model->anim())
 				c->_model->anim()->stop(); // TODO: added this
 			c->setFreeMoveZone(nullptr); // TODO: added this
diff --git a/engines/tetraedge/game/lua_binds.cpp b/engines/tetraedge/game/lua_binds.cpp
index d9a6ede9344..91ee9948ae7 100644
--- a/engines/tetraedge/game/lua_binds.cpp
+++ b/engines/tetraedge/game/lua_binds.cpp
@@ -2214,7 +2214,7 @@ static int tolua_ExportedFunctions_EnableRunMode00(lua_State *L) {
 
 static void SetModelPlayer(const Common::String &name) {
 	Game *game = g_engine->getGame();
-	Character *character = game->scene().character(name);
+	Character *character = game->scene()._character;
 
 	if (!character) {
 		warning("[SetModelPlayer] Character not found %s", name.c_str());


Commit: 3e1ffd43a7f3b98636976bfbdd7655f251907cb7
    https://github.com/scummvm/scummvm/commit/3e1ffd43a7f3b98636976bfbdd7655f251907cb7
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-02-27T11:37:31+09:00

Commit Message:
TETRAEDGE: Silence some overly chatty debug messages

Changed paths:
    engines/tetraedge/game/game.cpp
    engines/tetraedge/te/te_3d_object2.cpp
    engines/tetraedge/te/te_free_move_zone.cpp


diff --git a/engines/tetraedge/game/game.cpp b/engines/tetraedge/game/game.cpp
index b4506292778..2a9e1f4f69c 100644
--- a/engines/tetraedge/game/game.cpp
+++ b/engines/tetraedge/game/game.cpp
@@ -1776,7 +1776,7 @@ bool Game::HitObject::onDown() {
 }
 
 bool Game::HitObject::onUp() {
-	debug("Game::HitObject mouseup: %s", _name.c_str());
+	// debug("Game::HitObject mouseup: %s", _name.c_str());
 	_game->luaScript().execute("OnButtonUp", _name);
 	_game->_isCharacterIdle = true;
 	return false;
diff --git a/engines/tetraedge/te/te_3d_object2.cpp b/engines/tetraedge/te/te_3d_object2.cpp
index aa4e8611e83..a5f753e353b 100644
--- a/engines/tetraedge/te/te_3d_object2.cpp
+++ b/engines/tetraedge/te/te_3d_object2.cpp
@@ -149,7 +149,8 @@ void Te3DObject2::removeChild(Te3DObject2 *child) {
 		Common::String cname("nullptr");
 		if (child)
 			cname = child->name();
-		debug("Request to remove child (%s) which is not a child of this (%s).", cname.c_str(), name().c_str());
+		// This happens on every scene change so this is a bit too noisy.
+		// debug("Request to remove child (%s) which is not a child of this (%s).", cname.c_str(), name().c_str());
 	}
 }
 
diff --git a/engines/tetraedge/te/te_free_move_zone.cpp b/engines/tetraedge/te/te_free_move_zone.cpp
index 943bfc1ee12..1ac612e937b 100644
--- a/engines/tetraedge/te/te_free_move_zone.cpp
+++ b/engines/tetraedge/te/te_free_move_zone.cpp
@@ -778,7 +778,9 @@ void TeFreeMoveZone::updateGrid(bool force) {
 	_updateTimer.start();
 	buildAStar();
 	_micropather->Reset();
-	debug("[TeFreeMoveZone::updateGrid()] %s time : %.2f", name().c_str(), _updateTimer.getTimeFromStart() / 1000000.0);
+	// This debug msg copied from the original, but it's
+	// a bit noisy and not so useful.
+	// debug("[TeFreeMoveZone::updateGrid()] %s time : %.2f", name().c_str(), _updateTimer.getTimeFromStart() / 1000000.0);
 	_gridDirty = false;
 }
 


Commit: 1a15289668957c1772d3e1f08d8b4d556de421e0
    https://github.com/scummvm/scummvm/commit/1a15289668957c1772d3e1f08d8b4d556de421e0
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-02-27T11:37:31+09:00

Commit Message:
TETRAEDGE: Correct marker scale on scrolling Syberia 2 scenes

Changed paths:
    engines/tetraedge/game/in_game_scene.cpp


diff --git a/engines/tetraedge/game/in_game_scene.cpp b/engines/tetraedge/game/in_game_scene.cpp
index 09d43e4ed24..9e87c9fd9d2 100644
--- a/engines/tetraedge/game/in_game_scene.cpp
+++ b/engines/tetraedge/game/in_game_scene.cpp
@@ -112,6 +112,7 @@ bool InGameScene::addMarker(const Common::String &markerName, const Common::Stri
 	const TeMarker *marker = findMarker(markerName);
 	if (!marker) {
 		Game *game = g_engine->getGame();
+		Application *app = g_engine->getApplication();
 		TeSpriteLayout *markerSprite = new TeSpriteLayout();
 		// Note: game checks paths here but seems to just use the original?
 		markerSprite->setName(markerName);
@@ -121,21 +122,36 @@ bool InGameScene::addMarker(const Common::String &markerName, const Common::Stri
 		markerSprite->setPositionType(TeILayout::RELATIVE_TO_PARENT);
 		TeVector3f32 newPos;
 		if (locType == "PERCENT") {
-			Application *app = g_engine->getApplication();
-			TeVector3f32 frontLayoutSize = app->frontLayout().userSize();
-			newPos.x() = frontLayoutSize.x() * (x / 100.0);
-			newPos.y() = frontLayoutSize.y() * (y / 100.0);
+			TeVector3f32 parentSize;
+			//if (g_engine->gameType() == TetraedgeEngine::kSyberia)
+				parentSize = app->frontLayout().userSize();
+			//else
+			//	parentSize = app->getMainWindow().size();
+			newPos.x() = parentSize.x() * (x / 100.0f);
+			newPos.y() = parentSize.y() * (y / 100.0f);
 		} else {
 			newPos.x() = x / g_engine->getDefaultScreenWidth();
 			newPos.y() = y / g_engine->getDefaultScreenHeight();
 		}
 		markerSprite->setPosition(newPos);
 
-		const TeVector3f32 winSize = g_engine->getApplication()->getMainWindow().size();
+		const TeVector3f32 winSize = app->getMainWindow().size();
+		float xscale = 1.0f;
+		float yscale = 1.0f;
+		if (g_engine->gameType() == TetraedgeEngine::kSyberia2) {
+			TeLayout *bglayout = _bgGui.layoutChecked("background");
+			TeSpriteLayout *rootlayout = Game::findSpriteLayoutByName(bglayout, "root");
+			if (rootlayout) {
+				TeVector2s32 bgSize = rootlayout->_tiledSurfacePtr->tiledTexture()->totalSize();
+				xscale = 800.0f / bgSize._x;
+				yscale = 600.0f / bgSize._y;
+			}
+		}
+
 		if (g_engine->getCore()->fileFlagSystemFlag("definition") == "SD") {
-			markerSprite->setSize(TeVector3f32(0.07f, (4.0f / ((winSize.y() / winSize.x()) * 4.0f)) * 0.07f, 0.0));
+			markerSprite->setSize(TeVector3f32(xscale * 0.07f, yscale * (4.0f / ((winSize.y() / winSize.x()) * 4.0f)) * 0.07f, 0.0));
 		} else {
-			markerSprite->setSize(TeVector3f32(0.04f, (4.0f / ((winSize.y() / winSize.x()) * 4.0f)) * 0.04f, 0.0));
+			markerSprite->setSize(TeVector3f32(xscale * 0.04f, yscale * (4.0f / ((winSize.y() / winSize.x()) * 4.0f)) * 0.04f, 0.0));
 		}
 		markerSprite->setVisible(game->markersVisible());
 		markerSprite->_tiledSurfacePtr->_frameAnim.setLoopCount(-1);


Commit: c7c2141d0a88b194e8981cc16456fac9f8b2c2ce
    https://github.com/scummvm/scummvm/commit/c7c2141d0a88b194e8981cc16456fac9f8b2c2ce
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-02-27T11:38:00+09:00

Commit Message:
TETRAEDGE: Add workaround for PlaySound lua bug in Syberia 2

Changed paths:
    engines/tetraedge/game/lua_binds.cpp


diff --git a/engines/tetraedge/game/lua_binds.cpp b/engines/tetraedge/game/lua_binds.cpp
index 91ee9948ae7..e1be446212b 100644
--- a/engines/tetraedge/game/lua_binds.cpp
+++ b/engines/tetraedge/game/lua_binds.cpp
@@ -1837,6 +1837,17 @@ static int tolua_ExportedFunctions_PlaySound00(lua_State *L) {
 		Common::String s1(tolua_tostring(L, 1, nullptr));
 		double d1 = tolua_tonumber(L, 2, -1.0);
 		double d2 = tolua_tonumber(L, 3, 1.0);
+		//
+		// WORKAROUND: Syberia 2 script A1_MonCour/12200/Logic12200.lua
+		// calls this with (0.4, -1) - should be the other way around, and
+		// the sound name should have ".ogg" on the end.
+		//
+		if (d2 == -1 && s1 == "sounds/SFX/AB_12220-01") {
+			double tmp = d2;
+			d2 = d1;
+			d1 = tmp;
+			s1 += ".ogg";
+		}
 		PlaySound(s1, d1, d2);
 		return 0;
 	}




More information about the Scummvm-git-logs mailing list