aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/pet_control
diff options
context:
space:
mode:
authorPaul Gilbert2017-07-27 22:31:24 -0400
committerPaul Gilbert2017-07-27 22:31:24 -0400
commitc1ed17ce861d7434f5b1aabb70a54cef250b6378 (patch)
treeffeac588df7ee41ea3c2dc2eab97f88c54680c7b /engines/titanic/pet_control
parent27f51565c3046015110fa5ca4ff16036972348dc (diff)
downloadscummvm-rg350-c1ed17ce861d7434f5b1aabb70a54cef250b6378.tar.gz
scummvm-rg350-c1ed17ce861d7434f5b1aabb70a54cef250b6378.tar.bz2
scummvm-rg350-c1ed17ce861d7434f5b1aabb70a54cef250b6378.zip
TITANIC: Cleanup/renaming of inventory glyph animatin code
Diffstat (limited to 'engines/titanic/pet_control')
-rw-r--r--engines/titanic/pet_control/pet_inventory.cpp4
-rw-r--r--engines/titanic/pet_control/pet_inventory.h2
-rw-r--r--engines/titanic/pet_control/pet_inventory_glyphs.cpp20
-rw-r--r--engines/titanic/pet_control/pet_inventory_glyphs.h9
4 files changed, 19 insertions, 16 deletions
diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp
index aa1bb31809..e7e8e1f02b 100644
--- a/engines/titanic/pet_control/pet_inventory.cpp
+++ b/engines/titanic/pet_control/pet_inventory.cpp
@@ -244,13 +244,13 @@ CGameObject *CPetInventory::getImage(int index) {
return nullptr;
}
-void CPetInventory::playMovie(CGameObject *movie, int flag) {
+void CPetInventory::playMovie(CGameObject *movie, bool repeat) {
if (_movie)
_movie->stopMovie();
_movie = movie;
if (_movie) {
- if (flag)
+ if (repeat)
_movie->playMovie(0, 14, MOVIE_REPEAT);
else
_movie->playMovie(0);
diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h
index 7efc0755d8..8a95efbc24 100644
--- a/engines/titanic/pet_control/pet_inventory.h
+++ b/engines/titanic/pet_control/pet_inventory.h
@@ -166,7 +166,7 @@ public:
/**
* Play the animated movie for an object
*/
- void playMovie(CGameObject *movie, int flag);
+ void playMovie(CGameObject *movie, bool repeat = true);
};
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_inventory_glyphs.cpp b/engines/titanic/pet_control/pet_inventory_glyphs.cpp
index bda88baf44..9422eb6f3b 100644
--- a/engines/titanic/pet_control/pet_inventory_glyphs.cpp
+++ b/engines/titanic/pet_control/pet_inventory_glyphs.cpp
@@ -36,7 +36,7 @@ const uint ITEM_MODES[40] = {
};
void CPetInventoryGlyph::enter() {
- startBackgroundMovie();
+ startRepeatedMovie();
}
void CPetInventoryGlyph::leave() {
@@ -59,7 +59,7 @@ void CPetInventoryGlyph::drawAt(CScreenManager *screenManager, const Point &pt,
_image = nullptr;
if (_background && isHighlighted_) {
_background->setPosition(pt);
- startBackgroundMovie();
+ startRepeatedMovie();
}
}
@@ -302,19 +302,19 @@ int CPetInventoryGlyph::getItemIndex(CGameObject *item, bool isLoading) {
return movieFrame;
}
-void CPetInventoryGlyph::startBackgroundMovie() {
+void CPetInventoryGlyph::startRepeatedMovie() {
if (_owner) {
CPetInventory *section = dynamic_cast<CPetInventory *>(_owner->getOwner());
if (section)
- section->playMovie(_background, MOVIE_REPEAT);
+ section->playMovie(_background, true);
}
}
-void CPetInventoryGlyph::startForegroundMovie() {
+void CPetInventoryGlyph::startSingularMovie() {
if (_owner) {
CPetInventory *section = dynamic_cast<CPetInventory *>(_owner->getOwner());
if (section)
- section->playMovie(_image, MOVIE_REPEAT);
+ section->playMovie(_image, false);
}
}
@@ -322,17 +322,19 @@ void CPetInventoryGlyph::stopMovie() {
if (_owner) {
CPetInventory *section = dynamic_cast<CPetInventory *>(_owner->getOwner());
if (section)
- section->playMovie(nullptr, MOVIE_REPEAT);
+ section->playMovie(nullptr);
}
}
void CPetInventoryGlyph::reposition(const Point &pt) {
if (_image) {
+ // Special transformation of item to piece of Titania
_image->setPosition(pt);
- startForegroundMovie();
+ startSingularMovie();
} else if (_background) {
+ // Standard repeating animation
_background->setPosition(pt);
- startBackgroundMovie();
+ startRepeatedMovie();
}
}
diff --git a/engines/titanic/pet_control/pet_inventory_glyphs.h b/engines/titanic/pet_control/pet_inventory_glyphs.h
index cf1cfb392b..e35ecc00f7 100644
--- a/engines/titanic/pet_control/pet_inventory_glyphs.h
+++ b/engines/titanic/pet_control/pet_inventory_glyphs.h
@@ -44,14 +44,15 @@ private:
int getItemIndex(CGameObject *item, bool isLoading);
/**
- * Start any movie for the background
+ * Start a repeated animation for the item
*/
- void startBackgroundMovie();
+ void startRepeatedMovie();
/**
- * Start any movie for the foreground item
+ * Start a singular (non-repeating) animation for the item,
+ * such as an item's transformation into a piece of Titania
*/
- void startForegroundMovie();
+ void startSingularMovie();
/**
* Stop any previously started foreground or background movie