diff options
-rw-r--r-- | engines/teenagent/detection.cpp | 3 | ||||
-rw-r--r-- | engines/teenagent/resources.h | 11 | ||||
-rw-r--r-- | engines/teenagent/teenagent.cpp | 17 |
3 files changed, 21 insertions, 10 deletions
diff --git a/engines/teenagent/detection.cpp b/engines/teenagent/detection.cpp index 2de6f49c44..0c1268a5fc 100644 --- a/engines/teenagent/detection.cpp +++ b/engines/teenagent/detection.cpp @@ -26,6 +26,7 @@ #include "base/plugins.h" #include "engines/advancedDetector.h" +#include "teenagent/resources.h" #include "teenagent/teenagent.h" #include "graphics/thumbnail.h" @@ -168,7 +169,7 @@ public: Common::String desc = buf; - in->seek(0x777a); + in->seek(TeenAgent::saveStateSize); if (!Graphics::checkThumbnailHeader(*in)) return SaveStateDescriptor(slot, desc); diff --git a/engines/teenagent/resources.h b/engines/teenagent/resources.h index 7426b45248..68d94f913c 100644 --- a/engines/teenagent/resources.h +++ b/engines/teenagent/resources.h @@ -49,8 +49,17 @@ const uint16 dsAddr_rejectMsg = 0x339e; const uint16 dsAddr_saveState = 0x6478; const uint16 saveStateSize = 0x777a; +// Save Description String (24 bytes) : 0x6478 to 0x648f + +// Ego (Mark) position in scene : 0x64af to 0x64b2 +const uint16 dsAddr_egoX = 0x64af; // 2 bytes +const uint16 dsAddr_egoY = 0x64b1; // 2 bytes + +// Current Scene Id : 0xb4f3 +const uint16 dsAddr_currentScene = 0xb4f3; // 1 byte + // Current Music Id Playing : 0xdb90 -const uint16 dsAddr_currentMusic = 0xdb90; +const uint16 dsAddr_currentMusic = 0xdb90; // 1 byte class Resources { public: diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp index 08c436bf25..3a68edd1fe 100644 --- a/engines/teenagent/teenagent.cpp +++ b/engines/teenagent/teenagent.cpp @@ -250,8 +250,8 @@ Common::Error TeenAgentEngine::loadGameState(int slot) { setMusic(res->dseg.get_byte(dsAddr_currentMusic)); - int id = res->dseg.get_byte(0xb4f3); - uint16 x = res->dseg.get_word(0x64af), y = res->dseg.get_word(0x64b1); + int id = res->dseg.get_byte(dsAddr_currentScene); + uint16 x = res->dseg.get_word(dsAddr_egoX), y = res->dseg.get_word(dsAddr_egoY); scene->loadObjectData(); scene->init(id, Common::Point(x, y)); scene->setPalette(4); @@ -265,13 +265,14 @@ Common::Error TeenAgentEngine::saveGameState(int slot, const Common::String &des if (!out) return Common::kWritingFailed; - res->dseg.set_byte(0xb4f3, scene->getId()); + res->dseg.set_byte(dsAddr_currentScene, scene->getId()); Common::Point pos = scene->getPosition(); - res->dseg.set_word(0x64af, pos.x); - res->dseg.set_word(0x64b1, pos.y); + res->dseg.set_word(dsAddr_egoX, pos.x); + res->dseg.set_word(dsAddr_egoY, pos.y); assert(res->dseg.size() >= dsAddr_saveState + saveStateSize); - strncpy((char *)res->dseg.ptr(dsAddr_saveState), desc.c_str(), 0x16); + // FIXME: Description string is 24 bytes and null based on detection.cpp code, not 22? + strncpy((char *)res->dseg.ptr(dsAddr_saveState), desc.c_str(), 22); out->write(res->dseg.ptr(dsAddr_saveState), saveStateSize); if (!Graphics::saveThumbnail(*out)) warning("saveThumbnail failed"); @@ -307,7 +308,7 @@ bool TeenAgentEngine::showCDLogo() { if (!cdlogo.exists("cdlogo.res") || !cdlogo.open("cdlogo.res")) return true; - const uint bgSize = 0xfa00; + const uint bgSize = 320 * 200; const uint paletteSize = 3 * 256; byte *bg = (byte *)malloc(bgSize); @@ -353,7 +354,7 @@ bool TeenAgentEngine::showLogo() { if (!frame) return true; - const uint bgSize = 0xfa00; + const uint bgSize = 320 * 200; const uint paletteSize = 3 * 256; byte *bg = (byte *)malloc(bgSize); |