aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2016-07-23 19:15:26 -0400
committerPaul Gilbert2016-07-23 19:15:26 -0400
commit2efee2ae8c1c4e285fe81bce66a594d9b949548a (patch)
treed781d99d1027eaadea2de4190f6118220d8eb81f /engines/titanic
parentd690ca322c04ee2044b7502369c5cc104a0c7b76 (diff)
downloadscummvm-rg350-2efee2ae8c1c4e285fe81bce66a594d9b949548a.tar.gz
scummvm-rg350-2efee2ae8c1c4e285fe81bce66a594d9b949548a.tar.bz2
scummvm-rg350-2efee2ae8c1c4e285fe81bce66a594d9b949548a.zip
TITANIC: Further timers cleanup
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/game_manager.h7
-rw-r--r--engines/titanic/pet_control/pet_control.cpp6
-rw-r--r--engines/titanic/pet_control/pet_control.h5
-rw-r--r--engines/titanic/support/time_event_info.cpp21
-rw-r--r--engines/titanic/support/time_event_info.h14
5 files changed, 32 insertions, 21 deletions
diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h
index 4808b260b7..aa2df461e8 100644
--- a/engines/titanic/game_manager.h
+++ b/engines/titanic/game_manager.h
@@ -193,7 +193,12 @@ public:
*/
void stopTimer(uint id) { _timers.stop(id); }
- void setTimer44(uint id, uint val) { _timers.set44(id, val); }
+ /**
+ * Flags whether the timer will be persisent across save & loads
+ */
+ void setTimerPersisent(uint id, bool flag) {
+ _timers.setPersisent(id, flag);
+ }
/**
* Return the true talk manager
diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp
index 0695cdea79..83081456d1 100644
--- a/engines/titanic/pet_control/pet_control.cpp
+++ b/engines/titanic/pet_control/pet_control.cpp
@@ -621,7 +621,7 @@ void CPetControl::startPetTimer(uint timerIndex, uint firstDuration, uint durati
stopPetTimer(timerIndex);
_timers[timerIndex]._id = addTimer(timerIndex, firstDuration, duration);
_timers[timerIndex]._target = target;
- setTimer44(_timers[timerIndex]._id, 0);
+ setTimerPersisent(_timers[timerIndex]._id, false);
}
void CPetControl::stopPetTimer(uint timerIndex) {
@@ -631,8 +631,8 @@ void CPetControl::stopPetTimer(uint timerIndex) {
}
}
-void CPetControl::setTimer44(int id, int val) {
- getGameManager()->setTimer44(id, val);
+void CPetControl::setTimerPersisent(int id, bool flag) {
+ getGameManager()->setTimerPersisent(id, flag);
}
CGameObject *CPetControl::findBot(const CString &name, CTreeItem *root) {
diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h
index e56d8f8f90..39df91cf91 100644
--- a/engines/titanic/pet_control/pet_control.h
+++ b/engines/titanic/pet_control/pet_control.h
@@ -103,7 +103,10 @@ private:
*/
CGameObject *findBot(const CString &name, CTreeItem *root);
- void setTimer44(int id, int val);
+ /**
+ * Flags whether the timer will be persisent across save & loads
+ */
+ void setTimerPersisent(int id, bool flag);
protected:
bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
bool MouseDragStartMsg(CMouseDragStartMsg *msg);
diff --git a/engines/titanic/support/time_event_info.cpp b/engines/titanic/support/time_event_info.cpp
index 1787741809..0226223f1a 100644
--- a/engines/titanic/support/time_event_info.cpp
+++ b/engines/titanic/support/time_event_info.cpp
@@ -76,11 +76,11 @@ void CTimeEventInfoList::stop(uint id) {
}
}
-void CTimeEventInfoList::set44(uint id, uint val) {
+void CTimeEventInfoList::setPersisent(uint id, bool flag) {
for (iterator i = begin(); i != end(); ++i) {
CTimeEventInfo *item = *i;
if (item->_id == id) {
- item->set44(val);
+ item->setPersisent(flag);
return;
}
}
@@ -91,18 +91,17 @@ void CTimeEventInfoList::set44(uint id, uint val) {
uint CTimeEventInfo::_nextId;
CTimeEventInfo::CTimeEventInfo() : ListItem(), _lockCounter(0),
- _repeated(false), _firstDuration(0), _repeatDuration(0), _target(nullptr),
- _actionVal(0), _field2C(0), _field30(0), _timerCtr(0),
- _lastTimerTicks(0), _relativeTicks(0), _done(false), _field44(0) {
+ _repeated(false), _firstDuration(0), _repeatDuration(0),
+ _target(nullptr), _actionVal(0), _timerCtr(0), _done(false),
+ _lastTimerTicks(0), _relativeTicks(0), _persisent(true) {
_id = _nextId++;
}
CTimeEventInfo::CTimeEventInfo(uint ticks, bool repeated, uint firstDuration,
uint repeatDuration, CTreeItem *target, int endVal, const CString &action) :
ListItem(), _lockCounter(0), _repeated(repeated), _firstDuration(firstDuration),
- _repeatDuration(repeatDuration), _target(target), _actionVal(endVal), _field2C(0),
- _field30(0), _timerCtr(0), _lastTimerTicks(ticks), _relativeTicks(0), _done(false),
- _field44(true) {
+ _repeatDuration(repeatDuration), _target(target), _actionVal(endVal), _done(false),
+ _timerCtr(0), _lastTimerTicks(ticks), _relativeTicks(0), _persisent(true) {
_id = _nextId++;
}
@@ -122,7 +121,7 @@ void CTimeEventInfo::save(SimpleFile *file, int indent) {
file->writeNumberLine(_timerCtr, indent);
file->writeNumberLine(_relativeTicks, indent);
file->writeNumberLine(_done, indent);
- file->writeNumberLine(_field44, indent);
+ file->writeNumberLine(_persisent, indent);
}
void CTimeEventInfo::load(SimpleFile *file) {
@@ -140,13 +139,13 @@ void CTimeEventInfo::load(SimpleFile *file) {
_timerCtr = file->readNumber();
_relativeTicks = file->readNumber();
_done = file->readNumber() != 0;
- _field44 = file->readNumber();
+ _persisent = file->readNumber() != 0;
_target = nullptr;
}
}
void CTimeEventInfo::postLoad(uint ticks, CProjectItem *project) {
- if (!_field44 || _targetName.empty())
+ if (!_persisent || _targetName.empty())
_done = true;
// Get the timer's target
diff --git a/engines/titanic/support/time_event_info.h b/engines/titanic/support/time_event_info.h
index 23d0d2b803..ee787bcbef 100644
--- a/engines/titanic/support/time_event_info.h
+++ b/engines/titanic/support/time_event_info.h
@@ -55,13 +55,11 @@ public:
CTreeItem *_target;
uint _actionVal;
CString _action;
- uint _field2C;
- uint _field30;
uint _timerCtr;
uint _lastTimerTicks;
uint _relativeTicks;
bool _done;
- uint _field44;
+ bool _persisent;
CString _targetName;
public:
CLASSDEF
@@ -96,7 +94,10 @@ public:
bool update(uint ticks);
- void set44(uint val) { _field44 = val; }
+ /**
+ * Flags whether the timer will be persisent across save & loads
+ */
+ void setPersisent(bool val) { _persisent = val; }
};
class CTimeEventInfoList : public List<CTimeEventInfo> {
@@ -126,7 +127,10 @@ public:
*/
void stop(uint id);
- void set44(uint id, uint val);
+ /**
+ * Sets whether a timer with a given Id will be persisent across saves
+ */
+ void setPersisent(uint id, bool flag);
};
} // End of namespace Titanic