aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/savegame.cpp2
-rw-r--r--engines/sci/event.cpp17
-rw-r--r--engines/sci/event.h5
-rw-r--r--engines/sci/resource.cpp13
-rw-r--r--engines/sci/resource.h2
-rw-r--r--engines/sci/sci.cpp2
6 files changed, 37 insertions, 4 deletions
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index ef17b17f29..498158ed17 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -945,7 +945,7 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
// Create a new EngineState object
retval = new EngineState(s->_voc, s->_segMan);
- retval->_event = new SciEvent();
+ retval->_event = s->_event;
// Copy some old data
retval->_soundCmd = s->_soundCmd;
diff --git a/engines/sci/event.cpp b/engines/sci/event.cpp
index a6df0d7863..e1358b38ae 100644
--- a/engines/sci/event.cpp
+++ b/engines/sci/event.cpp
@@ -36,7 +36,11 @@ namespace Sci {
#define SCANCODE_ROWS_NR 3
-SciEvent::SciEvent() {
+SciEvent::SciEvent(ResourceManager *resMan)
+ : _resMan(resMan) {
+
+ // Check, if font of current game includes extended chars
+ _fontIsExtended = _resMan->detectFontExtended();
}
SciEvent::~SciEvent() {
@@ -167,6 +171,17 @@ sciEvent SciEvent::getFromScummVM() {
// Directly accept most common keys without conversion
input.type = SCI_EVENT_KEYBOARD;
if ((input.character >= 0x80) && (input.character <= 0xFF)) {
+ // If there is no extended font, we will just clear the current event
+ // Sierra SCI actually accepted those characters, but didn't display them inside textedit-controls
+ // because the characters were missing inside the font(s)
+ // We filter them out for non-multilingual games because of that
+ if (!_fontIsExtended) {
+ input.type = SCI_EVENT_NONE;
+ input.character = 0;
+ input.data = 0;
+ input.modifiers = 0;
+ return input;
+ }
// we get 8859-1 character, we need dos (cp850/437) character for multilingual sci01 games
// TODO: check, if we get 8859-1 on all platforms
input.character = codepagemap_88591toDOS[input.character & 0x7f];
diff --git a/engines/sci/event.h b/engines/sci/event.h
index 1f9d46b2f6..86d622affb 100644
--- a/engines/sci/event.h
+++ b/engines/sci/event.h
@@ -113,7 +113,7 @@ struct sciEvent {
class SciEvent {
public:
- SciEvent();
+ SciEvent(ResourceManager *resMan);
~SciEvent();
sciEvent get(unsigned int mask);
@@ -126,6 +126,9 @@ private:
int numlockify (int c);
sciEvent getFromScummVM();
+ ResourceManager *_resMan;
+
+ bool _fontIsExtended;
Common::List<sciEvent> _events;
};
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index a5569555e9..16f84e1070 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -1979,6 +1979,19 @@ bool ResourceManager::detectHires() {
#endif
}
+bool ResourceManager::detectFontExtended() {
+
+ Resource *res = findResource(ResourceId(kResourceTypeFont, 0), 0);
+ if (res) {
+ if (res->size >= 4) {
+ uint16 numChars = READ_LE_UINT16(res->data + 2);
+ if (numChars > 0x80)
+ return true;
+ }
+ }
+ return false;
+}
+
// Functions below are based on PD code by Brian Provinciano (SCI Studio)
bool ResourceManager::hasOldScriptHeader() {
Resource *res = findResource(ResourceId(kResourceTypeScript, 0), 0);
diff --git a/engines/sci/resource.h b/engines/sci/resource.h
index 3b86c5aaaa..eb1b844071 100644
--- a/engines/sci/resource.h
+++ b/engines/sci/resource.h
@@ -265,6 +265,8 @@ public:
void addNewGMPatch(const Common::String &gameId);
bool detectHires();
+ // Detects, if standard font of current game includes extended characters (>0x80)
+ bool detectFontExtended();
protected:
// Maximum number of bytes to allow being allocated for resources
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 8e8fa4220b..05752dac03 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -181,7 +181,7 @@ Common::Error SciEngine::run() {
_features = new GameFeatures(segMan, _kernel);
_gamestate = new EngineState(_vocabulary, segMan);
- _gamestate->_event = new SciEvent();
+ _gamestate->_event = new SciEvent(_resMan);
if (script_init_engine(_gamestate))
return Common::kUnknownError;