[Scummvm-git-logs] scummvm master -> 2ce8a6931e8cd4f43572a58fcfa9edfb471f5122
aquadran
noreply at scummvm.org
Sun Jan 16 20:55:55 UTC 2022
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:
2ce8a6931e GRIM: Implemented Lua opcodes GetTranslationMode and SetTranslationMode
Commit: 2ce8a6931e8cd4f43572a58fcfa9edfb471f5122
https://github.com/scummvm/scummvm/commit/2ce8a6931e8cd4f43572a58fcfa9edfb471f5122
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2022-01-16T21:55:51+01:00
Commit Message:
GRIM: Implemented Lua opcodes GetTranslationMode and SetTranslationMode
Changed paths:
engines/grim/lua.h
engines/grim/lua_v1_text.cpp
diff --git a/engines/grim/lua.h b/engines/grim/lua.h
index 6aee8abf0bc..95f9bab9542 100644
--- a/engines/grim/lua.h
+++ b/engines/grim/lua.h
@@ -152,16 +152,16 @@ protected:
Color getcolor(lua_Object obj);
PrimitiveObject *getprimitive(lua_Object obj);
ObjectState *getobjectstate(lua_Object obj);
+ // 0 - translate from '/msgId/'
+ // 1 - don't translate - message after '/msgId'
+ // 2 - return '/msgId/'
+ int _translationMode;
DECLARE_LUA_OPCODE(dummyHandler);
DECLARE_LUA_OPCODE(typeOverride);
DECLARE_LUA_OPCODE(concatFallback);
private:
- // 0 - translate from '/msgId/'
- // 1 - don't translate - message after '/msgId'
- // 2 - return '/msgId/'
- int _translationMode;
unsigned int _frameTimeCollection;
int refSystemTable;
diff --git a/engines/grim/lua_v1_text.cpp b/engines/grim/lua_v1_text.cpp
index e70fd881967..e9f792496ca 100644
--- a/engines/grim/lua_v1_text.cpp
+++ b/engines/grim/lua_v1_text.cpp
@@ -384,11 +384,22 @@ void Lua_V1::IsMessageGoing() {
}
void Lua_V1::GetTranslationMode() {
- warning("Stub function: GetTranslationMode");
+ lua_pushnumber(_translationMode);
}
void Lua_V1::SetTranslationMode() {
- warning("Stub function: SetTranslationMode");
+ int mode = 0;
+ lua_Object paramObj = lua_getparam(1);
+
+ if (!lua_isnil(paramObj) && lua_isnumber(paramObj)) {
+ mode = lua_getnumber(paramObj);
+ if (mode < 0)
+ mode = 0;
+ if (mode > 2)
+ mode = 2;
+ }
+
+ _translationMode = mode;
}
} // end of namespace Grim
More information about the Scummvm-git-logs
mailing list