[Scummvm-git-logs] scummvm master -> dda46ebf08018a389328a83242f7228dc21ee0cd
Strangerke
Strangerke at scummvm.org
Mon Jun 7 21:35:16 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
dda46ebf08 TRECISION: Add clear functions to several structs used by DialogManager, use them in DialogManager constructor
Commit: dda46ebf08018a389328a83242f7228dc21ee0cd
https://github.com/scummvm/scummvm/commit/dda46ebf08018a389328a83242f7228dc21ee0cd
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2021-06-07T22:35:08+01:00
Commit Message:
TRECISION: Add clear functions to several structs used by DialogManager, use them in DialogManager constructor
Changed paths:
engines/trecision/dialog.cpp
engines/trecision/dialog.h
diff --git a/engines/trecision/dialog.cpp b/engines/trecision/dialog.cpp
index 5e9be3b82f..acfa7b8baa 100644
--- a/engines/trecision/dialog.cpp
+++ b/engines/trecision/dialog.cpp
@@ -31,6 +31,39 @@
#include "trecision/video.h"
namespace Trecision {
+inline void Dialog::clear() {
+ _flag = 0;
+ _interlocutor = 0;
+ memset(_startAnim, 0, 14);
+ _startLen = 0;
+ _firstChoice = 0;
+ _choiceNumb = 0;
+ for (uint16 i = 0; i < MAXNEWSMKPAL; ++i)
+ _newPal[i] = 0;
+}
+
+void DialogSubTitle::clear() {
+ _sentence = 0;
+ _x = _y = 0;
+ _color = 0;
+ _startFrame = 0;
+ _length = 0;
+}
+
+void DialogChoice::clear() {
+ _flag = 0;
+ _sentenceIndex = 0;
+ _firstSubTitle = _subTitleNumb = 0;
+ for (int i = 0; i < MAXDISPCHOICES; ++i) {
+ _on[i] = _off[i] = 0;
+ }
+
+ _startFrame = 0;
+ _nextDialog = 0;
+}
+
+/**************************************************************/
+
DialogManager::DialogManager(TrecisionEngine *vm) : _vm(vm) {
_curDialog = 0;
_curChoice = 0;
@@ -38,6 +71,18 @@ DialogManager::DialogManager(TrecisionEngine *vm) : _vm(vm) {
_curDispChoice = 0;
_curPos = -1;
_lastPos = -1;
+
+ for (int i = 0; i < MAXDIALOG; ++i)
+ _dialog[i].clear();
+
+ for (int i = 0; i < MAXCHOICE; ++i)
+ _choice[i].clear();
+
+ for (int i = 0; i < MAXSUBTITLES; ++i)
+ _subTitles[i].clear();
+
+ for (int i = 0; i < MAXDISPCHOICES; ++i)
+ _dispChoice[i] = 0;
}
DialogManager::~DialogManager() {}
diff --git a/engines/trecision/dialog.h b/engines/trecision/dialog.h
index ba1bf03a7c..06ccfc9b4c 100644
--- a/engines/trecision/dialog.h
+++ b/engines/trecision/dialog.h
@@ -44,12 +44,16 @@ struct Dialog {
uint16 _firstChoice;
uint16 _choiceNumb;
uint16 _newPal[MAXNEWSMKPAL];
+
+ void clear();
};
struct DialogSubTitle {
uint16 _sentence;
uint16 _x, _y, _color; // you can compact this info using a bit field
uint16 _startFrame, _length; // Frame at which the subtitle starts and its length
+
+ void clear();
};
struct DialogChoice {
@@ -59,6 +63,8 @@ struct DialogChoice {
uint16 _on[MAXDISPCHOICES], _off[MAXDISPCHOICES];
uint16 _startFrame; // Starting frame of the choice
uint16 _nextDialog;
+
+ void clear();
};
class DialogManager {
More information about the Scummvm-git-logs
mailing list