aboutsummaryrefslogtreecommitdiff
path: root/engines/tsage
diff options
context:
space:
mode:
Diffstat (limited to 'engines/tsage')
-rw-r--r--engines/tsage/resources.cpp11
-rw-r--r--engines/tsage/ringworld_logic.cpp15
-rw-r--r--engines/tsage/ringworld_scenes1.cpp2
3 files changed, 23 insertions, 5 deletions
diff --git a/engines/tsage/resources.cpp b/engines/tsage/resources.cpp
index d24c564a1f..e6a561f3a7 100644
--- a/engines/tsage/resources.cpp
+++ b/engines/tsage/resources.cpp
@@ -237,8 +237,13 @@ byte *TLib::getResource(uint16 id, bool suppressErrors) {
uint16 ctrCurrent = 0x102, ctrMax = 0x200;
uint16 word_48050 = 0, currentToken = 0, word_48054 =0;
byte byte_49068 = 0, byte_49069 = 0;
- DecodeReference table[0x1000];
- for (int i = 0; i < 0x1000; ++i) {
+
+ const uint tableSize = 0x1000;
+ DecodeReference *table = (DecodeReference *)malloc(tableSize * sizeof(DecodeReference));
+ if (!table)
+ error("[TLib::getResource] Cannot allocate table buffer");
+
+ for (int i = 0; i < tableSize; ++i) {
table[i].vByte = table[i].vWord = 0;
}
Common::Stack<uint16> tokenList;
@@ -302,6 +307,8 @@ byte *TLib::getResource(uint16 id, bool suppressErrors) {
}
}
+ free(table);
+
assert(bytesWritten == re->uncompressedSize);
delete compStream;
return dataOut;
diff --git a/engines/tsage/ringworld_logic.cpp b/engines/tsage/ringworld_logic.cpp
index 1dd905b3b6..58501172af 100644
--- a/engines/tsage/ringworld_logic.cpp
+++ b/engines/tsage/ringworld_logic.cpp
@@ -1333,9 +1333,20 @@ void RingworldGame::start() {
RING_INVENTORY._scanner._sceneNumber = 1;
RING_INVENTORY._ring._sceneNumber = 1;
+ int slot = -1;
+
+ if (ConfMan.hasKey("save_slot")) {
+ slot = ConfMan.getInt("save_slot");
+ Common::String file = _vm->generateSaveName(slot);
+ Common::InSaveFile *in = _vm->_system->getSavefileManager()->openForLoading(file);
+ if (in)
+ delete in;
+ else
+ slot = -1;
+ }
- if (ConfMan.hasKey("save_slot"))
- _globals->_sceneHandler._loadGameSlot = ConfMan.getInt("save_slot");
+ if (slot >= 0)
+ _globals->_sceneHandler._loadGameSlot = slot;
else
// Switch to the title screen
_globals->_sceneManager.setNewScene(1000);
diff --git a/engines/tsage/ringworld_scenes1.cpp b/engines/tsage/ringworld_scenes1.cpp
index 29b7c9b997..7fe2610fd7 100644
--- a/engines/tsage/ringworld_scenes1.cpp
+++ b/engines/tsage/ringworld_scenes1.cpp
@@ -342,7 +342,7 @@ void Scene20::Action2::signal() {
}
case 8:
scene->_sound.release();
- scene->_sound.fadeOut(this);
+ _globals->_soundHandler.fadeOut(this);
break;
case 9:
SceneItem::display(0, 0, LIST_END);