Implement game load with '-x' comman-line parameter.

Fix couple valgrind and compiler warnings.

svn-id: r18313
This commit is contained in:
Eugene Sandulenko 2005-06-02 22:14:57 +00:00
parent ae36a54c92
commit 8a835899fb
5 changed files with 19 additions and 10 deletions

View File

@ -202,6 +202,7 @@ Interface::Interface(SagaEngine *vm) : _vm(vm), _initialized(false) {
}
_textInputRepeatPhase = 0;
_textInput = false;
_initialized = true;
}

View File

@ -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) {

View File

@ -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')) {

View File

@ -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...");

View File

@ -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++;