Skip to content

Commit

Permalink
FREESCAPE: read strings in dark relese for amiga
Browse files Browse the repository at this point in the history
  • Loading branch information
neuromancer committed Aug 16, 2023
1 parent 35ff362 commit 2638372
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
3 changes: 2 additions & 1 deletion engines/freescape/freescape.h
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ class FreescapeEngine : public Engine {
Common::StringArray _messagesList;

void loadMessagesFixedSize(Common::SeekableReadStream *file, int offset, int size, int number);
void loadMessagesVariableSize(Common::SeekableReadStream *file, int offset, int number);
virtual void loadMessagesVariableSize(Common::SeekableReadStream *file, int offset, int number);

void loadFonts(Common::SeekableReadStream *file, int offset);
void loadFonts(byte *font, int charNumber);
Expand Down Expand Up @@ -563,6 +563,7 @@ class DarkEngine : public FreescapeEngine {
void loadAssetsAmigaFullGame() override;

void loadAssetsZXDemo() override;
void loadMessagesVariableSize(Common::SeekableReadStream *file, int offset, int number) override;

int _lastTenSeconds;
int _lastSecond;
Expand Down
1 change: 1 addition & 0 deletions engines/freescape/games/dark/amiga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ void DarkEngine::loadAssetsAmigaFullGame() {
_border = loadAndConvertNeoImage(stream, 0x1b762);
load8bitBinary(stream, 0x2e96a, 16);
loadPalettes(stream, 0x2e638);
loadMessagesVariableSize(stream, 0x3d37, 66);
}

void DarkEngine::drawAmigaAtariSTUI(Graphics::Surface *surface) {
Expand Down
18 changes: 18 additions & 0 deletions engines/freescape/games/dark/dark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,24 @@ void DarkEngine::drawInfoMenu() {
delete surface;
}

void DarkEngine::loadMessagesVariableSize(Common::SeekableReadStream *file, int offset, int number) {
file->seek(offset);
debugC(1, kFreescapeDebugParser, "String table:");

for (int i = 0; i < number; i++) {
Common::String message = "";
while (true) {
byte c = file->readByte();
if (c <= 21)
break;
message = message + c;
}

_messagesList.push_back(message);
debugC(1, kFreescapeDebugParser, "'%s'", _messagesList[i].c_str());
}
}

Common::Error DarkEngine::saveGameStreamExtended(Common::WriteStream *stream, bool isAutosave) {
for (auto &it : _areaMap) {
stream->writeUint16LE(it._key);
Expand Down
2 changes: 1 addition & 1 deletion engines/freescape/loaders/8bitBinaryLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ void FreescapeEngine::loadMessagesVariableSize(Common::SeekableReadStream *file,
}

_messagesList.push_back(message);
debugC(1, kFreescapeDebugParser, "%s", _messagesList[i].c_str());
debugC(1, kFreescapeDebugParser, "'%s'", _messagesList[i].c_str());
}
}

Expand Down

0 comments on commit 2638372

Please sign in to comment.