[Scummvm-git-logs] scummvm master -> 90c2bd1a855038c3e089909044b6672e49ee4d58
aquadran
noreply at scummvm.org
Thu Nov 12 05:17:01 UTC 2026
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
f87be13fc3 GRIM: Mark the model component overrides
43da409ca8 GRIM: Add Component::refreshColormap()
90c2bd1a85 GRIM: Use the lowest costume's colormap for a shared model
Commit: f87be13fc335de51833d653ede8b98012a825544
https://github.com/scummvm/scummvm/commit/f87be13fc335de51833d653ede8b98012a825544
Author: Joel Teichroeb (joel at teichroeb.net)
Date: 2026-11-12T06:16:54+01:00
Commit Message:
GRIM: Mark the model component overrides
Changed paths:
engines/grim/costume/main_model_component.h
engines/grim/costume/model_component.h
diff --git a/engines/grim/costume/main_model_component.h b/engines/grim/costume/main_model_component.h
index 649eab5c75d..3e832901c61 100644
--- a/engines/grim/costume/main_model_component.h
+++ b/engines/grim/costume/main_model_component.h
@@ -32,9 +32,9 @@ class MainModelComponent : public ModelComponent {
public:
MainModelComponent(Component *parent, int parentID, const char *filename, Component *prevComponent, tag32 tag);
~MainModelComponent();
- void init();
- void setColormap(CMap *cmap);
- void reset();
+ void init() override;
+ void setColormap(CMap *cmap) override;
+ void reset() override;
private:
bool _hierShared;
diff --git a/engines/grim/costume/model_component.h b/engines/grim/costume/model_component.h
index 3b5ecbaef10..73949482c72 100644
--- a/engines/grim/costume/model_component.h
+++ b/engines/grim/costume/model_component.h
@@ -34,13 +34,13 @@ public:
ModelComponent(Component *parent, int parentID, const char *filename, Component *prevComponent, tag32 tag);
~ModelComponent();
- void init();
- void setKey(int val);
- int update(uint time);
- void animate();
- void reset();
- void resetColormap();
- void restoreState(SaveGame *state);
+ void init() override;
+ void setKey(int val) override;
+ int update(uint time) override;
+ void animate() override;
+ void reset() override;
+ void resetColormap() override;
+ void restoreState(SaveGame *state) override;
void translateObject(bool reset);
static void translateObject(ModelNode *node, bool reset);
AnimManager *getAnimManager() const;
@@ -48,7 +48,7 @@ public:
ModelNode *getHierarchy() { return _hier; }
int getNumNodes();
Model *getModel() { return _obj; }
- void draw();
+ void draw() override;
void getBoundingBox(int *x1, int *y1, int *x2, int *y2);
protected:
Commit: 43da409ca830d5a044463ddbb440441db832127e
https://github.com/scummvm/scummvm/commit/43da409ca830d5a044463ddbb440441db832127e
Author: Joel Teichroeb (joel at teichroeb.net)
Date: 2026-11-12T06:16:54+01:00
Commit Message:
GRIM: Add Component::refreshColormap()
Costume::setColormap(nullptr) reloaded the colormap of its components. Give that
its own method, to improve code clarity.
Changed paths:
engines/grim/costume.cpp
engines/grim/costume/component.cpp
engines/grim/costume/component.h
engines/grim/costume/main_model_component.cpp
engines/grim/costume/main_model_component.h
diff --git a/engines/grim/costume.cpp b/engines/grim/costume.cpp
index 3c5d762fbb6..c62d447e7a3 100644
--- a/engines/grim/costume.cpp
+++ b/engines/grim/costume.cpp
@@ -359,7 +359,7 @@ void Costume::setColormap(const Common::String &map) {
_cmap = g_resourceloader->getColormap(map);
for (int i = 0; i < _numComponents; i++)
if (_components[i])
- _components[i]->setColormap(nullptr);
+ _components[i]->refreshColormap();
}
void Costume::stopChores(bool ignoreLoopingChores, int msecs) {
diff --git a/engines/grim/costume/component.cpp b/engines/grim/costume/component.cpp
index 6793433a146..6c82f1c6724 100644
--- a/engines/grim/costume/component.cpp
+++ b/engines/grim/costume/component.cpp
@@ -45,6 +45,10 @@ Component::~Component() {
void Component::setColormap(CMap *c) {
if (c)
_cmap = c;
+ refreshColormap();
+}
+
+void Component::refreshColormap() {
if (getCMap()) {
resetHierCMap();
}
diff --git a/engines/grim/costume/component.h b/engines/grim/costume/component.h
index 2a4cf038c32..46e2dab0239 100644
--- a/engines/grim/costume/component.h
+++ b/engines/grim/costume/component.h
@@ -41,6 +41,7 @@ public:
CMap *getCMap();
virtual void setColormap(CMap *c);
+ virtual void refreshColormap();
bool isVisible();
Component *getParent() { return _parent; }
virtual void setMatrix(const Math::Matrix4 &) { };
diff --git a/engines/grim/costume/main_model_component.cpp b/engines/grim/costume/main_model_component.cpp
index 454c9840f93..d608a5a222f 100644
--- a/engines/grim/costume/main_model_component.cpp
+++ b/engines/grim/costume/main_model_component.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "engines/grim/colormap.h"
#include "engines/grim/model.h"
#include "engines/grim/costume/model_component.h"
#include "engines/grim/costume/main_model_component.h"
@@ -71,6 +72,13 @@ void MainModelComponent::setColormap(CMap *cmap) {
}
}
+void MainModelComponent::refreshColormap() {
+ Component::refreshColormap();
+ if (_parentModel) {
+ _parentModel->refreshColormap();
+ }
+}
+
void MainModelComponent::reset() {
_visible = true;
// Can be NULL if this was attached to another costume which
diff --git a/engines/grim/costume/main_model_component.h b/engines/grim/costume/main_model_component.h
index 3e832901c61..1c6f0f34f38 100644
--- a/engines/grim/costume/main_model_component.h
+++ b/engines/grim/costume/main_model_component.h
@@ -34,6 +34,7 @@ public:
~MainModelComponent();
void init() override;
void setColormap(CMap *cmap) override;
+ void refreshColormap() override;
void reset() override;
private:
Commit: 90c2bd1a855038c3e089909044b6672e49ee4d58
https://github.com/scummvm/scummvm/commit/90c2bd1a855038c3e089909044b6672e49ee4d58
Author: Joel Teichroeb (joel at teichroeb.net)
Date: 2026-11-12T06:16:54+01:00
Commit Message:
GRIM: Use the lowest costume's colormap for a shared model
When a costume is pushed over one with the same main model, both share
the model. A colormap component of the pushed costume reloaded that
model with its colormap and also wrote it into the costume below, so
the colormap stayed after the pop. With Manny in the chowthund suit
(mcc_thunder.cos, m_chow.cmp), the snow machine's mcc_snowblow.cos
(siberian.cmp) turned the suit orange, and the coffee pot, door knock
and ladder costumes (charlie.cmp) turned his bones nearly black, until
the next set change.
Instead of propagating the colormap down the hierarchy, use the colormap
of the lowest costume that has one. When a main model component with a
colormap is destroyed, the hierarchy is refreshed to use the new lowest
one.
Fix #11818
Changed paths:
engines/grim/costume/component.h
engines/grim/costume/main_model_component.cpp
engines/grim/costume/main_model_component.h
diff --git a/engines/grim/costume/component.h b/engines/grim/costume/component.h
index 46e2dab0239..3027545505e 100644
--- a/engines/grim/costume/component.h
+++ b/engines/grim/costume/component.h
@@ -40,7 +40,7 @@ public:
Component(Component *parent, int parentID, const char *name, tag32 tag);
CMap *getCMap();
- virtual void setColormap(CMap *c);
+ void setColormap(CMap *c);
virtual void refreshColormap();
bool isVisible();
Component *getParent() { return _parent; }
diff --git a/engines/grim/costume/main_model_component.cpp b/engines/grim/costume/main_model_component.cpp
index d608a5a222f..ef41d6309d0 100644
--- a/engines/grim/costume/main_model_component.cpp
+++ b/engines/grim/costume/main_model_component.cpp
@@ -56,6 +56,10 @@ MainModelComponent::~MainModelComponent() {
if (_parentModel) {
_parentModel->_children.remove(this);
+
+ // The model goes back to the colormap of the costumes below
+ if (_cmap)
+ _parentModel->refreshColormap();
}
}
@@ -65,13 +69,6 @@ void MainModelComponent::init() {
_hier->_hierVisible = _visible;
}
-void MainModelComponent::setColormap(CMap *cmap) {
- Component::setColormap(cmap);
- if (_parentModel) {
- _parentModel->setColormap(cmap);
- }
-}
-
void MainModelComponent::refreshColormap() {
Component::refreshColormap();
if (_parentModel) {
@@ -79,6 +76,28 @@ void MainModelComponent::refreshColormap() {
}
}
+CMap *MainModelComponent::getStackCMap() const {
+ if (_cmap)
+ return _cmap;
+ for (MainModelComponent *child : _children) {
+ CMap *cmap = child->getStackCMap();
+ if (cmap)
+ return cmap;
+ }
+ return nullptr;
+}
+
+void MainModelComponent::resetColormap() {
+ const MainModelComponent *root = this;
+ while (root->_parentModel)
+ root = root->_parentModel;
+ CMap *cmap = root->getStackCMap();
+ if (!cmap)
+ cmap = getCMap();
+ if (_obj && cmap)
+ _obj->reload(cmap);
+}
+
void MainModelComponent::reset() {
_visible = true;
// Can be NULL if this was attached to another costume which
diff --git a/engines/grim/costume/main_model_component.h b/engines/grim/costume/main_model_component.h
index 1c6f0f34f38..54186e7096d 100644
--- a/engines/grim/costume/main_model_component.h
+++ b/engines/grim/costume/main_model_component.h
@@ -33,11 +33,13 @@ public:
MainModelComponent(Component *parent, int parentID, const char *filename, Component *prevComponent, tag32 tag);
~MainModelComponent();
void init() override;
- void setColormap(CMap *cmap) override;
void refreshColormap() override;
+ void resetColormap() override;
void reset() override;
private:
+ CMap *getStackCMap() const;
+
bool _hierShared;
Common::List<MainModelComponent*> _children;
MainModelComponent *_parentModel;
More information about the Scummvm-git-logs
mailing list