[Scummvm-git-logs] scummvm master -> 38c0f32d8bc55ccdf6eb41cf3dcdd496ef118ce8
klusark
noreply at scummvm.org
Tue Nov 3 21:49:20 UTC 2026
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
22c1c392b9 GRIM: Rename TextObject::destroy to TextObject::invalidate
38c0f32d8b GRIM: Fix a few small issues in ChangeTextObject
Commit: 22c1c392b93432f8826ddb2d8929c61b0ca0594c
https://github.com/scummvm/scummvm/commit/22c1c392b93432f8826ddb2d8929c61b0ca0594c
Author: Joel Teichroeb (joel at teichroeb.net)
Date: 2026-11-03T16:16:06-05:00
Commit Message:
GRIM: Rename TextObject::destroy to TextObject::invalidate
We're not actually destroying anything related to the text itself. Just
make it clearer what is happening.
Changed paths:
engines/grim/lua_v1_text.cpp
engines/grim/textobject.cpp
engines/grim/textobject.h
diff --git a/engines/grim/lua_v1_text.cpp b/engines/grim/lua_v1_text.cpp
index 57715a5e49b..ffaac56d15b 100644
--- a/engines/grim/lua_v1_text.cpp
+++ b/engines/grim/lua_v1_text.cpp
@@ -68,7 +68,7 @@ void Lua_V1::ChangeTextObject() {
if (!lua_istable(paramObj))
break;
setTextObjectParams(textObject, paramObj);
- textObject->destroy();
+ textObject->invalidate();
} else {
const char *line = lua_getstring(paramObj);
textObject->setText(line, false);
diff --git a/engines/grim/textobject.cpp b/engines/grim/textobject.cpp
index 3e921f226d5..0ca4052ae4b 100644
--- a/engines/grim/textobject.cpp
+++ b/engines/grim/textobject.cpp
@@ -63,14 +63,14 @@ TextObject::~TextObject() {
}
void TextObject::setText(const Common::String &text, bool delaySetup) {
- destroy();
+ invalidate();
_textID = text;
if (!delaySetup)
setupText();
}
void TextObject::reset() {
- destroy();
+ invalidate();
setupText();
}
@@ -156,7 +156,7 @@ int TextObject::getTextCharPosition(int pos) {
return width;
}
-void TextObject::destroy() {
+void TextObject::invalidate() {
if (_created) {
g_driver->destroyTextObject(this);
_created = false;
diff --git a/engines/grim/textobject.h b/engines/grim/textobject.h
index ce37cc91054..52e7aa7e283 100644
--- a/engines/grim/textobject.h
+++ b/engines/grim/textobject.h
@@ -113,7 +113,7 @@ public:
void draw();
void update();
- void destroy();
+ void invalidate();
void saveState(SaveGame *state) const;
bool restoreState(SaveGame *state);
Commit: 38c0f32d8bc55ccdf6eb41cf3dcdd496ef118ce8
https://github.com/scummvm/scummvm/commit/38c0f32d8bc55ccdf6eb41cf3dcdd496ef118ce8
Author: Joel Teichroeb (joel at teichroeb.net)
Date: 2026-11-03T16:21:21-05:00
Commit Message:
GRIM: Fix a few small issues in ChangeTextObject
Only check parameters 2 and 3, do not keep iterating
Only return the width and height once, not once per parameter
Remove extra lua_getstring call
Changed paths:
engines/grim/lua_v1_text.cpp
diff --git a/engines/grim/lua_v1_text.cpp b/engines/grim/lua_v1_text.cpp
index ffaac56d15b..c565d82ebc5 100644
--- a/engines/grim/lua_v1_text.cpp
+++ b/engines/grim/lua_v1_text.cpp
@@ -47,39 +47,33 @@ void Lua_V1::KillTextObject() {
}
/* Make changes to a text object based on the parameters passed
- * in the table in the LUA parameter 2.
+ * in the LUA parameters 2 and 3, each a new text or a params table.
*/
void Lua_V1::ChangeTextObject() {
lua_Object textObj = lua_getparam(1);
- if (lua_isuserdata(textObj) && lua_tag(textObj) == MKTAG('T', 'E', 'X', 'T')) {
- TextObject *textObject = gettextobject(textObj);
- int paramId = 2;
- for (;;) {
- lua_Object paramObj = lua_getparam(paramId++);
- if (!paramObj)
- break;
-
- // If the text object is invalid (deleted) ignore the request
- // We do the check here so that all of the params are used
- if (!textObject)
- continue;
-
- if (!lua_isstring(paramObj)) {
- if (!lua_istable(paramObj))
- break;
- setTextObjectParams(textObject, paramObj);
- textObject->invalidate();
- } else {
- const char *line = lua_getstring(paramObj);
- textObject->setText(line, false);
- lua_getstring(paramObj);
+ if (!lua_isuserdata(textObj) || lua_tag(textObj) != MKTAG('T', 'E', 'X', 'T'))
+ return;
- }
+ TextObject *textObject = gettextobject(textObj);
+ if (!textObject)
+ return;
+
+ for (const int paramId : {2, 3}) {
+ lua_Object paramObj = lua_getparam(paramId);
+ if (!paramObj)
+ break;
- lua_pushnumber(textObject->getBitmapWidth());
- lua_pushnumber(textObject->getBitmapHeight());
+ if (lua_istable(paramObj)) {
+ setTextObjectParams(textObject, paramObj);
+ textObject->invalidate();
+ } else if (lua_isstring(paramObj)) {
+ const char *line = lua_getstring(paramObj);
+ textObject->setText(line, false);
}
}
+
+ lua_pushnumber(textObject->getBitmapWidth());
+ lua_pushnumber(textObject->getBitmapHeight());
}
/* Return the "text speed", this option must be handled
More information about the Scummvm-git-logs
mailing list