aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorMatthew Hoops2011-06-03 01:14:16 -0400
committerMatthew Hoops2011-06-03 01:14:16 -0400
commit224c71e483e09931ba386555ff3b436b9defe63d (patch)
tree8e6178331a7bbd3ee1be318d3fc7a7c7f478468f /engines/sci
parentd4c92983920cfe3b25a22d91e12c750e591b917e (diff)
parent547fd1bdcabcba0e741eb31100ba99ff73399d24 (diff)
downloadscummvm-rg350-224c71e483e09931ba386555ff3b436b9defe63d.tar.gz
scummvm-rg350-224c71e483e09931ba386555ff3b436b9defe63d.tar.bz2
scummvm-rg350-224c71e483e09931ba386555ff3b436b9defe63d.zip
Merge remote branch 'upstream/master' into pegasus
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/console.cpp19
-rw-r--r--engines/sci/detection.cpp2
-rw-r--r--engines/sci/engine/kfile.cpp2
-rw-r--r--engines/sci/engine/kgraphics.cpp21
-rw-r--r--engines/sci/engine/kpathing.cpp94
-rw-r--r--engines/sci/engine/kscripts.cpp4
-rw-r--r--engines/sci/engine/kstring.cpp3
-rw-r--r--engines/sci/engine/object.cpp4
-rw-r--r--engines/sci/engine/object.h2
-rw-r--r--engines/sci/engine/savegame.cpp2
-rw-r--r--engines/sci/engine/savegame.h2
-rw-r--r--engines/sci/engine/script.cpp18
-rw-r--r--engines/sci/engine/script.h12
-rw-r--r--engines/sci/engine/seg_manager.cpp8
-rw-r--r--engines/sci/engine/seg_manager.h2
-rw-r--r--engines/sci/engine/segment.h2
-rw-r--r--engines/sci/engine/selector.h2
-rw-r--r--engines/sci/engine/workarounds.cpp1
-rw-r--r--engines/sci/event.cpp2
-rw-r--r--engines/sci/graphics/animate.cpp2
-rw-r--r--engines/sci/graphics/cursor.cpp4
-rw-r--r--engines/sci/graphics/text16.cpp2
-rw-r--r--engines/sci/sci.cpp5
-rw-r--r--engines/sci/sci.h2
24 files changed, 124 insertions, 93 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 5f5af195b5..af945247ba 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -74,6 +74,9 @@ static int parse_reg_t(EngineState *s, const char *str, reg_t *dest, bool mayBeV
Console::Console(SciEngine *engine) : GUI::Debugger(),
_engine(engine), _debugState(engine->_debugState) {
+ assert(_engine);
+ assert(_engine->_gamestate);
+
// Variables
DVar_Register("sleeptime_factor", &g_debug_sleeptime_factor, DVAR_INT, 0);
DVar_Register("gc_interval", &engine->_gamestate->scriptGCInterval, DVAR_INT, 0);
@@ -3359,20 +3362,22 @@ bool Console::cmdSfx01Track(int argc, const char **argv) {
bool Console::cmdQuit(int argc, const char **argv) {
if (argc != 2) {
- DebugPrintf("%s game - exit gracefully\n", argv[0]);
- DebugPrintf("%s now - exit ungracefully\n", argv[0]);
- return true;
}
- if (!scumm_stricmp(argv[1], "game")) {
+ if (argc == 2 && !scumm_stricmp(argv[1], "now")) {
+ // Quit ungracefully
+ g_system->quit();
+ } else if (argc == 1 || (argc == 2 && !scumm_stricmp(argv[1], "game"))) {
+
// Quit gracefully
_engine->_gamestate->abortScriptProcessing = kAbortQuitGame; // Terminate VM
_debugState.seeking = kDebugSeekNothing;
_debugState.runningStep = 0;
- } else if (!scumm_stricmp(argv[1], "now")) {
- // Quit ungracefully
- exit(0);
+ } else {
+ DebugPrintf("%s [game] - exit gracefully\n", argv[0]);
+ DebugPrintf("%s now - exit ungracefully\n", argv[0]);
+ return true;
}
return Cmd_Exit(0, 0);
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index 61e6cc9d09..100b71efa7 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -748,7 +748,7 @@ Common::Error SciEngine::loadGameState(int slot) {
}
}
-Common::Error SciEngine::saveGameState(int slot, const char *desc) {
+Common::Error SciEngine::saveGameState(int slot, const Common::String &desc) {
Common::String fileName = Common::String::format("%s.%03d", _targetName.c_str(), slot);
Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager();
Common::OutSaveFile *out = saveFileMan->openForSaving(fileName);
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index 39e15aa84e..ee88d8af15 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -463,7 +463,7 @@ static int findSavegame(Common::Array<SavegameDesc> &saves, int16 savegameId) {
// The scripts get IDs ranging from 100->199, because the scripts require us to assign unique ids THAT EVEN STAY BETWEEN
// SAVES and the scripts also use "saves-count + 1" to create a new savedgame slot.
// SCI1.1 actually recycles ids, in that case we will currently get "0".
-// This behaviour is required especially for LSL6. In this game, it's possible to quick save. The scripts will use
+// This behavior is required especially for LSL6. In this game, it's possible to quick save. The scripts will use
// the last-used id for that feature. If we don't assign sticky ids, the feature will overwrite different saves all the
// time. And sadly we can't just use the actual filename ids directly, because of the creation method for new slots.
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 75f8c25ed2..6c96266922 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -360,10 +360,29 @@ reg_t kTextSize(EngineState *s, int argc, reg_t *argv) {
} else
#endif
g_sci->_gfxText16->kernelTextSize(g_sci->strSplit(text.c_str(), sep).c_str(), font_nr, maxwidth, &textWidth, &textHeight);
-
+
+ // One of the game texts in LB2 German contains loads of spaces in
+ // its end. We trim the text here, otherwise the graphics code will
+ // attempt to draw a very large window (larger than the screen) to
+ // show the text, and crash.
+ // Fixes bug #3306417.
+ if (textWidth >= g_sci->_gfxScreen->getDisplayWidth() ||
+ textHeight >= g_sci->_gfxScreen->getDisplayHeight()) {
+ // TODO: Is this needed for SCI32 as well?
+ if (g_sci->_gfxText16) {
+ warning("kTextSize: string would be too big to fit on screen. Trimming it");
+ text.trim();
+ // Copy over the trimmed string...
+ s->_segMan->strcpy(argv[1], text.c_str());
+ // ...and recalculate bounding box dimensions
+ g_sci->_gfxText16->kernelTextSize(g_sci->strSplit(text.c_str(), sep).c_str(), font_nr, maxwidth, &textWidth, &textHeight);
+ }
+ }
+
debugC(kDebugLevelStrings, "GetTextSize '%s' -> %dx%d", text.c_str(), textWidth, textHeight);
dest[2] = make_reg(0, textHeight);
dest[3] = make_reg(0, textWidth);
+
return s->r_acc;
}
diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp
index 0a4e2380a8..8904a48978 100644
--- a/engines/sci/engine/kpathing.cpp
+++ b/engines/sci/engine/kpathing.cpp
@@ -34,6 +34,8 @@
namespace Sci {
+// TODO: Code cleanup
+
#define AVOIDPATH_DYNMEM_STRING "AvoidPath polyline"
#define POLY_LAST_POINT 0x7777
@@ -1174,7 +1176,6 @@ static void change_polygons_opt_0(PathfindingState *s) {
static PathfindingState *convert_polygon_set(EngineState *s, reg_t poly_list, Common::Point start, Common::Point end, int width, int height, int opt) {
SegManager *segMan = s->_segMan;
Polygon *polygon;
- int err;
int count = 0;
PathfindingState *pf_s = new PathfindingState(width, height);
@@ -1197,50 +1198,53 @@ static PathfindingState *convert_polygon_set(EngineState *s, reg_t poly_list, Co
}
}
- if (opt == 0) {
- Common::Point intersection;
-
- // Keyboard support
- // FIXME: We don't need to dijkstra for keyboard support as we currently do
+ if (opt == 0)
change_polygons_opt_0(pf_s);
- // Find nearest intersection
- err = nearest_intersection(pf_s, start, end, &intersection);
-
- if (err == PF_FATAL) {
- warning("AvoidPath: fatal error finding nearest intersection");
- delete pf_s;
- return NULL;
- }
-
- if (err == PF_OK) {
- // Intersection was found, prepend original start position after pathfinding
- pf_s->_prependPoint = new Common::Point(start);
- // Merge new start point into polygon set
- pf_s->vertex_start = merge_point(pf_s, intersection);
- } else {
- // Otherwise we proceed with the original start point
- pf_s->vertex_start = merge_point(pf_s, start);
- }
- // Merge end point into polygon set
- pf_s->vertex_end = merge_point(pf_s, end);
- } else {
- Common::Point *new_start = fixup_start_point(pf_s, start);
+ Common::Point *new_start = fixup_start_point(pf_s, start);
+
+ if (!new_start) {
+ warning("AvoidPath: Couldn't fixup start position for pathfinding");
+ delete pf_s;
+ return NULL;
+ }
- if (!new_start) {
- warning("AvoidPath: Couldn't fixup start position for pathfinding");
- delete pf_s;
- return NULL;
- }
+ Common::Point *new_end = fixup_end_point(pf_s, end);
+
+ if (!new_end) {
+ warning("AvoidPath: Couldn't fixup end position for pathfinding");
+ delete new_start;
+ delete pf_s;
+ return NULL;
+ }
- Common::Point *new_end = fixup_end_point(pf_s, end);
+ if (opt == 0) {
+ // Keyboard support. Only the first edge of the path we compute
+ // here matches the path returned by SSCI. This is assumed to be
+ // sufficient as all known use cases only use the first two
+ // vertices of the returned path.
+ // Pharkas uses this mode for a secondary polygon set containing
+ // rectangular polygons used to block an actor's path.
+
+ // If we have a prepended point, we do nothing here as the
+ // actor is in barred territory and should be moved outside of
+ // it ASAP. This matches the behavior of SSCI.
+ if (!pf_s->_prependPoint) {
+ // Actor position is OK, find nearest obstacle.
+ int err = nearest_intersection(pf_s, start, *new_end, new_start);
+
+ if (err == PF_FATAL) {
+ warning("AvoidPath: error finding nearest intersection");
+ delete new_start;
+ delete new_end;
+ delete pf_s;
+ return NULL;
+ }
- if (!new_end) {
- warning("AvoidPath: Couldn't fixup end position for pathfinding");
- delete pf_s;
- return NULL;
+ if (err == PF_OK)
+ pf_s->_prependPoint = new Common::Point(start);
}
-
+ } else {
// WORKAROUND LSL5 room 660. Priority glitch due to us choosing a different path
// than SSCI. Happens when Patti walks to the control room.
if (g_sci->getGameId() == GID_LSL5 && (s->currentRoomNumber() == 660) && (Common::Point(67, 131) == *new_start) && (Common::Point(229, 101) == *new_end)) {
@@ -1248,14 +1252,14 @@ static PathfindingState *convert_polygon_set(EngineState *s, reg_t poly_list, Co
pf_s->_prependPoint = new_start;
new_start = new Common::Point(77, 107);
}
+ }
- // Merge start and end points into polygon set
- pf_s->vertex_start = merge_point(pf_s, *new_start);
- pf_s->vertex_end = merge_point(pf_s, *new_end);
+ // Merge start and end points into polygon set
+ pf_s->vertex_start = merge_point(pf_s, *new_start);
+ pf_s->vertex_end = merge_point(pf_s, *new_end);
- delete new_start;
- delete new_end;
- }
+ delete new_start;
+ delete new_end;
// Allocate and build vertex index
pf_s->vertex_index = (Vertex**)malloc(sizeof(Vertex *) * (count + 2));
diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp
index b48de1c7ea..d83254b2c4 100644
--- a/engines/sci/engine/kscripts.cpp
+++ b/engines/sci/engine/kscripts.cpp
@@ -46,7 +46,7 @@ reg_t kLoad(EngineState *s, int argc, reg_t *argv) {
}
// Unloads an arbitrary resource of type 'restype' with resource numbber 'resnr'
-// behaviour of this call didn't change between sci0->sci1.1 parameter wise, which means getting called with
+// behavior of this call didn't change between sci0->sci1.1 parameter wise, which means getting called with
// 1 or 3+ parameters is not right according to sierra sci
reg_t kUnLoad(EngineState *s, int argc, reg_t *argv) {
if (argc >= 2) {
@@ -192,7 +192,7 @@ reg_t kDisposeClone(EngineState *s, int argc, reg_t *argv) {
}
// SCI uses this technique to find out, if it's a clone and if it's supposed to get freed
- // At least kq4early relies on this behaviour. The scripts clone "Sound", then set bit 1 manually
+ // At least kq4early relies on this behavior. The scripts clone "Sound", then set bit 1 manually
// and call kDisposeClone later. In that case we may not free it, otherwise we will run into issues
// later, because kIsObject would then return false and Sound object wouldn't get checked.
uint16 infoSelector = object->getInfoSelector().offset;
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index c3f2b4dee2..c3c10bd2a2 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -66,8 +66,9 @@ reg_t kStrCpy(EngineState *s, int argc, reg_t *argv) {
s->_segMan->strncpy(argv[0], argv[1], length);
else
s->_segMan->memcpy(argv[0], argv[1], -length);
- } else
+ } else {
s->_segMan->strcpy(argv[0], argv[1]);
+ }
return argv[0];
}
diff --git a/engines/sci/engine/object.cpp b/engines/sci/engine/object.cpp
index aee93ffaa7..f09f18298a 100644
--- a/engines/sci/engine/object.cpp
+++ b/engines/sci/engine/object.cpp
@@ -58,14 +58,14 @@ void Object::init(byte *buf, reg_t obj_pos, bool initVariables) {
if (getSciVersion() <= SCI_VERSION_1_LATE) {
_variables.resize(READ_LE_UINT16(data + kOffsetSelectorCounter));
- _baseVars = (uint16 *)(_baseObj + _variables.size() * 2);
+ _baseVars = (const uint16 *)(_baseObj + _variables.size() * 2);
_methodCount = READ_LE_UINT16(data + READ_LE_UINT16(data + kOffsetFunctionArea) - 2);
for (int i = 0; i < _methodCount * 2 + 2; ++i) {
_baseMethod.push_back(READ_SCI11ENDIAN_UINT16(data + READ_LE_UINT16(data + kOffsetFunctionArea) + i * 2));
}
} else if (getSciVersion() >= SCI_VERSION_1_1 && getSciVersion() <= SCI_VERSION_2_1) {
_variables.resize(READ_SCI11ENDIAN_UINT16(data + 2));
- _baseVars = (uint16 *)(buf + READ_SCI11ENDIAN_UINT16(data + 4));
+ _baseVars = (const uint16 *)(buf + READ_SCI11ENDIAN_UINT16(data + 4));
_methodCount = READ_SCI11ENDIAN_UINT16(buf + READ_SCI11ENDIAN_UINT16(data + 6));
for (int i = 0; i < _methodCount * 2 + 3; ++i) {
_baseMethod.push_back(READ_SCI11ENDIAN_UINT16(buf + READ_SCI11ENDIAN_UINT16(data + 6) + i * 2));
diff --git a/engines/sci/engine/object.h b/engines/sci/engine/object.h
index 7e07fb2f6d..80c8e9e83d 100644
--- a/engines/sci/engine/object.h
+++ b/engines/sci/engine/object.h
@@ -236,7 +236,7 @@ private:
void initSelectorsSci3(const byte *buf);
const byte *_baseObj; /**< base + object offset within base */
- uint16 *_baseVars; /**< Pointer to the varselector area for this object */
+ const uint16 *_baseVars; /**< Pointer to the varselector area for this object */
Common::Array<uint16> _baseMethod; /**< Pointer to the method selector area for this object */
uint16 *_propertyOffsetsSci3; /**< This is used to enable relocation of property valuesa in SCI3 */
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 65b5e602ff..e43c7097ed 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -805,7 +805,7 @@ void SegManager::reconstructClones() {
#pragma mark -
-bool gamestate_save(EngineState *s, Common::WriteStream *fh, const char* savename, const char *version) {
+bool gamestate_save(EngineState *s, Common::WriteStream *fh, const Common::String &savename, const Common::String &version) {
TimeDate curTime;
g_system->getTimeAndDate(curTime);
diff --git a/engines/sci/engine/savegame.h b/engines/sci/engine/savegame.h
index ff5bc5204b..fbd77eb076 100644
--- a/engines/sci/engine/savegame.h
+++ b/engines/sci/engine/savegame.h
@@ -79,7 +79,7 @@ struct SavegameMetadata {
* @param savename The description of the savegame
* @return 0 on success, 1 otherwise
*/
-bool gamestate_save(EngineState *s, Common::WriteStream *save, const char *savename, const char *version);
+bool gamestate_save(EngineState *s, Common::WriteStream *save, const Common::String &savename, const Common::String &version);
/**
* Restores a game state from a directory.
diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp
index eae2dd674c..a38aa06bc4 100644
--- a/engines/sci/engine/script.cpp
+++ b/engines/sci/engine/script.cpp
@@ -492,7 +492,7 @@ SegmentRef Script::dereference(reg_t pointer) {
return ret;
}
-void Script::initialiseLocals(SegManager *segMan) {
+void Script::initializeLocals(SegManager *segMan) {
LocalVariables *locals = segMan->allocLocalsSegment(this);
if (locals) {
if (getSciVersion() > SCI_VERSION_0_EARLY) {
@@ -508,7 +508,7 @@ void Script::initialiseLocals(SegManager *segMan) {
}
}
-void Script::initialiseClasses(SegManager *segMan) {
+void Script::initializeClasses(SegManager *segMan) {
const byte *seeker = 0;
uint16 mult = 0;
@@ -580,7 +580,7 @@ void Script::initialiseClasses(SegManager *segMan) {
}
}
-void Script::initialiseObjectsSci0(SegManager *segMan, SegmentId segmentId) {
+void Script::initializeObjectsSci0(SegManager *segMan, SegmentId segmentId) {
bool oldScriptHeader = (getSciVersion() == SCI_VERSION_0_EARLY);
// We need to make two passes, as the objects in the script might be in the
@@ -632,7 +632,7 @@ void Script::initialiseObjectsSci0(SegManager *segMan, SegmentId segmentId) {
relocateSci0Sci21(make_reg(segmentId, relocationBlock - getBuf() + 4));
}
-void Script::initialiseObjectsSci11(SegManager *segMan, SegmentId segmentId) {
+void Script::initializeObjectsSci11(SegManager *segMan, SegmentId segmentId) {
const byte *seeker = _heapStart + 4 + READ_SCI11ENDIAN_UINT16(_heapStart + 2) * 2;
while (READ_SCI11ENDIAN_UINT16(seeker) == SCRIPT_OBJECT_MAGIC_NUMBER) {
@@ -667,7 +667,7 @@ void Script::initialiseObjectsSci11(SegManager *segMan, SegmentId segmentId) {
relocateSci0Sci21(make_reg(segmentId, READ_SCI11ENDIAN_UINT16(_heapStart)));
}
-void Script::initialiseObjectsSci3(SegManager *segMan, SegmentId segmentId) {
+void Script::initializeObjectsSci3(SegManager *segMan, SegmentId segmentId) {
const byte *seeker = getSci3ObjectsPointer();
while (READ_SCI11ENDIAN_UINT16(seeker) == SCRIPT_OBJECT_MAGIC_NUMBER) {
@@ -681,13 +681,13 @@ void Script::initialiseObjectsSci3(SegManager *segMan, SegmentId segmentId) {
relocateSci3(make_reg(segmentId, 0));
}
-void Script::initialiseObjects(SegManager *segMan, SegmentId segmentId) {
+void Script::initializeObjects(SegManager *segMan, SegmentId segmentId) {
if (getSciVersion() <= SCI_VERSION_1_LATE)
- initialiseObjectsSci0(segMan, segmentId);
+ initializeObjectsSci0(segMan, segmentId);
else if (getSciVersion() >= SCI_VERSION_1_1 && getSciVersion() <= SCI_VERSION_2_1)
- initialiseObjectsSci11(segMan, segmentId);
+ initializeObjectsSci11(segMan, segmentId);
else if (getSciVersion() == SCI_VERSION_3)
- initialiseObjectsSci3(segMan, segmentId);
+ initializeObjectsSci3(segMan, segmentId);
}
reg_t Script::findCanonicAddress(SegManager *segMan, reg_t addr) const {
diff --git a/engines/sci/engine/script.h b/engines/sci/engine/script.h
index 13744b6f93..ff061e0e36 100644
--- a/engines/sci/engine/script.h
+++ b/engines/sci/engine/script.h
@@ -137,20 +137,20 @@ public:
* Initializes the script's local variables
* @param segMan A reference to the segment manager
*/
- void initialiseLocals(SegManager *segMan);
+ void initializeLocals(SegManager *segMan);
/**
* Adds the script's classes to the segment manager's class table
* @param segMan A reference to the segment manager
*/
- void initialiseClasses(SegManager *segMan);
+ void initializeClasses(SegManager *segMan);
/**
* Initializes the script's objects (SCI0)
* @param segMan A reference to the segment manager
* @param segmentId The script's segment id
*/
- void initialiseObjects(SegManager *segMan, SegmentId segmentId);
+ void initializeObjects(SegManager *segMan, SegmentId segmentId);
// script lock operations
@@ -280,21 +280,21 @@ private:
* @param segMan A reference to the segment manager
* @param segmentId The script's segment id
*/
- void initialiseObjectsSci0(SegManager *segMan, SegmentId segmentId);
+ void initializeObjectsSci0(SegManager *segMan, SegmentId segmentId);
/**
* Initializes the script's objects (SCI1.1 - SCI2.1)
* @param segMan A reference to the segment manager
* @param segmentId The script's segment id
*/
- void initialiseObjectsSci11(SegManager *segMan, SegmentId segmentId);
+ void initializeObjectsSci11(SegManager *segMan, SegmentId segmentId);
/**
* Initializes the script's objects (SCI3)
* @param segMan A reference to the segment manager
* @param segmentId The script's segment id
*/
- void initialiseObjectsSci3(SegManager *segMan, SegmentId segmentId);
+ void initializeObjectsSci3(SegManager *segMan, SegmentId segmentId);
};
} // End of namespace Sci
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp
index b28e8cd450..ab67da32db 100644
--- a/engines/sci/engine/seg_manager.cpp
+++ b/engines/sci/engine/seg_manager.cpp
@@ -1007,9 +1007,9 @@ int SegManager::instantiateScript(int scriptNum) {
scr->init(scriptNum, _resMan);
scr->load(_resMan);
- scr->initialiseLocals(this);
- scr->initialiseClasses(this);
- scr->initialiseObjects(this, segmentId);
+ scr->initializeLocals(this);
+ scr->initializeClasses(this);
+ scr->initializeObjects(this, segmentId);
return segmentId;
}
@@ -1020,7 +1020,7 @@ void SegManager::uninstantiateScript(int script_nr) {
if (!scr || scr->isMarkedAsDeleted()) { // Is it already unloaded?
//warning("unloading script 0x%x requested although not loaded", script_nr);
- // This is perfectly valid SCI behaviour
+ // This is perfectly valid SCI behavior
return;
}
diff --git a/engines/sci/engine/seg_manager.h b/engines/sci/engine/seg_manager.h
index a579ba10e1..ab5aeacabf 100644
--- a/engines/sci/engine/seg_manager.h
+++ b/engines/sci/engine/seg_manager.h
@@ -71,7 +71,7 @@ public:
*/
Script *allocateScript(int script_nr, SegmentId *seg_id);
- // The script must then be initialised; see section (1b.), below.
+ // The script must then be initialized; see section (1b.), below.
/**
* Forcefully deallocate a previously allocated script.
diff --git a/engines/sci/engine/segment.h b/engines/sci/engine/segment.h
index f5c5e2289d..009a2558ce 100644
--- a/engines/sci/engine/segment.h
+++ b/engines/sci/engine/segment.h
@@ -131,7 +131,7 @@ public:
/**
* Iterates over all references reachable from the specified object.
* Used by the garbage collector.
- * @param object object (within the current segment) to analyse
+ * @param object object (within the current segment) to analyze
* @return a list of outgoing references within the object
*
* @note This function may also choose to report numbers (segment 0) as adresses
diff --git a/engines/sci/engine/selector.h b/engines/sci/engine/selector.h
index dae1ea9266..f13c13e00c 100644
--- a/engines/sci/engine/selector.h
+++ b/engines/sci/engine/selector.h
@@ -44,7 +44,7 @@ struct SelectorCache {
Selector underBits; ///< Used by the graphics subroutines to store backupped BG pic data
Selector nsTop, nsLeft, nsBottom, nsRight; ///< View boundaries ('now seen')
Selector lsTop, lsLeft, lsBottom, lsRight; ///< Used by Animate() subfunctions and scroll list controls
- Selector signal; ///< Used by Animate() to control a view's behaviour
+ Selector signal; ///< Used by Animate() to control a view's behavior
Selector illegalBits; ///< Used by CanBeHere
Selector brTop, brLeft, brBottom, brRight; ///< Bounding Rectangle
// name, key, time
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index aba2e66eff..fa25b02a8f 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -213,6 +213,7 @@ const SciWorkaroundEntry kDisplay_workarounds[] = {
{ GID_QFG3, -1, 47, 0, "barterWin", "open", 0x1426, 0, { WORKAROUND_IGNORE, 0 } }, // sometimes when talking with a vendor that can be bartered with, the wrong local variable is checked and the variable contents are wrong - bug #3292251
{ GID_QFG3, -1, 47, 0, "barterIcon", "show", 0x135c, 0, { WORKAROUND_IGNORE, 0 } }, // sometimes when talking with a vendor that can be bartered with, the wrong local variable is checked and the variable contents are wrong - bug #3292251
{ GID_SQ1, -1, 700, 0, "arcadaRegion", "doit", -1, 0, { WORKAROUND_IGNORE, 0 } }, // restoring in some rooms of the arcada (right at the start)
+ { GID_SQ1, 44, 44, 0, "spinDone", "changeState",0x13b0, 0, { WORKAROUND_IGNORE, 0 } }, // restoring a game at the slot machine in Ulence Flats (bug #3308087)
{ GID_SQ4, 397, 0, 0, "", "export 12", -1, 0, { WORKAROUND_IGNORE, 0 } }, // FLOPPY: when going into the computer store (bug #3044044)
{ GID_SQ4, 391, 391, 0, "doCatalog", "mode", 0x84, 0, { WORKAROUND_IGNORE, 0 } }, // CD: clicking on catalog in roboter sale - a parameter is an object
{ GID_SQ4, 391, 391, 0, "choosePlug", "changeState", -1, 0, { WORKAROUND_IGNORE, 0 } }, // CD: ordering connector in roboter sale - a parameter is an object
diff --git a/engines/sci/event.cpp b/engines/sci/event.cpp
index b015a6df7f..74879f6c63 100644
--- a/engines/sci/event.cpp
+++ b/engines/sci/event.cpp
@@ -250,7 +250,7 @@ SciEvent EventManager::getScummVMEvent() {
// When Ctrl AND Alt are pressed together with a regular key, Linux will give us control-key, Windows will give
// us the actual key. My opinion is that windows is right, because under DOS the keys worked the same, anyway
// we support the other case as well
- if ((modifiers & Common::KBD_SHIFT) && input.character > 0 && input.character < 27)
+ if ((modifiers & Common::KBD_ALT) && input.character > 0 && input.character < 27)
input.character += 96; // 0x01 -> 'a'
if (getSciVersion() <= SCI_VERSION_1_MIDDLE) {
diff --git a/engines/sci/graphics/animate.cpp b/engines/sci/graphics/animate.cpp
index f72f9a78cc..c36ecd112a 100644
--- a/engines/sci/graphics/animate.cpp
+++ b/engines/sci/graphics/animate.cpp
@@ -230,7 +230,7 @@ void GfxAnimate::adjustInvalidCels(GfxView *view, AnimateList::iterator it) {
// this seems to be completely crazy code
// sierra sci checked signed int16 to be above or equal the counts and reseted to 0 in those cases
// later during view processing those are compared unsigned again and then set to maximum count - 1
- // Games rely on this behaviour. For example laura bow 1 has a knight standing around in room 37
+ // Games rely on this behavior. For example laura bow 1 has a knight standing around in room 37
// which has cel set to 3. This cel does not exist and the actual knight is 0
// In kq5 on the other hand during the intro, when the trunk is opened, cel is set to some real
// high number, which is negative when considered signed. This actually requires to get fixed to
diff --git a/engines/sci/graphics/cursor.cpp b/engines/sci/graphics/cursor.cpp
index 6ad2cb3cb3..ec49a38814 100644
--- a/engines/sci/graphics/cursor.cpp
+++ b/engines/sci/graphics/cursor.cpp
@@ -252,10 +252,10 @@ void GfxCursor::setPosition(Common::Point pos) {
// Some games display a new menu, set mouse position somewhere within and
// expect it to be in there. This is fine for a real mouse, but on wii using
// wii-mote or touch interfaces this won't work. In fact on those platforms
- // the menus will close immediately because of that behaviour.
+ // the menus will close immediately because of that behavior.
// We identify those cases and set a reaction-rect. If the mouse it outside
// of that rect, we won't report the position back to the scripts.
- // As soon as the mouse was inside once, we will revert to normal behaviour
+ // As soon as the mouse was inside once, we will revert to normal behavior
// Currently this code is enabled for all platforms, especially because we can't
// differentiate between e.g. Windows used via mouse and Windows used via touchscreen
// The workaround won't hurt real-mouse platforms
diff --git a/engines/sci/graphics/text16.cpp b/engines/sci/graphics/text16.cpp
index 459be7fcf7..c2f71a0e54 100644
--- a/engines/sci/graphics/text16.cpp
+++ b/engines/sci/graphics/text16.cpp
@@ -466,7 +466,7 @@ void GfxText16::Box(const char *text, bool show, const Common::Rect &rect, TextA
if (doubleByteMode) {
// Kanji is written by pc98 rom to screen directly. Because of
- // GetLongest() behaviour (not cutting off the last char, that causes a
+ // GetLongest() behavior (not cutting off the last char, that causes a
// new line), results in the script thinking that the text would need
// less space. The coordinate adjustment in fontsjis.cpp handles the
// incorrect centering because of that and this code actually shows all
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index cf46d41382..cc9042ceb7 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -213,8 +213,6 @@ Common::Error SciEngine::run() {
_gfxScreen = new GfxScreen(_resMan);
_gfxScreen->enableUndithering(ConfMan.getBool("disable_dithering"));
- // Create debugger console. It requires GFX to be initialized
- _console = new Console(this);
_kernel = new Kernel(_resMan, segMan);
_features = new GameFeatures(segMan, _kernel);
@@ -227,6 +225,9 @@ Common::Error SciEngine::run() {
_gamestate = new EngineState(segMan);
_eventMan = new EventManager(_resMan->detectFontExtended());
+ // Create debugger console. It requires GFX and _gamestate to be initialized
+ _console = new Console(this);
+
// The game needs to be initialized before the graphics system is initialized, as
// the graphics code checks parts of the seg manager upon initialization (e.g. for
// the presence of the fastCast object)
diff --git a/engines/sci/sci.h b/engines/sci/sci.h
index a340447354..77718e4b37 100644
--- a/engines/sci/sci.h
+++ b/engines/sci/sci.h
@@ -221,7 +221,7 @@ public:
virtual GUI::Debugger *getDebugger();
Console *getSciDebugger();
Common::Error loadGameState(int slot);
- Common::Error saveGameState(int slot, const char *desc);
+ Common::Error saveGameState(int slot, const Common::String &desc);
bool canLoadGameStateCurrently();
bool canSaveGameStateCurrently();
void syncSoundSettings();