aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/titanic/pet_control/pet_conversations.cpp12
-rw-r--r--engines/titanic/pet_control/pet_conversations.h9
-rw-r--r--engines/titanic/pet_control/pet_text.cpp8
-rw-r--r--engines/titanic/pet_control/pet_text.h5
4 files changed, 29 insertions, 5 deletions
diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp
index 960b325bc0..7596e65961 100644
--- a/engines/titanic/pet_control/pet_conversations.cpp
+++ b/engines/titanic/pet_control/pet_conversations.cpp
@@ -126,13 +126,15 @@ void CPetConversations::save(SimpleFile *file, int indent) const {
void CPetConversations::enter(PetArea oldArea) {
if (_petControl && _petControl->_activeNPC)
// Start a timer for the NPC
- addNPCTimer();
+ startNPCTimer();
+ // Show the text cursor
_textInput.showCursor(-2);
}
void CPetConversations::leave() {
-
+ _textInput.hideCursor();
+ stopNPCTimer();
}
bool CPetConversations::setupControl(CPetControl *petControl) {
@@ -233,10 +235,14 @@ void CPetConversations::summonNPC(const CString &name) {
}
}
-void CPetConversations::addNPCTimer() {
+void CPetConversations::startNPCTimer() {
_petControl->startPetTimer(1, 1000, 1000, this);
}
+void CPetConversations::stopNPCTimer() {
+ _petControl->stopPetTimer(1);
+}
+
bool CPetConversations::handleKey(const Common::KeyState &keyState) {
switch (keyState.keycode) {
case Common::KEYCODE_UP:
diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h
index ca85e14583..c7fb207615 100644
--- a/engines/titanic/pet_control/pet_conversations.h
+++ b/engines/titanic/pet_control/pet_conversations.h
@@ -97,9 +97,14 @@ private:
void summonNPC(const CString &name);
/**
- * Adds an NPC timer
+ * Starts the NPC timer
*/
- void addNPCTimer();
+ void startNPCTimer();
+
+ /**
+ * Stops the NPC timer
+ */
+ void stopNPCTimer();
/**
* Handle a keypress
diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp
index 7e5f329632..6f870faa32 100644
--- a/engines/titanic/pet_control/pet_text.cpp
+++ b/engines/titanic/pet_control/pet_text.cpp
@@ -402,4 +402,12 @@ void CPetText::showCursor(int mode) {
}
}
+void CPetText::hideCursor() {
+ if (_textCursor) {
+ _textCursor->setMode(-1);
+ _textCursor->hide();
+ _textCursor = nullptr;
+ }
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h
index 2b68b743c2..9b914dcbc1 100644
--- a/engines/titanic/pet_control/pet_text.h
+++ b/engines/titanic/pet_control/pet_text.h
@@ -236,6 +236,11 @@ public:
* and give it suitable defaults
*/
void showCursor(int mode);
+
+ /**
+ * Removes the cursor attached to the text
+ */
+ void hideCursor();
};
} // End of namespace Titanic