aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/pet_control
diff options
context:
space:
mode:
authorPaul Gilbert2016-04-28 19:43:55 -0400
committerPaul Gilbert2016-07-10 16:22:34 -0400
commitde7329619612514e8fd3e9ba1f3e6d7389fd199d (patch)
tree0c99572f4106b572859e73df502b8f2fcacf0e2a /engines/titanic/pet_control
parentb7ad513b0f0c99bc670546dbb3483e93d59652ee (diff)
downloadscummvm-rg350-de7329619612514e8fd3e9ba1f3e6d7389fd199d.tar.gz
scummvm-rg350-de7329619612514e8fd3e9ba1f3e6d7389fd199d.tar.bz2
scummvm-rg350-de7329619612514e8fd3e9ba1f3e6d7389fd199d.zip
TITANIC: Implement PET Text scrollToBottom, beginnings of addLine
Diffstat (limited to 'engines/titanic/pet_control')
-rw-r--r--engines/titanic/pet_control/pet_conversations.cpp61
-rw-r--r--engines/titanic/pet_control/pet_conversations.h26
-rw-r--r--engines/titanic/pet_control/pet_text.cpp17
-rw-r--r--engines/titanic/pet_control/pet_text.h15
4 files changed, 107 insertions, 12 deletions
diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp
index d2c891efb8..c884d181d3 100644
--- a/engines/titanic/pet_control/pet_conversations.cpp
+++ b/engines/titanic/pet_control/pet_conversations.cpp
@@ -49,8 +49,35 @@ bool CPetConversations::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
return
_scrollUp.MouseButtonDownMsg(msg->_mousePos) ||
_scrollDown.MouseButtonDownMsg(msg->_mousePos) ||
- _val7.MouseButtonDownMsg(msg->_mousePos) ||
- _val8.MouseButtonDownMsg(msg->_mousePos);
+ _doorBot.MouseButtonDownMsg(msg->_mousePos) ||
+ _bellBot.MouseButtonDownMsg(msg->_mousePos);
+}
+
+bool CPetConversations::MouseButtonUpMsg(CMouseButtonUpMsg *msg) {
+ if (_scrollUp.MouseButtonUpMsg(msg->_mousePos) ||
+ _scrollDown.MouseButtonUpMsg(msg->_mousePos))
+ return true;
+
+ if (_doorBot.MouseButtonUpMsg(msg->_mousePos)) {
+ switch (canSummonNPC("DoorBot")) {
+ case SUMMON_CANT:
+ break;
+ case SUMMON_CAN:
+ summonNPC("DoorBot");
+ return true;
+ default:
+ break;
+ }
+
+ // Scroll to the bottom of the log
+ scrollToBottom();
+ }
+
+ if (_bellBot.MouseButtonUpMsg(msg->_mousePos)) {
+ // TODO
+ }
+
+ return false;
}
bool CPetConversations::setupControl(CPetControl *petControl) {
@@ -75,10 +102,10 @@ bool CPetConversations::setupControl(CPetControl *petControl) {
_scrollDown.translate(87, 421);
const Rect rect3(0, 0, 39, 39);
- _val7.setBounds(rect3);
- _val7.translate(546, 372);
- _val8.setBounds(rect3);
- _val8.translate(546, 418);
+ _doorBot.setBounds(rect3);
+ _doorBot.translate(546, 372);
+ _bellBot.setBounds(rect3);
+ _bellBot.translate(546, 418);
_val6.setBounds(Rect(0, 0, 37, 70));
_val6.translate(46, 374);
@@ -95,16 +122,34 @@ bool CPetConversations::setupControl(CPetControl *petControl) {
return true;
}
+void CPetConversations::scrollUp() {
+ _log.scrollUp(CScreenManager::_screenManagerPtr);
+ if (_petControl)
+ _petControl->makeDirty();
+ _field414 = true;
+}
+
void CPetConversations::scrollDown() {
_log.scrollDown(CScreenManager::_screenManagerPtr);
if (_petControl)
_petControl->makeDirty();
+ _field414 = true;
}
-void CPetConversations::scrollUp() {
- _log.scrollUp(CScreenManager::_screenManagerPtr);
+void CPetConversations::scrollToBottom() {
+ _log.scrollToBottom(CScreenManager::_screenManagerPtr);
if (_petControl)
_petControl->makeDirty();
+ _field414 = true;
+}
+
+SummonResult CPetConversations::canSummonNPC(const CString &name) {
+ warning("TODO: canSummonNPC");
+ return SUMMON_ABORT;
+}
+
+void CPetConversations::summonNPC(const CString &name) {
+ warning("TODO: summonNPC");
}
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h
index 8a3ca886a5..d04e9834d1 100644
--- a/engines/titanic/pet_control/pet_conversations.h
+++ b/engines/titanic/pet_control/pet_conversations.h
@@ -29,6 +29,8 @@
namespace Titanic {
+enum SummonResult { SUMMON_CANT = 0, SUMMON_CAN = 1, SUMMON_ABORT = 2 };
+
class CPetConversations : public CPetSection {
private:
CPetGfxElement _scrollUp;
@@ -39,8 +41,8 @@ private:
CPetGfxElement _val5;
CPetGfxElement _val6;
int _field14C;
- CPetGfxElement _val7;
- CPetGfxElement _val8;
+ CPetGfxElement _doorBot;
+ CPetGfxElement _bellBot;
CPetGfxElement _val9;
CPetGfxElement _valArray2[9];
int _field30C;
@@ -57,14 +59,29 @@ private:
bool setupControl(CPetControl *petControl);
/**
+ * Scroll up the conversation log
+ */
+ void scrollUp();
+
+ /**
* Scroll down the conversation log
*/
void scrollDown();
/**
- * Scroll up the conversation log
+ * Scroll to the bottom of the conversation log
*/
- void scrollUp();
+ void scrollToBottom();
+
+ /**
+ * Check whether an NPC can be summoned
+ */
+ SummonResult canSummonNPC(const CString &name);
+
+ /**
+ * Summon an NPC
+ */
+ void summonNPC(const CString &name);
public:
CPetConversations();
@@ -88,6 +105,7 @@ public:
* pass onto the currently active section/area
*/
virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+ virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg);
};
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp
index 9a895de36b..67910dc18c 100644
--- a/engines/titanic/pet_control/pet_text.cpp
+++ b/engines/titanic/pet_control/pet_text.cpp
@@ -264,6 +264,13 @@ void CPetText::scrollDown(CScreenManager *screenManager) {
screenManager->setFontNumber(oldFontNumber);
}
+void CPetText::scrollToBottom(CScreenManager *screenManager) {
+ int oldFontNumber = screenManager->setFontNumber(_fontNumber2);
+ _scrollTop = _bounds.height();
+ constrainScrollDown(screenManager);
+ screenManager->setFontNumber(oldFontNumber);
+}
+
void CPetText::constrainScrollUp(CScreenManager *screenManager) {
if (_scrollTop < 0)
_scrollTop = 0;
@@ -279,4 +286,14 @@ void CPetText::constrainScrollDown(CScreenManager *screenManager) {
_scrollTop = maxScroll;
}
+void CPetText::addLine(const CString &str, uint color) {
+ addLine(str, color & 0xff, (color >> 8) & 0xff,
+ (color >> 16) & 0xff);
+}
+
+void CPetText::addLine(const CString &str, byte r, byte g, byte b) {
+ warning("TODO: CPetText::addLine");
+}
+
+
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h
index 36d098f141..6000dd6d0b 100644
--- a/engines/titanic/pet_control/pet_text.h
+++ b/engines/titanic/pet_control/pet_text.h
@@ -177,6 +177,21 @@ public:
* Scroll the text down
*/
void scrollDown(CScreenManager *screenManager);
+
+ /**
+ * Scroll to the bottom of the text
+ */
+ void scrollToBottom(CScreenManager *screenManager);
+
+ /**
+ * Add a line to the text
+ */
+ void addLine(const CString &str, uint color);
+
+ /**
+ * Add a line to the text
+ */
+ void addLine(const CString &str, byte r, byte g, byte b);
};
} // End of namespace Titanic