aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/titanic/true_talk/tt_npc_script.cpp7
-rw-r--r--engines/titanic/true_talk/tt_npc_script.h6
2 files changed, 9 insertions, 4 deletions
diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp
index 7540a738b5..ba205b6498 100644
--- a/engines/titanic/true_talk/tt_npc_script.cpp
+++ b/engines/titanic/true_talk/tt_npc_script.cpp
@@ -416,6 +416,7 @@ void TTnpcScript::load(SimpleFile *file) {
loadBody(file);
int count = file->readNumber();
+ assert(count == 4);
_rangeResetCtr = file->readNumber();
_currentDialNum = file->readNumber();
_dialDelta = file->readNumber();
@@ -434,13 +435,13 @@ void TTnpcScript::load(SimpleFile *file) {
}
void TTnpcScript::saveBody(SimpleFile *file) {
- int count = proc31();
+ int count = getRangesCount();
file->writeNumber(count);
if (count > 0) {
for (uint idx = 0; idx < _ranges.size(); ++idx) {
const TTscriptRange &item = _ranges[idx];
- if (item._mode == SF_RANDOM && item._priorIndex) {
+ if (item._mode != SF_RANDOM && item._priorIndex) {
file->writeNumber(item._id);
file->writeNumber(item._priorIndex);
}
@@ -466,7 +467,7 @@ void TTnpcScript::loadBody(SimpleFile *file) {
}
}
-int TTnpcScript::proc31() const {
+int TTnpcScript::getRangesCount() const {
int count = 0;
for (uint idx = 0; idx < _ranges.size(); ++idx) {
const TTscriptRange &item = _ranges[idx];
diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h
index bdca568b09..e5be7d7296 100644
--- a/engines/titanic/true_talk/tt_npc_script.h
+++ b/engines/titanic/true_talk/tt_npc_script.h
@@ -308,7 +308,11 @@ public:
virtual void load(SimpleFile *file);
virtual void saveBody(SimpleFile *file);
virtual void loadBody(SimpleFile *file);
- virtual int proc31() const;
+
+ /**
+ * Returns the number of range records that are non-random
+ */
+ virtual int getRangesCount() const;
/**
* Sets a given dial to be pointing in a specified region (0 to 2)