DM: Add support for uncompressed dungeon.dat

This commit is contained in:
Bendegúz Nagy 2016-08-16 10:22:18 +02:00
parent b5eb075a66
commit 4f916a08d2
2 changed files with 9 additions and 12 deletions

View File

@ -6,12 +6,6 @@ Bugs:
Logic: Logic:
Items thrown on the right side end up on the left side Items thrown on the right side end up on the left side
Possible bugs:
- k1_LeftMouseButton and k2_RightMouseButton have values 1 and 2 respectively, contrary to the original in the original: MASK0x0001_MOUSE_RIGHT_BUTTON, MASK0x0002_MOUSE_LEFT_BUTTON
- possible garbage value return in f140_getObjectWeight
Todo: Todo:
Add wiki entry for DM Add wiki entry for DM
@ -20,8 +14,7 @@ Todo:
I forgot to add a bunch of warning for show/hide mouse pointer and other mouse functions I forgot to add a bunch of warning for show/hide mouse pointer and other mouse functions
Code stuff todo: Code stuff todo:
Complete stub methods(blitShrink, etc.) Complete stub methods(blitShrink, blitmask, scroller, etc.)
Add scroller
Save file f433_processCommand140_saveGame fails silently, add error checking Save file f433_processCommand140_saveGame fails silently, add error checking
Clean up f113_drawField Clean up f113_drawField

View File

@ -427,11 +427,11 @@ DungeonMan::~DungeonMan() {
void DungeonMan::f455_decompressDungeonFile() { void DungeonMan::f455_decompressDungeonFile() {
Common::File f; Common::File f;
f.open("Dungeon.dat"); f.open("Dungeon.dat");
if (f.readUint16BE() == 0x8104) { if (f.readUint16BE() == 0x8104) { // if dungeon is compressed
_rawDunFileDataSize = f.readUint32BE(); _rawDunFileDataSize = f.readUint32BE();
delete[] _rawDunFileData; delete[] _rawDunFileData;
_rawDunFileData = new byte[_rawDunFileDataSize]; _rawDunFileData = new byte[_rawDunFileDataSize];
f.readUint16BE(); f.readUint16BE(); // discard
byte common[4]; byte common[4];
for (uint16 i = 0; i < 4; ++i) for (uint16 i = 0; i < 4; ++i)
common[i] = f.readByte(); common[i] = f.readByte();
@ -475,8 +475,12 @@ void DungeonMan::f455_decompressDungeonFile() {
bitsUsedInWord += 10; bitsUsedInWord += 10;
} }
} }
} else { } else { // read uncompressed Dungeon.dat
warning(false, "TODO: if the dungeon is uncompressed, read it here"); f.seek(0);
_rawDunFileDataSize = f.size();
delete[] _rawDunFileData;
_rawDunFileData = new byte[_rawDunFileDataSize];
f.read(_rawDunFileData, _rawDunFileDataSize);
} }
f.close(); f.close();
} }