[Scummvm-git-logs] scummvm master -> b2f967b589e041759b075a8b42730057bf738651
mduggan
noreply at scummvm.org
Mon Feb 27 23:20:15 UTC 2023
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:
fb6e2dbc12 TETRAEDGE: Stop anims after completion in Syberia 2
55e0718479 TETRAEDGE: Add debugging for lua calls
b2f967b589 TETRAEDGE: Correct some Syberia 2 differences
Commit: fb6e2dbc121c2b30ef16c5ef9e6dfd6327760b18
https://github.com/scummvm/scummvm/commit/fb6e2dbc121c2b30ef16c5ef9e6dfd6327760b18
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-02-28T08:19:57+09:00
Commit Message:
TETRAEDGE: Stop anims after completion in Syberia 2
Changed paths:
engines/tetraedge/te/te_model_animation.cpp
diff --git a/engines/tetraedge/te/te_model_animation.cpp b/engines/tetraedge/te/te_model_animation.cpp
index e6c259afcd3..7f98918a51d 100644
--- a/engines/tetraedge/te/te_model_animation.cpp
+++ b/engines/tetraedge/te/te_model_animation.cpp
@@ -356,6 +356,10 @@ void TeModelAnimation::update(double millis) {
if (_finishedSignalPending) {
_finishedSignalPending = false;
_onFinishedSignal.call();
+ if (g_engine->gameType() == TetraedgeEngine::kSyberia2) {
+ if (_repeatNum >= _repeatCount && _repeatCount != -1)
+ stop();
+ }
}
}
}
Commit: 55e071847963529e3a55e12221f44d59763e8b9e
https://github.com/scummvm/scummvm/commit/55e071847963529e3a55e12221f44d59763e8b9e
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-02-28T08:19:57+09:00
Commit Message:
TETRAEDGE: Add debugging for lua calls
Changed paths:
engines/tetraedge/te/te_lua_thread.cpp
engines/tetraedge/te/te_variant.cpp
engines/tetraedge/te/te_variant.h
diff --git a/engines/tetraedge/te/te_lua_thread.cpp b/engines/tetraedge/te/te_lua_thread.cpp
index f3cb6b2fb00..fd204eb376f 100644
--- a/engines/tetraedge/te/te_lua_thread.cpp
+++ b/engines/tetraedge/te/te_lua_thread.cpp
@@ -30,6 +30,8 @@
#include "common/lua/lauxlib.h"
#include "common/lua/lualib.h"
+//#define TETRAEDGE_LUA_DEBUG 1
+
namespace Tetraedge {
/*static*/
@@ -73,6 +75,11 @@ void TeLuaThread::execute(const Common::String &fname) {
if (!_luaThread)
return;
+#ifdef TETRAEDGE_LUA_DEBUG
+ if (fname != "Update" && fname != "UpdateHelp")
+ debug("TeLuaThread::execute: %s()", fname.c_str());
+#endif
+
lua_getglobal(_luaThread, fname.c_str());
if (lua_type(_luaThread, -1) == LUA_TFUNCTION) {
_resume(0);
@@ -87,6 +94,10 @@ void TeLuaThread::execute(const Common::String &fname, const TeVariant &p1) {
if (!_luaThread)
return;
+#ifdef TETRAEDGE_LUA_DEBUG
+ debug("TeLuaThread::execute: %s(%s)", fname.c_str(), p1.dumpStr().c_str());
+#endif
+
lua_getglobal(_luaThread, fname.c_str());
if (lua_type(_luaThread, -1) == LUA_TFUNCTION) {
pushValue(p1);
@@ -106,6 +117,11 @@ void TeLuaThread::execute(const Common::String &fname, const TeVariant &p1, cons
if (!_luaThread)
return;
+#ifdef TETRAEDGE_LUA_DEBUG
+ debug("TeLuaThread::execute: %s(%s, %s)", fname.c_str(), p1.dumpStr().c_str(),
+ p2.dumpStr().c_str());
+#endif
+
lua_getglobal(_luaThread, fname.c_str());
if (lua_type(_luaThread, -1) == LUA_TFUNCTION) {
pushValue(p1);
@@ -122,6 +138,12 @@ void TeLuaThread::execute(const Common::String &fname, const TeVariant &p1, cons
if (!_luaThread)
return;
+#ifdef TETRAEDGE_LUA_DEBUG
+ debug("TeLuaThread::execute: %s(%s, %s, %s)", fname.c_str(), p1.dumpStr().c_str(),
+ p2.dumpStr().c_str(), p3.dumpStr().c_str());
+#endif
+
+
lua_getglobal(_luaThread, fname.c_str());
if (lua_type(_luaThread, -1) == LUA_TFUNCTION) {
pushValue(p1);
@@ -142,6 +164,10 @@ void TeLuaThread::executeFile(const Common::FSNode &node) {
return;
}
+#ifdef TETRAEDGE_LUA_DEBUG
+ debug("TeLuaThread::executeFile: %s", node.getName().c_str());
+#endif
+
int64 fileLen = scriptFile.size();
char *buf = new char[fileLen + 1];
scriptFile.read(buf, fileLen);
@@ -223,11 +249,19 @@ void TeLuaThread::release() {
}
void TeLuaThread::resume() {
+#ifdef TETRAEDGE_LUA_DEBUG
+ debug("TeLuaThread::resume");
+#endif
+
if (_luaThread)
_resume(0);
}
void TeLuaThread::resume(const TeVariant &p1) {
+#ifdef TETRAEDGE_LUA_DEBUG
+ debug("TeLuaThread::resume(%s)", p1.dumpStr().c_str());
+#endif
+
if (_luaThread) {
pushValue(p1);
_resume(1);
@@ -235,6 +269,10 @@ void TeLuaThread::resume(const TeVariant &p1) {
}
void TeLuaThread::resume(const TeVariant &p1, const TeVariant &p2) {
+#ifdef TETRAEDGE_LUA_DEBUG
+ debug("TeLuaThread::resume(%s, %s)", p1.dumpStr().c_str(), p2.dumpStr().c_str());
+#endif
+
if (_luaThread) {
pushValue(p1);
pushValue(p2);
@@ -243,6 +281,11 @@ void TeLuaThread::resume(const TeVariant &p1, const TeVariant &p2) {
}
void TeLuaThread::resume(const TeVariant &p1, const TeVariant &p2, const TeVariant &p3) {
+#ifdef TETRAEDGE_LUA_DEBUG
+ debug("TeLuaThread::resume(%s, %s, %s)", p1.dumpStr().c_str(), p2.dumpStr().c_str(),
+ p3.dumpStr().c_str());
+#endif
+
if (_luaThread) {
pushValue(p1);
pushValue(p2);
diff --git a/engines/tetraedge/te/te_variant.cpp b/engines/tetraedge/te/te_variant.cpp
index 96831c608a1..79f6f8c906d 100644
--- a/engines/tetraedge/te/te_variant.cpp
+++ b/engines/tetraedge/te/te_variant.cpp
@@ -119,7 +119,7 @@ Common::String TeVariant::toString(bool *success) const {
}
-int32 TeVariant::toUnsigned32(bool *success) const {
+uint32 TeVariant::toUnsigned32(bool *success) const {
if (_type == TypeUInt32) {
if (success)
*success = true;
@@ -132,7 +132,7 @@ int32 TeVariant::toUnsigned32(bool *success) const {
}
-int64 TeVariant::toUnsigned64(bool *success) const {
+uint64 TeVariant::toUnsigned64(bool *success) const {
if (_type == TypeUInt64) {
if (success)
*success = true;
@@ -145,4 +145,29 @@ int64 TeVariant::toUnsigned64(bool *success) const {
}
+Common::String TeVariant::dumpStr() const {
+ switch (_type) {
+ case TypeInt32:
+ return Common::String::format("%d", (int)toSigned32());
+ case TypeUInt32:
+ return Common::String::format("%u", (unsigned int)toUnsigned32());
+ case TypeInt64:
+ return Common::String::format("%ld", (long)toSigned64());
+ case TypeUInt64:
+ return Common::String::format("%lu", (unsigned long)toUnsigned64());
+ case TypeFloat32:
+ return Common::String::format("%.04f", toFloat32());
+ case TypeFloat64:
+ return Common::String::format("%.04f", toFloat64());
+ case TypeBoolean:
+ return Common::String::format("%s", toBoolean() ? "true" : "false");
+ case TypeString:
+ return toString();
+ default:
+ case TypeNone:
+ return "(none)";
+ }
+}
+
+
} // end namespace Tetraedge
diff --git a/engines/tetraedge/te/te_variant.h b/engines/tetraedge/te/te_variant.h
index 034ce47c359..6db14935bc2 100644
--- a/engines/tetraedge/te/te_variant.h
+++ b/engines/tetraedge/te/te_variant.h
@@ -56,8 +56,11 @@ public:
int32 toSigned32(bool *success = nullptr) const;
int64 toSigned64(bool *success = nullptr) const;
Common::String toString(bool *success = nullptr) const;
- int32 toUnsigned32(bool *success = nullptr) const;
- int64 toUnsigned64(bool *success = nullptr) const;
+ uint32 toUnsigned32(bool *success = nullptr) const;
+ uint64 toUnsigned64(bool *success = nullptr) const;
+
+ /// Dump a string representation for debugging
+ Common::String dumpStr() const;
private:
uint64 _data;
Commit: b2f967b589e041759b075a8b42730057bf738651
https://github.com/scummvm/scummvm/commit/b2f967b589e041759b075a8b42730057bf738651
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-02-28T08:19:57+09:00
Commit Message:
TETRAEDGE: Correct some Syberia 2 differences
Changed paths:
engines/tetraedge/game/character.cpp
engines/tetraedge/game/game.cpp
diff --git a/engines/tetraedge/game/character.cpp b/engines/tetraedge/game/character.cpp
index ee5282b0571..d06513a1fcf 100644
--- a/engines/tetraedge/game/character.cpp
+++ b/engines/tetraedge/game/character.cpp
@@ -323,7 +323,7 @@ void Character::deleteCallback(const Common::String &key, const Common::String &
}
void Character::endMove() {
- if (_model->name() == "Kate")
+ if (g_engine->getGame()->scene()._character == this)
walkMode("Walk");
_onFinishedSignal.call();
@@ -871,6 +871,7 @@ void Character::update(double msFromStart) {
const float baseAngle = (_walkCurveStart > _walkCurveEnd ? M_PI : 0);
const float sign = (_walkCurveStart > _walkCurveEnd ? -1 : 1);
+
updatePosition(_walkCurveLast);
float lastWalkedLength = _walkedLength;
diff --git a/engines/tetraedge/game/game.cpp b/engines/tetraedge/game/game.cpp
index 2a9e1f4f69c..43cc71e428c 100644
--- a/engines/tetraedge/game/game.cpp
+++ b/engines/tetraedge/game/game.cpp
@@ -857,7 +857,7 @@ bool Game::loadCharacter(const Common::String &name) {
character->_onCharacterAnimFinishedSignal.remove(this, &Game::onCharacterAnimationFinished);
character->_onCharacterAnimFinishedSignal.add(this, &Game::onCharacterAnimationFinished);
// Syberia 2 uses a simplified callback here.
- // We have made onDisplacementPlayerFinished more like Syberia 1's onDisplacementPlayerFinished.
+ // We have made onDisplacementPlayerFinished more like Syberia 1's onDisplacementFinished.
if (g_engine->gameType() == TetraedgeEngine::kSyberia)
character->onFinished().add(this, &Game::onDisplacementPlayerFinished);
else
@@ -905,6 +905,16 @@ bool Game::onCharacterAnimationFinished(const Common::String &charName) {
if (!_scene._character)
return false;
+ if (g_engine->gameType() == TetraedgeEngine::kSyberia2) {
+ Character *character = scene().character(charName);
+ const Common::String curAnimName = character->curAnimName();
+ if (character && (curAnimName == character->walkAnim(Character::WalkPart_EndD)
+ || curAnimName == character->walkAnim(Character::WalkPart_EndG))) {
+ character->updatePosition(1.0);
+ character->endMove();
+ }
+ }
+
for (uint i = 0; i < _yieldedCallbacks.size(); i++) {
YieldedCallback &cb = _yieldedCallbacks[i];
if (cb._luaFnName == "OnCharacterAnimationFinished" && cb._luaParam == charName) {
@@ -928,6 +938,7 @@ bool Game::onCharacterAnimationPlayerFinished(const Common::String &anim) {
bool callScripts = true;
for (uint i = 0; i < _yieldedCallbacks.size(); i++) {
YieldedCallback &cb = _yieldedCallbacks[i];
+ // Yes, even Syberia2 checks for Kate here..
if (cb._luaFnName == "OnCharacterAnimationFinished" && cb._luaParam == "Kate") {
TeLuaThread *lua = cb._luaThread;
_yieldedCallbacks.remove_at(i);
@@ -939,8 +950,10 @@ bool Game::onCharacterAnimationPlayerFinished(const Common::String &anim) {
}
}
if (callScripts) {
- _luaScript.execute("OnCharacterAnimationFinished", "Kate");
- _luaScript.execute("OnCharacterAnimationPlayerFinished", anim);
+ if (g_engine->gameType() == TetraedgeEngine::kSyberia)
+ _luaScript.execute("OnCharacterAnimationFinished", "Kate");
+ else
+ _luaScript.execute("OnCharacterAnimationPlayerFinished", anim);
_luaScript.execute("OnCellCharacterAnimationPlayerFinished", anim);
}
@@ -993,7 +1006,7 @@ bool Game::onDialogFinished(const Common::String &val) {
return false;
}
-// This is the Syberia 2 version of this function, not used in Syb 2.
+// This is the Syberia 2 version of this function, not used in Syb 1.
// Syb 1 uses a function much more like onDisplacementPlayerFinished below.
bool Game::onDisplacementFinished() {
TeLuaThread *thread = nullptr;
More information about the Scummvm-git-logs
mailing list