aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorathrxx2019-02-09 02:28:57 +0100
committerathrxx2019-03-06 20:48:21 +0100
commit21712209c05605d4a75ef2e0f1f9b8bce3a547e7 (patch)
tree2896b8bcf66105af3586cad62385b653bf26610d /engines
parent490e41cfad44505a4f742db9092d9a960783da6c (diff)
downloadscummvm-rg350-21712209c05605d4a75ef2e0f1f9b8bce3a547e7.tar.gz
scummvm-rg350-21712209c05605d4a75ef2e0f1f9b8bce3a547e7.tar.bz2
scummvm-rg350-21712209c05605d4a75ef2e0f1f9b8bce3a547e7.zip
KYRA: (EOB1/Amiga) - fix level loading
Now it is at least possible to enter the game after creating a party. Graphics are still messed up.
Diffstat (limited to 'engines')
-rw-r--r--engines/kyra/engine/eob.cpp8
-rw-r--r--engines/kyra/engine/eobcommon.cpp1
-rw-r--r--engines/kyra/engine/eobcommon.h3
-rw-r--r--engines/kyra/engine/scene_eob.cpp38
-rw-r--r--engines/kyra/gui/gui_eob.cpp2
-rw-r--r--engines/kyra/resource/staticres_eob.cpp3
6 files changed, 33 insertions, 22 deletions
diff --git a/engines/kyra/engine/eob.cpp b/engines/kyra/engine/eob.cpp
index 25ab86d9ff..3a83643f19 100644
--- a/engines/kyra/engine/eob.cpp
+++ b/engines/kyra/engine/eob.cpp
@@ -374,9 +374,9 @@ void EoBEngine::loadDoorShapes(int doorType1, int shapeId1, int doorType2, int s
if (doorType1 != 0xFF) {
for (int i = 0; i < 3; i++) {
const uint8 *enc = &_doorShapeEncodeDefs[(doorType1 * 3 + i) << 2];
- _doorShapes[shapeId1 + i] = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3], false, (_flags.gameID == GI_EOB1) ? _cgaMappingLevel[_cgaLevelMappingIndex[_currentLevel - 1]] : 0);
+ _doorShapes[shapeId1 + i] = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3], false, (_flags.gameID == GI_EOB1 && _flags.platform == Common::kPlatformDOS) ? _cgaMappingLevel[_cgaLevelMappingIndex[_currentLevel - 1]] : 0);
enc = &_doorSwitchShapeEncodeDefs[(doorType1 * 3 + i) << 2];
- _doorSwitches[shapeId1 + i].shp = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3], false, (_flags.gameID == GI_EOB1) ? _cgaMappingLevel[_cgaLevelMappingIndex[_currentLevel - 1]] : 0);
+ _doorSwitches[shapeId1 + i].shp = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3], false, (_flags.gameID == GI_EOB1 && _flags.platform == Common::kPlatformDOS) ? _cgaMappingLevel[_cgaLevelMappingIndex[_currentLevel - 1]] : 0);
_doorSwitches[shapeId1 + i].x = _doorSwitchCoords[doorType1 * 6 + i * 2];
_doorSwitches[shapeId1 + i].y = _doorSwitchCoords[doorType1 * 6 + i * 2 + 1];
}
@@ -385,9 +385,9 @@ void EoBEngine::loadDoorShapes(int doorType1, int shapeId1, int doorType2, int s
if (doorType2 != 0xFF) {
for (int i = 0; i < 3; i++) {
const uint8 *enc = &_doorShapeEncodeDefs[(doorType2 * 3 + i) << 2];
- _doorShapes[shapeId2 + i] = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3], false, (_flags.gameID == GI_EOB1) ? _cgaMappingLevel[_cgaLevelMappingIndex[_currentLevel - 1]] : 0);
+ _doorShapes[shapeId2 + i] = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3], false, (_flags.gameID == GI_EOB1 && _flags.platform == Common::kPlatformDOS) ? _cgaMappingLevel[_cgaLevelMappingIndex[_currentLevel - 1]] : 0);
enc = &_doorSwitchShapeEncodeDefs[(doorType2 * 3 + i) << 2];
- _doorSwitches[shapeId2 + i].shp = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3], false, (_flags.gameID == GI_EOB1) ? _cgaMappingLevel[_cgaLevelMappingIndex[_currentLevel - 1]] : 0);
+ _doorSwitches[shapeId2 + i].shp = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3], false, (_flags.gameID == GI_EOB1 && _flags.platform == Common::kPlatformDOS) ? _cgaMappingLevel[_cgaLevelMappingIndex[_currentLevel - 1]] : 0);
_doorSwitches[shapeId2 + i].x = _doorSwitchCoords[doorType2 * 6 + i * 2];
_doorSwitches[shapeId2 + i].y = _doorSwitchCoords[doorType2 * 6 + i * 2 + 1];
}
diff --git a/engines/kyra/engine/eobcommon.cpp b/engines/kyra/engine/eobcommon.cpp
index bf991c95f9..9b15c601a8 100644
--- a/engines/kyra/engine/eobcommon.cpp
+++ b/engines/kyra/engine/eobcommon.cpp
@@ -213,7 +213,6 @@ EoBCoreEngine::EoBCoreEngine(OSystem *system, const GameFlags &flags) : KyraRpgE
_menuStringsRest4 = _menuStringsDefeat = _menuStringsTransfer = _menuStringsSpec = 0;
_menuStringsSpellNo = _menuYesNoStrings = _2431Strings = _katakanaLines = _katakanaSelectStrings = 0;
_errorSlotEmptyString = _errorSlotNoNameString = _menuOkString = 0;
- _levelSoundFiles1 = _levelSoundFiles2 = 0;
_spellLevelsMage = _spellLevelsCleric = _numSpellsCleric = _numSpellsWisAdj = _numSpellsPal = _numSpellsMage = 0;
_mnNumWord = _numSpells = _mageSpellListSize = _spellLevelsMageSize = _spellLevelsClericSize = 0;
_inventorySlotsX = _slotValidationFlags = _encodeMonsterShpTable = 0;
diff --git a/engines/kyra/engine/eobcommon.h b/engines/kyra/engine/eobcommon.h
index 74e8ad403c..3d71fe09c0 100644
--- a/engines/kyra/engine/eobcommon.h
+++ b/engines/kyra/engine/eobcommon.h
@@ -1175,9 +1175,6 @@ protected:
void snd_stopSound();
void snd_fadeOut();
- const char *const *_levelSoundFiles1;
- const char *const *_levelSoundFiles2;
-
// keymap
static const char *const kKeymapName;
};
diff --git a/engines/kyra/engine/scene_eob.cpp b/engines/kyra/engine/scene_eob.cpp
index 3ff26cab8a..539d81da6c 100644
--- a/engines/kyra/engine/scene_eob.cpp
+++ b/engines/kyra/engine/scene_eob.cpp
@@ -92,8 +92,11 @@ void EoBCoreEngine::loadLevel(int level, int sub) {
if (_flags.gameID == GI_EOB1 && level == 7 && _levelBlockProperties[0x035C].assignedObjects == 0x0E89)
_levelBlockProperties[0x035C].assignedObjects = 0x0E8D;
- loadVcnData(gfxFile.c_str(), (_flags.gameID == GI_EOB1) ? _cgaMappingLevel[_cgaLevelMappingIndex[level - 1]] : 0);
+ loadVcnData(gfxFile.c_str(), (_flags.gameID == GI_EOB1 && _flags.platform == Common::kPlatformDOS) ? _cgaMappingLevel[_cgaLevelMappingIndex[level - 1]] : 0);
_screen->loadEoBBitmap("INVENT", _cgaMappingInv, 5, 3, 2);
+ if (_flags.platform == Common::kPlatformAmiga)
+ _screen->setScreenPalette(_screen->getPalette(0));
+
delayUntil(end);
snd_stopSound();
@@ -121,7 +124,7 @@ void EoBCoreEngine::readLevelFileData(int level) {
if (s->readUint16LE() == 4) {
delete s;
s = 0;
- _screen->loadBitmap(file.c_str(), 5, 5, 0);
+ _screen->loadBitmap(file.c_str(), 5, 5, 0, true);
}
}
@@ -150,12 +153,12 @@ Common::String EoBCoreEngine::initLevelData(int sub) {
pos += slen;
const char *vmpPattern = (_flags.gameID == GI_EOB1 && (_configRenderMode == Common::kRenderEGA || _configRenderMode == Common::kRenderCGA)) ? "%s.EMP" : "%s.VMP";
- Common::SeekableReadStream *s = _res->createReadStream(Common::String::format(vmpPattern, (const char *)pos));
- uint16 size = (_flags.platform == Common::kPlatformFMTowns) ? 2916 : s->readUint16LE();
+ Common::SeekableReadStreamEndian *s = _res->createEndianAwareReadStream(Common::String::format(vmpPattern, (const char *)pos));
+ uint16 size = (_flags.platform == Common::kPlatformFMTowns) ? 2916 : s->readUint16();
delete[] _vmpPtr;
_vmpPtr = new uint16[size];
for (int i = 0; i < size; i++)
- _vmpPtr[i] = s->readUint16LE();
+ _vmpPtr[i] = s->readUint16();
delete s;
const char *paletteFilePattern = (_flags.gameID == GI_EOB2 && _configRenderMode == Common::kRenderEGA) ? "%s.EGA" : "%s.PAL";
@@ -175,7 +178,7 @@ Common::String EoBCoreEngine::initLevelData(int sub) {
_screen->enableShapeBackgroundFading(false);
}
- if (_flags.gameID == GI_EOB2 || _configRenderMode != Common::kRenderEGA)
+ if (_flags.platform != Common::kPlatformAmiga && (_flags.gameID == GI_EOB2 || _configRenderMode != Common::kRenderEGA))
_screen->loadPalette(tmpStr.c_str(), _screen->getPalette(0));
if (_flags.platform == Common::kPlatformFMTowns) {
@@ -186,6 +189,8 @@ Common::String EoBCoreEngine::initLevelData(int sub) {
_screen->createFadeTable16bit(src, (uint16*)_lightBlueFadingTable, 11, 125);
_screen->createFadeTable16bit(src, (uint16*)_greyFadingTable, 0, 85);
_screen->setScreenPalette(_screen->getPalette(0));
+ } else if (_flags.platform == Common::kPlatformAmiga) {
+
} else if (_configRenderMode != Common::kRenderCGA) {
Palette backupPal(256);
backupPal.copy(_screen->getPalette(0), 224, 32, 224);
@@ -209,6 +214,9 @@ Common::String EoBCoreEngine::initLevelData(int sub) {
delay(3 * _tickLength);
_sound->loadSoundFile((const char *)pos);
pos += 13;
+ } else if (_flags.platform == Common::kPlatformAmiga) {
+ delay(3 * _tickLength);
+ _sound->loadSoundFile(_currentLevel);
}
releaseDoorShapes();
@@ -302,10 +310,20 @@ void EoBCoreEngine::loadVcnData(const char *file, const uint8 *cgaMapping) {
}
const char *filePattern = ((_flags.gameID == GI_EOB1 && (_configRenderMode == Common::kRenderEGA || _configRenderMode == Common::kRenderCGA)) ? "%s.ECN" : "%s.VCN");
- _screen->loadBitmap(Common::String::format(filePattern, _lastBlockDataFile).c_str(), 3, 3, 0);
- const uint8 *pos = _screen->getCPagePtr(3);
+ Common::String fn = Common::String::format(filePattern, _lastBlockDataFile);
+
+ if (_flags.platform == Common::kPlatformAmiga) {
+ Common::SeekableReadStream *in = _res->createReadStream(fn);
+ uint16 size = in->readUint16LE() << 5;
+ in->seek(0, SEEK_SET);
+ _screen->loadFileDataToPage(in, 3, size + 34);
+ delete in;
+ } else {
+ _screen->loadBitmap(fn.c_str(), 3, 3, 0, true);
+ }
- uint32 vcnSize = READ_LE_UINT16(pos) << 5;
+ const uint8 *pos = _screen->getCPagePtr(3);
+ uint16 vcnSize = READ_LE_UINT16(pos) << 5;
pos += 2;
const uint8 *colMap = pos;
@@ -459,7 +477,7 @@ void EoBCoreEngine::assignWallsAndDecorations(int wallIndex, int vmpIndex, int d
if (r->w == 0 || r->h == 0)
error("Error trying to make decoration %d (x: %d, y: %d, w: %d, h: %d)", decIndex, r->x, r->y, r->w, r->h);
- _levelDecorationShapes[t] = _screen->encodeShape(r->x, r->y, r->w, r->h, false, (_flags.gameID == GI_EOB1) ? _cgaMappingLevel[_cgaLevelMappingIndex[_currentLevel - 1]] : 0);
+ _levelDecorationShapes[t] = _screen->encodeShape(r->x, r->y, r->w, r->h, false, (_flags.gameID == GI_EOB1 && _flags.platform == Common::kPlatformDOS) ? _cgaMappingLevel[_cgaLevelMappingIndex[_currentLevel - 1]] : 0);
}
decIndex = _levelDecorationProperties[_mappedDecorationsCount++].next;
diff --git a/engines/kyra/gui/gui_eob.cpp b/engines/kyra/gui/gui_eob.cpp
index 3f7843ec45..41703ca722 100644
--- a/engines/kyra/gui/gui_eob.cpp
+++ b/engines/kyra/gui/gui_eob.cpp
@@ -64,7 +64,7 @@ void EoBCoreEngine::gui_drawPlayField(bool refresh) {
}
void EoBCoreEngine::gui_restorePlayField() {
- loadVcnData(0, (_flags.gameID == GI_EOB1) ? _cgaMappingLevel[_cgaLevelMappingIndex[_currentLevel - 1]] : 0);
+ loadVcnData(0, (_flags.gameID == GI_EOB1 && _flags.platform == Common::kPlatformDOS) ? _cgaMappingLevel[_cgaLevelMappingIndex[_currentLevel - 1]] : 0);
_screen->_curPage = 0;
gui_drawPlayField(true);
gui_drawAllCharPortraitsWithStats();
diff --git a/engines/kyra/resource/staticres_eob.cpp b/engines/kyra/resource/staticres_eob.cpp
index 35b0d2bbe4..ed2f36895e 100644
--- a/engines/kyra/resource/staticres_eob.cpp
+++ b/engines/kyra/resource/staticres_eob.cpp
@@ -1151,9 +1151,6 @@ void EoBEngine::initStaticResource() {
for (int i = 0; i < 5; i++)
_cgaMappingLevel[i] = _staticres->loadRawData(kEoB1CgaMappingLevel0 + i, temp);
- _levelSoundFiles1 = _staticres->loadStrings(kEoB1BaseLevelSounds1, temp);
- _levelSoundFiles2 = _staticres->loadStrings(kEoB1BaseLevelSounds2, temp);
-
_turnUndeadString = _staticres->loadStrings(kEoB1TurnUndeadString, temp);
_npcShpData = _staticres->loadRawData(kEoB1NpcShpData, temp);