aboutsummaryrefslogtreecommitdiff
path: root/saga
diff options
context:
space:
mode:
authorEugene Sandulenko2005-06-02 22:14:57 +0000
committerEugene Sandulenko2005-06-02 22:14:57 +0000
commit8a835899fb38ae5c79610d972ad858c90902a802 (patch)
tree2d0705feddc07783f34aea84c821289792a66083 /saga
parentae36a54c922aa6e953e0356720b9194901f88cbc (diff)
downloadscummvm-rg350-8a835899fb38ae5c79610d972ad858c90902a802.tar.gz
scummvm-rg350-8a835899fb38ae5c79610d972ad858c90902a802.tar.bz2
scummvm-rg350-8a835899fb38ae5c79610d972ad858c90902a802.zip
Implement game load with '-x' comman-line parameter.
Fix couple valgrind and compiler warnings. svn-id: r18313
Diffstat (limited to 'saga')
-rw-r--r--saga/interface.cpp1
-rw-r--r--saga/saga.cpp14
-rw-r--r--saga/saveload.cpp2
-rw-r--r--saga/scene.cpp6
-rw-r--r--saga/sprite.cpp6
5 files changed, 19 insertions, 10 deletions
diff --git a/saga/interface.cpp b/saga/interface.cpp
index d19776e5c5..1aeb5ce1f2 100644
--- a/saga/interface.cpp
+++ b/saga/interface.cpp
@@ -202,6 +202,7 @@ Interface::Interface(SagaEngine *vm) : _vm(vm), _initialized(false) {
}
_textInputRepeatPhase = 0;
+ _textInput = false;
_initialized = true;
}
diff --git a/saga/saga.cpp b/saga/saga.cpp
index 442645040a..168625dbd1 100644
--- a/saga/saga.cpp
+++ b/saga/saga.cpp
@@ -301,9 +301,19 @@ int SagaEngine::go() {
_previousTicks = _system->getMillis();
- // Begin Main Engine Loop
+ if (ConfMan.hasKey("save_slot")) {
+ // First scene sets up palette
+ _scene->changeScene(getStartSceneNumber(), 0, kTransitionNoFade);
+ _events->handleEvents(0); // Process immediate events
+
+ char *fileName;
+ fileName = calcSaveFileName(ConfMan.getInt("save_slot"));
+ load(fileName);
+ _interface->setMode(kPanelMain);
+ } else {
+ _scene->startScene();
+ }
- _scene->startScene();
uint32 currentTicks;
while (!_quit) {
diff --git a/saga/saveload.cpp b/saga/saveload.cpp
index f87bcf74d0..8a3e5befe4 100644
--- a/saga/saveload.cpp
+++ b/saga/saveload.cpp
@@ -136,7 +136,7 @@ void SagaEngine::fillSaveList() {
while (i < MAX_SAVES) {
if (_saveMarks[i]) {
name = calcSaveFileName(i);
- if (in = _saveFileMan->openForLoading(name)) {
+ if ((in = _saveFileMan->openForLoading(name)) != NULL) {
in->read(&header, sizeof(header));
if (header.type != MKID('SAGA')) {
diff --git a/saga/scene.cpp b/saga/scene.cpp
index dab5d998ae..20f02a958a 100644
--- a/saga/scene.cpp
+++ b/saga/scene.cpp
@@ -869,10 +869,8 @@ void Scene::draw() {
}
void Scene::endScene() {
-
- if (!_sceneLoaded) {
- error("Scene::endScene(): No scene to end");
- }
+ if (!_sceneLoaded)
+ return;
debug(0, "Ending scene...");
diff --git a/saga/sprite.cpp b/saga/sprite.cpp
index 96f0d1c455..255da47cca 100644
--- a/saga/sprite.cpp
+++ b/saga/sprite.cpp
@@ -402,11 +402,11 @@ void Sprite::decodeRLEBuffer(const byte *inputBuffer, size_t inLength, size_t ou
MemoryReadStream readS(inputBuffer, inLength);
- while (!readS.eos() && (outPointer < outPointerEnd)) {
+ while (!readS.eos() && (outPointer < outPointerEnd - 1)) {
bg_runcount = readS.readByte();
fg_runcount = readS.readByte();
- for (c = 0; c < bg_runcount; c++) {
+ for (c = 0; c < bg_runcount && !readS.eos(); c++) {
*outPointer = (byte) 0;
if (outPointer < outPointerEnd)
outPointer++;
@@ -414,7 +414,7 @@ void Sprite::decodeRLEBuffer(const byte *inputBuffer, size_t inLength, size_t ou
return;
}
- for (c = 0; c < fg_runcount; c++) {
+ for (c = 0; c < fg_runcount && !readS.eos(); c++) {
*outPointer = readS.readByte();
if (outPointer < outPointerEnd)
outPointer++;