aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/kstring.cpp18
-rw-r--r--engines/sci/engine/savegame.cpp3
-rw-r--r--engines/sci/engine/state.h3
3 files changed, 14 insertions, 10 deletions
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index 4583a56ac0..5dbacaca46 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -663,8 +663,6 @@ reg_t kGetFarText(EngineState *s, int funct_nr, int argc, reg_t *argv) {
#define DUMMY_MESSAGE "Message not found!"
-static MessageState state; // FIXME: Avoid static vars
-
enum kMessageFunc {
K_MESSAGE_GET,
K_MESSAGE_NEXT,
@@ -710,8 +708,8 @@ reg_t kMessage(EngineState *s, int funct_nr, int argc, reg_t *argv) {
reg_t retval;
if (func == K_MESSAGE_GET) {
- state.loadRes(s->resmgr, UKPV(1), true);
- state.findTuple(tuple);
+ s->_msgState.loadRes(s->resmgr, UKPV(1), true);
+ s->_msgState.findTuple(tuple);
if (isGetMessage)
bufferReg = (argc == 4 ? argv[3] : NULL_REG);
@@ -721,12 +719,12 @@ reg_t kMessage(EngineState *s, int funct_nr, int argc, reg_t *argv) {
bufferReg = (argc == 2 ? argv[1] : NULL_REG);
}
- if (state.getMessage()) {
- str = state.getText();
+ if (s->_msgState.getMessage()) {
+ str = s->_msgState.getText();
if (isGetMessage)
retval = bufferReg;
else
- retval = make_reg(0, state.getTalker());
+ retval = make_reg(0, s->_msgState.getTalker());
} else {
str = DUMMY_MESSAGE;
retval = NULL_REG;
@@ -747,7 +745,7 @@ reg_t kMessage(EngineState *s, int funct_nr, int argc, reg_t *argv) {
*buffer = 0;
}
- state.gotoNext();
+ s->_msgState.gotoNext();
}
return retval;
@@ -780,8 +778,8 @@ reg_t kMessage(EngineState *s, int funct_nr, int argc, reg_t *argv) {
return NULL_REG;
}
case K_MESSAGE_LASTMESSAGE: {
- MessageTuple msg = state.getLastTuple();
- int module = state.getLastModule();
+ MessageTuple msg = s->_msgState.getLastTuple();
+ int module = s->_msgState.getLastModule();
byte *buffer = kernel_dereference_bulk_pointer(s, argv[1], 10);
if (buffer) {
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index c950837780..33561ea316 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -858,6 +858,9 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
retval->sound.debug = s->sound.debug;
reconstruct_sounds(retval);
+ // Message state:
+ retval->_msgState = s->_msgState;
+
return retval;
}
diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h
index c559a7c64c..ba4c07d9ca 100644
--- a/engines/sci/engine/state.h
+++ b/engines/sci/engine/state.h
@@ -39,6 +39,7 @@ namespace Common {
#include "sci/vocabulary.h"
#include "sci/resource.h"
#include "sci/engine/kernel.h" // for kfunct_sig_pair_t
+#include "sci/engine/message.h" // for MessageState
#include "sci/engine/script.h"
#include "sci/engine/seg_manager.h"
#include "sci/gfx/gfx_system.h"
@@ -263,6 +264,8 @@ public:
selector_map_t selector_map; /**< Shortcut list for important selectors */
+ MessageState _msgState;
+
EngineState *successor; /**< Successor of this state: Used for restoring */
};