aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2016-03-30 21:43:07 -0400
committerPaul Gilbert2016-03-30 21:43:07 -0400
commit948fb5bcca3a8d8594fd9e1f5470dac0448f74a9 (patch)
treefcebfbb176978852e81b91a5b962f683b9c9cf9b /engines/titanic
parent348b2d4b4bf9c6e8c6ca134ce7968eb9e9521a9c (diff)
downloadscummvm-rg350-948fb5bcca3a8d8594fd9e1f5470dac0448f74a9.tar.gz
scummvm-rg350-948fb5bcca3a8d8594fd9e1f5470dac0448f74a9.tar.bz2
scummvm-rg350-948fb5bcca3a8d8594fd9e1f5470dac0448f74a9.zip
TITANIC: Implement CPetVal drawing
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/core/game_object.cpp16
-rw-r--r--engines/titanic/core/game_object.h5
-rw-r--r--engines/titanic/pet_control/pet_element.h9
-rw-r--r--engines/titanic/pet_control/pet_val.cpp14
-rw-r--r--engines/titanic/pet_control/pet_val.h12
5 files changed, 46 insertions, 10 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index bb1541c275..ee7e071423 100644
--- a/engines/titanic/core/game_object.cpp
+++ b/engines/titanic/core/game_object.cpp
@@ -202,6 +202,22 @@ void CGameObject::draw(CScreenManager *screenManager) {
}
}
+void CGameObject::draw(CScreenManager *screenManager, const Common::Point &destPos) {
+ if (!_surface && !_resource.empty()) {
+ loadResource(_resource);
+ _resource.clear();
+ }
+
+ if (_surface) {
+ int xSize = _surface->getWidth();
+ int ySize = _surface->getHeight();
+
+ if (xSize > 0 && ySize > 0) {
+ screenManager->blitFrom(SURFACE_BACKBUFFER, _surface, &destPos);
+ }
+ }
+}
+
void CGameObject::loadResource(const CString &name) {
switch (name.imageTypeSuffix()) {
case FILETYPE_IMAGE:
diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h
index bacb73074d..b221a7ed23 100644
--- a/engines/titanic/core/game_object.h
+++ b/engines/titanic/core/game_object.h
@@ -138,6 +138,11 @@ public:
virtual void draw(CScreenManager *screenManager);
/**
+ * Allows the item to draw itself
+ */
+ virtual void draw(CScreenManager *screenManager, const Common::Point &destPos);
+
+ /**
* Stops any movie currently playing for the object
*/
void stopMovie();
diff --git a/engines/titanic/pet_control/pet_element.h b/engines/titanic/pet_control/pet_element.h
index 19a94c2e2f..330fbf21fa 100644
--- a/engines/titanic/pet_control/pet_element.h
+++ b/engines/titanic/pet_control/pet_element.h
@@ -53,9 +53,12 @@ public:
/**
* Draw the item
*/
- virtual void draw() {}
-
- virtual void proc4() {}
+ virtual void draw(CScreenManager *screenManager) {}
+
+ /**
+ * Draw the item
+ */
+ virtual void draw(CScreenManager *screenManager, const Common::Point &destPos) {}
/**
* Get the bounds for the element
diff --git a/engines/titanic/pet_control/pet_val.cpp b/engines/titanic/pet_control/pet_val.cpp
index cc48dc3e3a..096b2846a0 100644
--- a/engines/titanic/pet_control/pet_val.cpp
+++ b/engines/titanic/pet_control/pet_val.cpp
@@ -48,14 +48,18 @@ void CPetVal::proc2() {
error("TODO");
}
-void CPetVal::proc3() {
- error("TODO");
+void CPetVal::draw(CScreenManager *screenManager) {
+ draw(screenManager, Common::Point(_bounds.left, _bounds.top));
}
-void CPetVal::proc4() {
- error("TODO");
-}
+void CPetVal::draw(CScreenManager *screenManager, const Common::Point &destPos) {
+ CGameObject *obj = getObject();
+ if (!obj)
+ obj = _object0;
+ if (obj)
+ obj->draw(screenManager, destPos);
+}
void CPetVal::getBounds(Rect *rect) {
if (rect) {
diff --git a/engines/titanic/pet_control/pet_val.h b/engines/titanic/pet_control/pet_val.h
index 90e8cfa88a..90b7a2ec96 100644
--- a/engines/titanic/pet_control/pet_val.h
+++ b/engines/titanic/pet_control/pet_val.h
@@ -43,8 +43,16 @@ public:
CPetControl *petControl);
virtual void proc2();
- virtual void proc3();
- virtual void proc4();
+
+ /**
+ * Draw the item
+ */
+ virtual void draw(CScreenManager *screenManager);
+
+ /**
+ * Draw the item
+ */
+ virtual void draw(CScreenManager *screenManager, const Common::Point &destPos);
/**
* Get the bounds for the element