[Scummvm-git-logs] scummvm master -> 3ee3255ca7ff1203d4d3cd7329f2a6e1dd9adf1b

mduggan noreply at scummvm.org
Fri Feb 24 08:22:11 UTC 2023


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

Summary:
06021ffc1c TETRAEDGE: Support object position anim for Syberia 2
8bea6270b5 TETRAEDGE: Fix camera fov for Syberia 2
120008ae1d TETRAEDGE: Clean up scene on warp for Syberia 2
ef0a264845 TETRAEDGE: Correct type check in lua binds
3ee3255ca7 TETRAEDGE: Correct character callbacks for Syberia 2


Commit: 06021ffc1cefc5db113e3de6c762dae201147a02
    https://github.com/scummvm/scummvm/commit/06021ffc1cefc5db113e3de6c762dae201147a02
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-02-24T17:21:45+09:00

Commit Message:
TETRAEDGE: Support object position anim for Syberia 2

Changed paths:
    engines/tetraedge/game/character.cpp
    engines/tetraedge/game/object3d.h


diff --git a/engines/tetraedge/game/character.cpp b/engines/tetraedge/game/character.cpp
index f184a8d49c8..f211680edf0 100644
--- a/engines/tetraedge/game/character.cpp
+++ b/engines/tetraedge/game/character.cpp
@@ -544,14 +544,22 @@ bool Character::onBonesUpdate(const Common::String &boneName, TeMatrix4x4 &boneM
 			if (_model->anim()->curFrame2() >= obj->_startFrame
 					&& _model->anim()->curFrame2() <= obj->_endFrame) {
 				obj->model()->setVisible(true);
-				TeMatrix4x4 objmatrix = boneMatrix;
-				objmatrix.scale(obj->_objScale);
-				objmatrix.rotate(obj->_objRotation);
-				objmatrix.translate(obj->_objTranslation);
-				obj->model()->forceMatrix(objmatrix);
-				obj->model()->setRotation(_model->rotation());
-				obj->model()->setPosition(_model->position());
-				obj->model()->setScale(_model->scale());
+
+				if (!obj->_moveAnim._runTimer.running()) {
+					obj->_lastMatrix = boneMatrix;
+					obj->_lastMatrix.scale(obj->_objScale);
+					obj->_lastMatrix.rotate(obj->_objRotation);
+					obj->_lastMatrix.translate(obj->_objTranslation);
+					obj->model()->forceMatrix(obj->_lastMatrix);
+					obj->model()->setRotation(_model->rotation());
+					obj->model()->setPosition(_model->position());
+					obj->model()->setScale(_model->scale());
+				} else {
+					obj->model()->forceMatrix(obj->_lastMatrix);
+					obj->model()->setRotation(_model->rotation());
+					obj->model()->setPosition(_model->position() + obj->_curMovePos);
+					obj->model()->setScale(_model->scale());
+				}
 			} else {
 				obj->model()->setVisible(false);
 			}
diff --git a/engines/tetraedge/game/object3d.h b/engines/tetraedge/game/object3d.h
index 4963ce802ab..2ce86bb1a87 100644
--- a/engines/tetraedge/game/object3d.h
+++ b/engines/tetraedge/game/object3d.h
@@ -78,6 +78,7 @@ public:
 	TeVector3f32 _objTranslation;
 	TeQuaternion _objRotation;
 	TeVector3f32 _objScale;
+	TeMatrix4x4 _lastMatrix;
 
 	int _startFrame;
 	int _endFrame;


Commit: 8bea6270b5283ce3e41c38736f3e47eeeef0f6e2
    https://github.com/scummvm/scummvm/commit/8bea6270b5283ce3e41c38736f3e47eeeef0f6e2
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-02-24T17:21:45+09:00

Commit Message:
TETRAEDGE: Fix camera fov for Syberia 2

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


diff --git a/engines/tetraedge/te/te_camera_xml_parser.cpp b/engines/tetraedge/te/te_camera_xml_parser.cpp
index 4d0292a278c..9580f7b2f63 100644
--- a/engines/tetraedge/te/te_camera_xml_parser.cpp
+++ b/engines/tetraedge/te/te_camera_xml_parser.cpp
@@ -44,7 +44,9 @@ bool TeCameraXmlParser::parserCallback_scale(ParserNode *node) {
 }
 
 bool TeCameraXmlParser::parserCallback_fov(ParserNode *node) {
-	_cam->setFov(parseDouble(node));
+	float fov = parseDouble(node);
+	fov = atanf(1.0f / (1.333333f / tanf(fov / 2)));
+	_cam->setFov(fov * 2);
 	return true;
 }
 


Commit: 120008ae1dc4fff52fb8d061a544daf63d8e75a3
    https://github.com/scummvm/scummvm/commit/120008ae1dc4fff52fb8d061a544daf63d8e75a3
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-02-24T17:21:45+09:00

Commit Message:
TETRAEDGE: Clean up scene on warp for Syberia 2

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


diff --git a/engines/tetraedge/game/game.cpp b/engines/tetraedge/game/game.cpp
index 8e0ad7d2e0d..21182ba9bc2 100644
--- a/engines/tetraedge/game/game.cpp
+++ b/engines/tetraedge/game/game.cpp
@@ -213,6 +213,8 @@ void Game::addToScore(int score) {
 
 bool Game::changeWarp(const Common::String &zone, const Common::String &scene, bool fadeFlag) {
 	//debug("Game::changeWarp(%s, %s, %s)", zone.c_str(), scene.c_str(), fadeFlag ? "true" : "false");
+	if (g_engine->gameType() == TetraedgeEngine::kSyberia2)
+		_scene.freeGeometry();
 	Application *app = g_engine->getApplication();
 	if (fadeFlag) {
 		app->blackFade();
diff --git a/engines/tetraedge/game/in_game_scene.cpp b/engines/tetraedge/game/in_game_scene.cpp
index ba1de6ccfac..3d951e3fe90 100644
--- a/engines/tetraedge/game/in_game_scene.cpp
+++ b/engines/tetraedge/game/in_game_scene.cpp
@@ -508,6 +508,7 @@ void InGameScene::freeGeometry() {
 	_bezierCurves.clear();
 	_dummies.clear();
 	cameras().clear();
+	models().clear();
 	_zoneModels.clear();
 	_masks.clear();
 	_shadowReceivingObjects.clear();
@@ -769,6 +770,7 @@ static Common::Path _sceneFileNameBase() {
 }
 
 bool InGameScene::loadXml(const Common::String &zone, const Common::String &scene) {
+	_maskAlpha = false;
 	_zoneName = zone;
 	_sceneName = scene;
 	_blockers.clear();
@@ -945,6 +947,9 @@ bool InGameScene::loadObjectMaterials(const Common::String &name) {
 	bool retval = false;
 	TeCore *core = g_engine->getCore();
 	for (auto &obj : _objects) {
+		// FIXME: This should probably only do something for the
+		// object where the model name matches?  It won't find the file
+		// anyway so it probably works as-is but it's a bit wrong.
 		if (obj._name.empty())
 			continue;
 


Commit: ef0a2648452b5d3926fce73679ac53b326c351dd
    https://github.com/scummvm/scummvm/commit/ef0a2648452b5d3926fce73679ac53b326c351dd
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-02-24T17:21:45+09:00

Commit Message:
TETRAEDGE: Correct type check in lua binds

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 a3d734ebfe4..2ee6e10ed6d 100644
--- a/engines/tetraedge/game/lua_binds.cpp
+++ b/engines/tetraedge/game/lua_binds.cpp
@@ -2386,7 +2386,7 @@ static void SetObjectMoveDest(const Common::String &obj, float x, float y, float
 static int tolua_ExportedFunctions_SetObjectMoveDest00(lua_State *L) {
 	tolua_Error err;
 	if (tolua_isstring(L, 1, 0, &err) && tolua_isnumber(L, 2, 0, &err)
-		&& tolua_isnumber(L, 2, 0, &err) && tolua_isnumber(L, 4, 0, &err)
+		&& tolua_isnumber(L, 3, 0, &err) && tolua_isnumber(L, 4, 0, &err)
 		&& tolua_isnoobj(L, 5, &err)) {
 		Common::String s1(tolua_tostring(L, 1, nullptr));
 		float f1 = tolua_tonumber(L, 2, 0.0);


Commit: 3ee3255ca7ff1203d4d3cd7329f2a6e1dd9adf1b
    https://github.com/scummvm/scummvm/commit/3ee3255ca7ff1203d4d3cd7329f2a6e1dd9adf1b
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-02-24T17:21:45+09:00

Commit Message:
TETRAEDGE: Correct character callbacks for Syberia 2

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


diff --git a/engines/tetraedge/game/character.cpp b/engines/tetraedge/game/character.cpp
index f211680edf0..1fdbbe638f0 100644
--- a/engines/tetraedge/game/character.cpp
+++ b/engines/tetraedge/game/character.cpp
@@ -115,30 +115,50 @@ void Character::addCallback(const Common::String &animKey, const Common::String
 	// the way this gets used later, setting large negative is more correct.
 	c->_callsMade = (maxCalls == -1.0 ? -1e9 : 0.0f);
 
-	//
-	// WORKAROUND: This callback seems to be set too late.. frame 31, but it
-	// only gets to 15?  Some bug in the way anim blends hand off?
-	// for scenes/CitSpace2/34230/Logic34230.lua
-	//
-	if (fnName == "ChangeClef" && c->_triggerFrame == 31)
-		c->_triggerFrame = 15;
-
-	const Common::Path animPath = _model->anim()->loadedPath();
-
-	// Another difference.. the original messes with paths a bit - just
-	// use the file name, since it's already limited by character.
-	Common::String animName = animPath.getLastComponent().toString();
-	if (animName.empty())
-		animName = animPath.toString();
-
-	if (_callbacks.contains(animName)) {
-		_callbacks[animName].push_back(c);
-	} else {
-		Common::Path animKeyPath(animKey);
-		Common::Array<Callback *> callbacks;
-		callbacks.push_back(c);
+	if (g_engine->gameType() == TetraedgeEngine::kSyberia) {
+		// Syberia 1 has slightly weird logic to decide what key to use.
+
+		//
+		// WORKAROUND: This callback seems to be set too late.. frame 31, but it
+		// only gets to 15?  Some bug in the way anim blends hand off?
+		// for scenes/CitSpace2/34230/Logic34230.lua
+		//
+		if (fnName == "ChangeClef" && c->_triggerFrame == 31)
+			c->_triggerFrame = 15;
+		//else if (fnName == "Launch_Ballon" && c->_triggerFrame == 177)
+		//	c->_triggerFrame = 150;
+
+		const Common::Path animPath = _model->anim()->loadedPath();
+
+		// Another difference.. the original messes with paths a bit - just
+		// use the file name, since it's already limited by character.
+		Common::String animName = animPath.getLastComponent().toString();
+		if (animName.empty())
+			animName = animPath.toString();
+
+		if (_callbacks.contains(animName)) {
+			_callbacks[animName].push_back(c);
+		} else {
+			Common::Path animKeyPath(animKey);
+			Common::Array<Callback *> callbacks;
+			callbacks.push_back(c);
 
-		_callbacks.setVal(animKeyPath.getLastComponent().toString(), callbacks);
+			_callbacks.setVal(animKeyPath.getLastComponent().toString(), callbacks);
+		}
+	} else if (g_engine->gameType() == TetraedgeEngine::kSyberia2){
+		// Syberia 2 is simpler, it always uses a lower-case version of the anim
+		// file in the passed key.
+		Common::String key = Common::Path(animKey).getLastComponent().toString();
+		key.toLowercase();
+		if (_callbacks.contains(key)) {
+			_callbacks[key].push_back(c);
+		} else {
+			Common::Array<Callback *> callbacks;
+			callbacks.push_back(c);
+			_callbacks.setVal(key, callbacks);
+		}
+	} else {
+		error("addCallback: Unsupported game type.");
 	}
 }
 
@@ -652,12 +672,19 @@ void Character::permanentUpdate() {
 	_callbacksChanged = false;
 	// Diverge from original - just use filename for anim callbacks as the
 	// original does werid things with paths.
-	const Common::String animFile = animPath.getLastComponent().toString();
+	Common::String animFile = animPath.getLastComponent().toString();
+	if (g_engine->gameType() == TetraedgeEngine::kSyberia2)
+		animFile.toLowercase();
+
+	//if (!_callbacks.empty())
+	//	debug("%s: check cbs for %s frame %d speed %.02f", _model->name().c_str(),
+	//			animFile.c_str(), curFrame, _model->anim()->speed());
+
 	if (_callbacks.contains(animFile)) {
 		Common::Array<Callback *> &cbs = _callbacks.getVal(animFile);
 		for (Callback *cb : cbs) {
-			//debug("check cb for %s frame %d against %d. speed %.02f", animFile.c_str(),
-			//		curFrame, cb->_triggerFrame, _model->anim()->speed());
+			//debug("%s: check cb for %s frame %d against %d. speed %.02f", _model->name().c_str(),
+			//		animFile.c_str(), curFrame, cb->_triggerFrame, _model->anim()->speed());
 			if (cb->_triggerFrame > cb->_lastCheckFrame && curFrame >= cb->_triggerFrame){
 				int callsMade = cb->_callsMade;
 				cb->_callsMade++;
diff --git a/engines/tetraedge/game/lua_binds.cpp b/engines/tetraedge/game/lua_binds.cpp
index 2ee6e10ed6d..dbd283ae4a1 100644
--- a/engines/tetraedge/game/lua_binds.cpp
+++ b/engines/tetraedge/game/lua_binds.cpp
@@ -497,11 +497,11 @@ static int tolua_ExportedFunctions_AddCallbackPlayer00(lua_State *L) {
 	if (tolua_isstring(L, 1, 0, &err) && tolua_isstring(L, 2, 0, &err)
 			&& tolua_isnumber(L, 3, 0, &err) && tolua_isnumber(L, 4, 1, &err)
 			&& tolua_isnoobj(L, 5, &err)) {
-		Common::String s2(tolua_tostring(L, 1, nullptr));
-		Common::String s3(tolua_tostring(L, 2, nullptr));
+		Common::String s1(tolua_tostring(L, 1, nullptr));
+		Common::String s2(tolua_tostring(L, 2, nullptr));
 		double n1 = tolua_tonumber(L, 3, 0.0);
 		double n2 = tolua_tonumber(L, 4, -1.0);
-		AddCallbackPlayer(s2, s3, n1, n2);
+		AddCallbackPlayer(s1, s2, n1, n2);
 		return 0;
 	}
 	error("#ferror in function 'AddCallbackPlayer': %d %d %s", err.index, err.array, err.type);




More information about the Scummvm-git-logs mailing list