aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorathrxx2019-11-24 15:58:37 +0100
committerathrxx2019-12-18 20:50:43 +0100
commitddb6ca441babcbfefc9daf22d3bda3ddf940cb06 (patch)
tree702c3d5a40f158a49e027e4a7c09e59bd73e9a2f
parent512fe083670e0fa1d37b88876d8b612017714c27 (diff)
downloadscummvm-rg350-ddb6ca441babcbfefc9daf22d3bda3ddf940cb06.tar.gz
scummvm-rg350-ddb6ca441babcbfefc9daf22d3bda3ddf940cb06.tar.bz2
scummvm-rg350-ddb6ca441babcbfefc9daf22d3bda3ddf940cb06.zip
KYRA: (EOB/PC98) - fix level loading and some cleanup
(no block drawing yet)
-rw-r--r--engines/kyra/engine/chargen.cpp2
-rw-r--r--engines/kyra/engine/darkmoon.cpp3
-rw-r--r--engines/kyra/engine/eob.cpp17
-rw-r--r--engines/kyra/engine/eob.h3
-rw-r--r--engines/kyra/engine/eobcommon.cpp2
-rw-r--r--engines/kyra/engine/eobcommon.h2
-rw-r--r--engines/kyra/engine/scene_eob.cpp20
-rw-r--r--engines/kyra/graphics/screen.cpp2
-rw-r--r--engines/kyra/graphics/screen.h1
-rw-r--r--engines/kyra/graphics/screen_eob.cpp56
-rw-r--r--engines/kyra/graphics/screen_eob.h9
-rw-r--r--engines/kyra/gui/gui_eob.cpp2
-rw-r--r--engines/kyra/kyra_v1.h6
-rw-r--r--engines/kyra/sequence/sequences_eob.cpp306
14 files changed, 227 insertions, 204 deletions
diff --git a/engines/kyra/engine/chargen.cpp b/engines/kyra/engine/chargen.cpp
index 696f6efdf6..6ddc360630 100644
--- a/engines/kyra/engine/chargen.cpp
+++ b/engines/kyra/engine/chargen.cpp
@@ -282,7 +282,7 @@ void CharacterGenerator::init() {
_screen->fadeToBlack(32);
_screen->loadEoBBitmap("CHARGEN", _vm->_cgaMappingDefault, 5, 3, 0);
- _screen->loadPC98Palette(4, _screen->getPalette(0));
+ _screen->selectPC98Palette(4, _screen->getPalette(0));
if (_vm->gameFlags().platform == Common::kPlatformAmiga || (_vm->game() == GI_EOB1 && _vm->gameFlags().platform == Common::kPlatformPC98))
_screen->fadeFromBlack(32);
diff --git a/engines/kyra/engine/darkmoon.cpp b/engines/kyra/engine/darkmoon.cpp
index 718e8a190e..900956cf49 100644
--- a/engines/kyra/engine/darkmoon.cpp
+++ b/engines/kyra/engine/darkmoon.cpp
@@ -67,10 +67,11 @@ Common::Error DarkMoonEngine::init() {
_screen->loadPalette(_flags.platform == Common::kPlatformFMTowns ? "MENU.PAL" : "PALETTE.COL", _screen->getPalette(0));
_screen->setScreenPalette(_screen->getPalette(0));
- // adjust menu settings for EOB II FM-Towns
if (_flags.platform == Common::kPlatformFMTowns) {
+ // adjust menu settings for EOB II FM-Towns
_screen->modifyScreenDim(6, 10, 100, 21, 40);
_screen->modifyScreenDim(27, 0, 0, 21, 2);
+ _vcnFilePattern = "%s.VCC";
}
return Common::kNoError;
diff --git a/engines/kyra/engine/eob.cpp b/engines/kyra/engine/eob.cpp
index 00aeffbe8a..5ecd43a2a2 100644
--- a/engines/kyra/engine/eob.cpp
+++ b/engines/kyra/engine/eob.cpp
@@ -72,6 +72,7 @@ Common::Error EoBEngine::init() {
_screen->modifyScreenDim(9, 0x01, 0x7D, 0x26, 0x3F);
_screen->modifyScreenDim(12, 0x01, 0x04, 0x14, 0xA0);
+ // adjust main menu coords for EOB I PC-98
if (_flags.platform == Common::kPlatformPC98)
_screen->modifyScreenDim(28, 0x0A, 0xA4, 0x15, 0x18);
@@ -85,6 +86,14 @@ Common::Error EoBEngine::init() {
_screen->loadPalette("PALETTE.COL", _screen->getPalette(0));
}
+ if (_flags.platform == Common::kPlatformPC98) {
+ _vcnFilePattern = "%s.ECB";
+ _vmpFilePattern = "%s.EMP";
+ } else if (_configRenderMode == Common::kRenderEGA || _configRenderMode == Common::kRenderCGA) {
+ _vcnFilePattern = "%s.ECN";
+ _vmpFilePattern = "%s.EMP";
+ }
+
return Common::kNoError;
}
@@ -387,9 +396,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 && _flags.platform == Common::kPlatformDOS) ? _cgaMappingLevel[_cgaLevelMappingIndex[_currentLevel - 1]] : 0);
+ _doorShapes[shapeId1 + i] = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3], false, _cgaLevelMappingIndex ? _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 && _flags.platform == Common::kPlatformDOS) ? _cgaMappingLevel[_cgaLevelMappingIndex[_currentLevel - 1]] : 0);
+ _doorSwitches[shapeId1 + i].shp = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3], false, _cgaLevelMappingIndex ? _cgaMappingLevel[_cgaLevelMappingIndex[_currentLevel - 1]] : 0);
_doorSwitches[shapeId1 + i].x = _doorSwitchCoords[doorType1 * 6 + i * 2];
_doorSwitches[shapeId1 + i].y = _doorSwitchCoords[doorType1 * 6 + i * 2 + 1];
}
@@ -398,9 +407,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 && _flags.platform == Common::kPlatformDOS) ? _cgaMappingLevel[_cgaLevelMappingIndex[_currentLevel - 1]] : 0);
+ _doorShapes[shapeId2 + i] = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3], false, _cgaLevelMappingIndex ? _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 && _flags.platform == Common::kPlatformDOS) ? _cgaMappingLevel[_cgaLevelMappingIndex[_currentLevel - 1]] : 0);
+ _doorSwitches[shapeId2 + i].shp = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3], false, _cgaLevelMappingIndex ? _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/eob.h b/engines/kyra/engine/eob.h
index ac88963514..309636e7f9 100644
--- a/engines/kyra/engine/eob.h
+++ b/engines/kyra/engine/eob.h
@@ -31,6 +31,7 @@ namespace Kyra {
class EoBEngine : public EoBCoreEngine {
friend class GUI_EoB;
+friend class EoBSeqPlayerCommon;
friend class EoBIntroPlayer;
friend class EoBAmigaFinalePlayer;
public:
@@ -84,8 +85,6 @@ private:
void seq_playFinale();
void seq_xdeath();
- void boxMorphTransition(int targetDestX, int targetDestY, int targetFinalX, int targetFinalY, int targetSrcX, int targetSrcY, int targetFinalW, int targetFinalH, int originX1, int originY1, int originW, int originH, int fillColor = -1);
-
const char *const *_finBonusStrings;
// characters
diff --git a/engines/kyra/engine/eobcommon.cpp b/engines/kyra/engine/eobcommon.cpp
index 1767857f3b..238f1404bd 100644
--- a/engines/kyra/engine/eobcommon.cpp
+++ b/engines/kyra/engine/eobcommon.cpp
@@ -59,6 +59,8 @@ EoBCoreEngine::EoBCoreEngine(OSystem *system, const GameFlags &flags) : KyraRpgE
_envAudioTimer = 0;
_flashShapeTimer = 0;
_drawSceneTimer = 0;
+ _vcnFilePattern = "%s.VCN";
+ _vmpFilePattern = "%s.VMP";
_largeItemShapes = _smallItemShapes = _thrownItemShapes = _spellShapes = _firebeamShapes = 0;
_itemIconShapes = _amigaBlueItemIconShapes = _wallOfForceShapes = _teleporterShapes = _sparkShapes = _compassShapes = 0;
diff --git a/engines/kyra/engine/eobcommon.h b/engines/kyra/engine/eobcommon.h
index 91d0a6e089..b54e70b4f5 100644
--- a/engines/kyra/engine/eobcommon.h
+++ b/engines/kyra/engine/eobcommon.h
@@ -629,6 +629,8 @@ protected:
int8 _currentSub;
Common::String _curGfxFile;
Common::String _curBlockFile;
+ Common::String _vcnFilePattern;
+ Common::String _vmpFilePattern;
uint32 _drawSceneTimer;
uint32 _flashShapeTimer;
diff --git a/engines/kyra/engine/scene_eob.cpp b/engines/kyra/engine/scene_eob.cpp
index 6d51c0c725..cbe6055b79 100644
--- a/engines/kyra/engine/scene_eob.cpp
+++ b/engines/kyra/engine/scene_eob.cpp
@@ -94,7 +94,7 @@ 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 && _flags.platform == Common::kPlatformDOS) ? _cgaMappingLevel[_cgaLevelMappingIndex[level - 1]] : 0);
+ loadVcnData(gfxFile.c_str(), _cgaLevelMappingIndex ? _cgaMappingLevel[_cgaLevelMappingIndex[level - 1]] : 0);
_screen->loadEoBBitmap("INVENT", _cgaMappingInv, 5, 3, 2);
if (_flags.platform == Common::kPlatformAmiga && _flags.gameID == GI_EOB1)
_screen->getPalette(0).copy(_screen->getPalette(1), 1, 5, 1);
@@ -107,6 +107,9 @@ void EoBCoreEngine::loadLevel(int level, int sub) {
_sceneDrawPage2 = 1;
_screen->setCurPage(0);
setHandItem(_itemInHand);
+
+ if (_flags.platform == Common::kPlatformPC98)
+ snd_playSong(level + 1);
}
void EoBCoreEngine::readLevelFileData(int level) {
@@ -159,8 +162,8 @@ Common::String EoBCoreEngine::initLevelData(int sub) {
loadBlockProperties((const char *)pos);
pos += slen;
- const char *vmpPattern = (_flags.gameID == GI_EOB1 && (_configRenderMode == Common::kRenderEGA || _configRenderMode == Common::kRenderCGA)) ? "%s.EMP" : "%s.VMP";
- Common::SeekableReadStreamEndian *s = _res->createEndianAwareReadStream(Common::String::format(vmpPattern, (const char *)pos));
+ Common::SeekableReadStreamEndian *s = _res->createEndianAwareReadStream(Common::String::format(_vmpFilePattern.c_str(), (const char *)pos));
+ assert(s);
uint16 size = (_flags.platform == Common::kPlatformFMTowns) ? 2916 : s->readUint16();
delete[] _vmpPtr;
_vmpPtr = new uint16[size];
@@ -203,6 +206,8 @@ Common::String EoBCoreEngine::initLevelData(int sub) {
_screen->setScreenPalette(_screen->getPalette(0));
} else if (_flags.platform == Common::kPlatformAmiga) {
// Amiga versions don't have shape shading
+ } else if (_flags.gameID == GI_EOB1 && _flags.platform == Common::kPlatformPC98) {
+
} else if (_configRenderMode != Common::kRenderCGA) {
Palette backupPal(256);
backupPal.copy(_screen->getPalette(0), 224, 32, 224);
@@ -320,12 +325,11 @@ void EoBCoreEngine::loadVcnData(const char *file, const uint8 *cgaMapping) {
uint32 vcnSize = 0;
if (_flags.platform == Common::kPlatformFMTowns) {
- _vcnBlocks = _res->fileData(Common::String::format("%s.VCC", _lastBlockDataFile).c_str(), &vcnSize);
+ _vcnBlocks = _res->fileData(Common::String::format(_vcnFilePattern.c_str(), _lastBlockDataFile).c_str(), &vcnSize);
return;
}
- const char *filePattern = ((_flags.gameID == GI_EOB1 && (_configRenderMode == Common::kRenderEGA || _configRenderMode == Common::kRenderCGA)) ? "%s.ECN" : "%s.VCN");
- Common::String fn = Common::String::format(filePattern, _lastBlockDataFile);
+ Common::String fn = Common::String::format(_vcnFilePattern.c_str(), _lastBlockDataFile);
if (_flags.gameID == GI_EOB1 && _flags.platform == Common::kPlatformAmiga) {
Common::SeekableReadStream *in = _res->createReadStream(fn);
@@ -495,7 +499,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 && _flags.platform == Common::kPlatformDOS) ? _cgaMappingLevel[_cgaLevelMappingIndex[_currentLevel - 1]] : 0);
+ _levelDecorationShapes[t] = _screen->encodeShape(r->x, r->y, r->w, r->h, false, _cgaLevelMappingIndex ? _cgaMappingLevel[_cgaLevelMappingIndex[_currentLevel - 1]] : 0);
}
decIndex = _levelDecorationProperties[_mappedDecorationsCount++].next;
@@ -706,7 +710,7 @@ int EoBCoreEngine::calcNewBlockPositionAndTestPassability(uint16 curBlock, uint1
void EoBCoreEngine::notifyBlockNotPassable() {
_txt->printMessage(_warningStrings[0]);
- snd_playSoundEffect(29); //PC98 : 45
+ snd_playSoundEffect(_flags.gameID == GI_EOB1 && _flags.platform == Common::kPlatformPC98 ? 45 : 29);
removeInputTop();
}
diff --git a/engines/kyra/graphics/screen.cpp b/engines/kyra/graphics/screen.cpp
index e21344948f..268cf36094 100644
--- a/engines/kyra/graphics/screen.cpp
+++ b/engines/kyra/graphics/screen.cpp
@@ -57,6 +57,7 @@ Screen::Screen(KyraEngine_v1 *vm, OSystem *system, const ScreenDim *dimTable, co
_sjisMixedFontMode = false;
_useHiColorScreen = _vm->gameFlags().useHiColorMode;
+ _use256ColorMode = true;
_screenPageSize = SCREEN_PAGE_SIZE;
_16bitPalette = 0;
_16bitConversionPalette = 0;
@@ -189,6 +190,7 @@ bool Screen::init() {
// We allow 256 color palettes in EGA mode, since original EOB II code does the same and requires it
const int numColors = _use16ColorMode ? 16 : (_isAmiga ? 32 : (_renderMode == Common::kRenderCGA ? 4 : 256));
const int numColorsInternal = _useAmigaExtraColors ? 64 : numColors;
+ _use256ColorMode = (_bytesPerPixel != 2 && !_isAmiga && !_use16ColorMode && _renderMode != Common::kRenderCGA && _renderMode != Common::kRenderEGA);
_interfacePaletteEnabled = false;
diff --git a/engines/kyra/graphics/screen.h b/engines/kyra/graphics/screen.h
index d9d2831726..8f86a18615 100644
--- a/engines/kyra/graphics/screen.h
+++ b/engines/kyra/graphics/screen.h
@@ -690,6 +690,7 @@ protected:
bool _useOverlays;
bool _useSJIS;
bool _use16ColorMode;
+ bool _use256ColorMode;
bool _4bitPixelPacking;
bool _useHiResEGADithering;
bool _useHiColorScreen;
diff --git a/engines/kyra/graphics/screen_eob.cpp b/engines/kyra/graphics/screen_eob.cpp
index e25ad3860c..93be64ae3b 100644
--- a/engines/kyra/graphics/screen_eob.cpp
+++ b/engines/kyra/graphics/screen_eob.cpp
@@ -63,10 +63,8 @@ Screen_EoB::Screen_EoB(EoBCoreEngine *vm, OSystem *system) : Screen(vm, system,
_cgaMappingDefault = 0;
_cgaDitheringTables[0] = _cgaDitheringTables[1] = 0;
_useHiResEGADithering = _dualPaletteMode = false;
- _cpsFileExt = 0;
_decodeTempBuffer = 0;
- _curPalID = 0;
- _curPal = 0;
+ _cpsFilePattern = "%s.";
for (int i = 0; i < 10; ++i)
_palette16c[i] = 0;
}
@@ -133,7 +131,7 @@ bool Screen_EoB::init() {
} else if (_vm->gameFlags().platform == Common::kPlatformFMTowns) {
ci = 2;
}
- _cpsFileExt = cpsExt[ci];
+ _cpsFilePattern += cpsExt[ci];
return true;
}
@@ -261,12 +259,15 @@ void Screen_EoB::loadBitmap(const char *filename, int tempPage, int dstPage, Pal
str->skip(2);
uint16 imgSize = str->readUint16LE();
assert(imgSize == str->size() - 4);
- loadFileDataToPage(str, tempPage, imgSize);
+ uint8 *buf = new uint8[SCREEN_W * SCREEN_H];
+ str->read(buf, imgSize);
delete str;
- decodeBIN(_pagePtrs[tempPage], _pagePtrs[dstPage], imgSize);
+ decodeBIN(buf, _pagePtrs[dstPage], imgSize);
if (!skip)
- decodePC98PlanarBitmap(dstPage, tempPage);
+ decodePC98PlanarBitmap(_pagePtrs[dstPage], buf, SCREEN_W * SCREEN_H);
+
+ delete[] buf;
} else {
Screen::loadBitmap(filename, tempPage, dstPage, pal);
}
@@ -296,7 +297,7 @@ void Screen_EoB::loadBitmap(const char *filename, int tempPage, int dstPage, Pal
}
void Screen_EoB::loadEoBBitmap(const char *file, const uint8 *cgaMapping, int tempPage, int destPage, int convertToPage) {
- Common::String tmp = Common::String::format("%s.%s", file, _cpsFileExt);
+ Common::String tmp = Common::String::format(_cpsFilePattern.c_str(), file);
Common::SeekableReadStream *s = _vm->resource()->createReadStream(tmp);
bool loadAlternative = false;
@@ -1563,24 +1564,19 @@ void Screen_EoB::shadeRect(int x1, int y1, int x2, int y2, int shadingLevel) {
_16bitShadingLevel = l;
}
-void Screen_EoB::loadPC98Palette(int palID, Palette &dest) {
- if (palID < 0 || palID > 9)
+void Screen_EoB::selectPC98Palette(int paletteIndex, Palette &dest, int brightness, bool set) {
+ if (paletteIndex < 0 || paletteIndex > 9)
return;
- if (!_use16ColorMode || !_palette16c[palID])
+ if (!_use16ColorMode || !_palette16c[paletteIndex])
return;
- _curPalID = palID;
- _curPal = &dest;
- loadPalette(_palette16c[palID], dest, 48);
-}
-void Screen_EoB::setPC98PaletteBrightness(int modifier) {
- if (!_use16ColorMode || !_palette16c[_curPalID])
- return;
uint8 pal[48];
for (int i = 0; i < 48; ++i)
- pal[i] = CLIP<int>(_palette16c[_curPalID][i] + modifier, 0, 15);
- loadPalette(pal, *_curPal, 48);
- setScreenPalette(*_curPal);
+ pal[i] = CLIP<int>(_palette16c[paletteIndex][i] + brightness, 0, 15);
+ loadPalette(pal, dest, 48);
+
+ if (set)
+ setScreenPalette(dest);
}
void Screen_EoB::decodeBIN(const uint8 *src, uint8 *dst, uint16 inSize) {
@@ -1631,14 +1627,14 @@ void Screen_EoB::decodeBIN(const uint8 *src, uint8 *dst, uint16 inSize) {
}
}
-void Screen_EoB::decodePC98PlanarBitmap(int srcDstPage, int tempPage) {
- assert(tempPage != srcDstPage);
- copyPage(srcDstPage, tempPage);
- const uint8 *src = getCPagePtr(tempPage);
- uint8 *dst1 = _pagePtrs[srcDstPage];
- uint8 *dst2 = _pagePtrs[srcDstPage] + 4;
- uint16 len = (SCREEN_W * SCREEN_H) >> 3;
- while (len--) {
+void Screen_EoB::decodePC98PlanarBitmap(uint8 *srcDstBuffer, uint8 *tmpBuffer, uint16 size) {
+ assert(tmpBuffer != srcDstBuffer);
+ memcpy(tmpBuffer, srcDstBuffer, size);
+ const uint8 *src = tmpBuffer;
+ uint8 *dst1 = srcDstBuffer;
+ uint8 *dst2 = srcDstBuffer + 4;
+ size >>= 3;
+ while (size--) {
for (int i = 0; i < 4; ++i) {
uint8 col1 = 0;
uint8 col2 = 0;
@@ -1862,7 +1858,7 @@ void Screen_EoB::drawShapeSetPixel(uint8 *dst, uint8 col) {
if (_bytesPerPixel == 2) {
*(uint16*)dst = _16bitPalette[(_dsShapeFadingLevel << 8) + col];
return;
- } else if ((!_isAmiga && _renderMode != Common::kRenderCGA && _renderMode != Common::kRenderEGA) || _useHiResEGADithering) {
+ } else if (_use256ColorMode || _useHiResEGADithering) {
if (_dsBackgroundFading) {
if (_dsShapeFadingLevel) {
col = *dst;
diff --git a/engines/kyra/graphics/screen_eob.h b/engines/kyra/graphics/screen_eob.h
index 4f9161af92..6d39ffe809 100644
--- a/engines/kyra/graphics/screen_eob.h
+++ b/engines/kyra/graphics/screen_eob.h
@@ -91,14 +91,11 @@ public:
void shadeRect(int x1, int y1, int x2, int y2, int shadingLevel);
// PC-98 specific
- void loadPC98Palette(int palID, Palette &dest);
- void setPC98PaletteBrightness(int modifier);
+ void selectPC98Palette(int paletteIndex, Palette &dest, int brightness = 0, bool set = false);
void decodeBIN(const uint8 *src, uint8 *dst, uint16 inSize);
- void decodePC98PlanarBitmap(int srcDstPage, int tempPage);
+ void decodePC98PlanarBitmap(uint8 *srcDstBuffer, uint8 *tmpBuffer, uint16 size = 64000);
uint8 *_decodeTempBuffer;
- int _curPalID;
- Palette *_curPal;
// Amiga specific
void loadSpecialAmigaCPS(const char *fileName, int destPage, bool isGraphics);
@@ -148,7 +145,7 @@ private:
// hard coded 16 color palettes for PC98 version of EOB1
const uint8 *_palette16c[10];
- const char *_cpsFileExt;
+ Common::String _cpsFilePattern;
const uint16 _cursorColorKey16Bit;
diff --git a/engines/kyra/gui/gui_eob.cpp b/engines/kyra/gui/gui_eob.cpp
index 5b8c3c6974..adc5312702 100644
--- a/engines/kyra/gui/gui_eob.cpp
+++ b/engines/kyra/gui/gui_eob.cpp
@@ -73,7 +73,7 @@ void EoBCoreEngine::gui_drawPlayField(bool refresh) {
}
void EoBCoreEngine::gui_restorePlayField() {
- loadVcnData(0, (_flags.gameID == GI_EOB1 && _flags.platform == Common::kPlatformDOS) ? _cgaMappingLevel[_cgaLevelMappingIndex[_currentLevel - 1]] : 0);
+ loadVcnData(0, _cgaLevelMappingIndex ? _cgaMappingLevel[_cgaLevelMappingIndex[_currentLevel - 1]] : 0);
_screen->_curPage = 0;
gui_drawPlayField(true);
gui_drawAllCharPortraitsWithStats();
diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h
index cc0a92027f..dc6662c5c3 100644
--- a/engines/kyra/kyra_v1.h
+++ b/engines/kyra/kyra_v1.h
@@ -181,9 +181,9 @@ friend class ::KyraMetaEngine;
friend class GUI;
friend class GUI_v1;
friend class GUI_EoB;
-friend class SoundMidiPC; // For _eventMan
-friend class SeqPlayer_HOF; // For skipFlag()
-friend class TransferPartyWiz; // For save state API
+friend class SoundMidiPC; // For _eventMan
+friend class SeqPlayer_HOF; // For skipFlag()
+friend class TransferPartyWiz; // For save state API
public:
KyraEngine_v1(OSystem *system, const GameFlags &flags);
virtual ~KyraEngine_v1();
diff --git a/engines/kyra/sequence/sequences_eob.cpp b/engines/kyra/sequence/sequences_eob.cpp
index cf9671e6e8..8bfc393894 100644
--- a/engines/kyra/sequence/sequences_eob.cpp
+++ b/engines/kyra/sequence/sequences_eob.cpp
@@ -33,10 +33,29 @@
namespace Kyra {
-class EoBIntroPlayer {
+class EoBSeqPlayerCommon {
+public:
+ EoBSeqPlayerCommon(EoBEngine *vm, Screen_EoB *screen);
+ virtual ~EoBSeqPlayerCommon() {}
+
+protected:
+ void boxMorphTransition(int targetDestX, int targetDestY, int targetFinalX, int targetFinalY, int targetSrcX, int targetSrcY, int targetFinalW, int targetFinalH, int originX1, int originY1, int originW, int originH, int fillColor = -1);
+ void printSubtitle(const char *str, int textmodeX, int textmodeY, int col, int mode = 0);
+
+ const uint8 _fillColor1;
+ const uint8 _fillColor2;
+
+ EoBEngine *_vm;
+ Screen_EoB *_screen;
+
+private:
+ uint8 _textColor;
+};
+
+class EoBIntroPlayer : public EoBSeqPlayerCommon {
public:
EoBIntroPlayer(EoBEngine *vm, Screen_EoB *screen);
- ~EoBIntroPlayer() {}
+ virtual ~EoBIntroPlayer() {}
enum IntroPart {
kOnlyCredits = 0,
@@ -59,12 +78,6 @@ private:
void loadAndSetPalette(const char *dosPaletteFile, int pc98PaletteID);
void copyBlurRegion(int x1, int y1, int x2, int y2, int w, int h, int step);
void whirlTransition();
- void printSubtitle(const char *str, int textmodeX, int textmodeY, int col, int mode = 0);
-
- uint8 _textColor;
-
- EoBEngine *_vm;
- Screen_EoB *_screen;
int _lastFileOpening;
const char *const *_filesOpening;
@@ -94,15 +107,12 @@ private:
const uint8 *_tvlY2;
const uint8 *_tvlW;
const uint8 *_tvlH;
-
- const uint8 _fillColor1;
- const uint8 _fillColor2;
};
-class EoBAmigaFinalePlayer {
+class EoBAmigaFinalePlayer : public EoBSeqPlayerCommon {
public:
EoBAmigaFinalePlayer(EoBEngine *vm, Screen_EoB *screen);
- ~EoBAmigaFinalePlayer();
+ virtual ~EoBAmigaFinalePlayer();
void start();
@@ -128,13 +138,129 @@ private:
const uint8 *_textFrameDuration;
int _animCurFrame;
-
- EoBEngine *_vm;
- Screen_EoB *_screen;
};
-EoBIntroPlayer::EoBIntroPlayer(EoBEngine *vm, Screen_EoB *screen) : _vm(vm), _screen(screen),
- _fillColor1(vm->gameFlags().platform == Common::kPlatformAmiga ? 19 : (vm->gameFlags().platform == Common::kPlatformPC98 ? 0 : 12)), _fillColor2(vm->gameFlags().platform == Common::kPlatformAmiga ? 10 : 157) {
+EoBSeqPlayerCommon::EoBSeqPlayerCommon(EoBEngine *vm, Screen_EoB *screen) : _vm(vm), _screen(screen), _textColor(0xE1),
+ _fillColor1(vm->gameFlags().platform == Common::kPlatformAmiga ? 19 : (vm->gameFlags().platform == Common::kPlatformPC98 ? 0 : 12)),
+ _fillColor2(vm->gameFlags().platform == Common::kPlatformAmiga ? 10 : 157) {
+}
+
+void EoBSeqPlayerCommon::boxMorphTransition(int targetDestX, int targetDestY, int targetFinalX, int targetFinalY, int targetSrcX, int targetSrcY, int targetFinalW, int targetFinalH, int originX1, int originY1, int originW, int originH, int fillColor) {
+ int originX2 = originX1 + originW;
+ int originY2 = originY1 + originH;
+ if (originY2 > 21)
+ originY2 = 21;
+
+ if (fillColor != -1) {
+ _screen->fillRect(0, 170, 319, 186, fillColor, 0);
+ _screen->fillRect(0, 170, 319, 186, fillColor, 2);
+ }
+
+ int w = 1;
+ int h = 1;
+ for (bool runloop = true; runloop && !_vm->shouldQuit() && !_vm->skipFlag(); ) {
+ uint32 end = _vm->_system->getMillis() + _vm->tickLength();
+ _screen->copyRegion(targetSrcX << 3, targetSrcY << 3, targetDestX << 3, targetDestY << 3, w << 3, h << 3, 2, 0, Screen::CR_NO_P_CHECK);
+ if (originX1 < targetDestX)
+ _screen->copyRegion(312, 0, originX1 << 3, 0, 8, 176, 0, 0, Screen::CR_NO_P_CHECK);
+ if (originY1 < targetDestY)
+ _screen->copyRegion(0, 192, 0, originY1 << 3, 320, 8, 0, 0, Screen::CR_NO_P_CHECK);
+ if ((targetFinalX + targetFinalW) <= originX2)
+ _screen->copyRegion(312, 0, originX2 << 3, 0, 8, 176, 0, 0, Screen::CR_NO_P_CHECK);
+ if ((targetFinalY + targetFinalH) <= originY2)
+ _screen->copyRegion(0, 192, 0, originY2 << 3, 320, 8, 0, 0, Screen::CR_NO_P_CHECK);
+
+ if (!(targetDestX != targetFinalX || targetDestY != targetFinalY || w != targetFinalW || h != targetFinalH || originX1 < targetFinalX || originY1 < targetFinalY || (targetFinalX + targetFinalW) < originX2 || (targetFinalY + targetFinalH) < originY2))
+ runloop = false;
+
+ int v = targetFinalX - targetDestX;
+ v = (v < 0) ? -1 : ((v > 0) ? 1 : 0);
+ targetDestX += v;
+ v = targetFinalY - targetDestY;
+ v = (v < 0) ? -1 : ((v > 0) ? 1 : 0);
+ targetDestY += v;
+
+ if (w != targetFinalW)
+ w += 2;
+ if (w > targetFinalW)
+ w = targetFinalW;
+
+ if (h != targetFinalH)
+ h += 2;
+ if (h > targetFinalH)
+ h = targetFinalH;
+
+ if (++originX1 > targetFinalX)
+ originX1 = targetFinalX;
+
+ if (++originY1 > targetFinalY)
+ originY1 = targetFinalY;
+
+ if ((targetFinalX + targetFinalW) < originX2)
+ originX2--;
+
+ if ((targetFinalY + targetFinalH) < originY2)
+ originY2--;
+
+ _screen->updateScreen();
+ _vm->delayUntil(end);
+ }
+}
+
+void EoBSeqPlayerCommon::printSubtitle(const char *str, int textmodeX, int textmodeY, int col, int mode) {
+ if (col)
+ _textColor = col & 0xFF;
+
+ char charStr[3];
+ charStr[2] = 0;
+ int curX = 0;
+
+ if (!str)
+ return;
+
+ Screen::FontId of = _screen->setFont(Screen::FID_SJIS_TEXTMODE_FNT);
+ int cp = _screen->setCurPage(0);
+
+ for (int i = 0; str[i] &&!_vm->shouldQuit() && !_vm->skipFlag(); ) {
+ uint8 c = str[i++];
+ if (c == 13) {
+ curX = 0;
+ textmodeY++;
+ } else if (c == 10) {
+ _textColor = str[i++];
+ } else if (c == 7) {
+ _vm->delay(960);
+ _screen->fillRect(0, 160, 319, 199, _fillColor1, 0);
+ curX = 0;
+ }
+
+ charStr[0] = c;
+ charStr[1] = (c >= 0x81 && (c <= 0x9F || (c >= 0xE0 && c <= 0xFC))) ? str[i++] : 0;
+
+ _screen->printText(charStr, (textmodeX << 2) + (curX << 3), textmodeY << 3, _textColor, 0);
+
+ if ((++curX + textmodeX) == 80) {
+ curX = 0;
+ textmodeY++;
+ }
+
+ if (mode == 0) {
+ _vm->_system->delayMillis(40);
+ _screen->updateScreen();
+ } else if (mode == 1) {
+ _vm->delay(40);
+ _screen->updateScreen();
+ }
+ }
+
+ if (mode == 2)
+ _screen->updateScreen();
+
+ _screen->setFont(of);
+ _screen->setCurPage(cp);
+}
+
+EoBIntroPlayer::EoBIntroPlayer(EoBEngine *vm, Screen_EoB *screen) : EoBSeqPlayerCommon(vm, screen) {
int temp = 0;
_filesOpening = _vm->staticres()->loadStrings(kEoB1IntroFilesOpening, temp);
_lastFileOpening = temp - 2;
@@ -166,7 +292,6 @@ EoBIntroPlayer::EoBIntroPlayer(EoBEngine *vm, Screen_EoB *screen) : _vm(vm), _sc
_tvlH = _vm->staticres()->loadRawData(kEoB1IntroTvlH, temp);
const uint8 *orbFadePal = _vm->staticres()->loadRawData(kEoB1IntroOrbFadePal, temp);
_screen->loadPalette(orbFadePal, _screen->getPalette(2), temp);
- _textColor = 0xE1;
}
void EoBIntroPlayer::start(int part) {
@@ -225,7 +350,7 @@ void EoBIntroPlayer::openingCredits() {
_screen->convertPage(3, 0, _vm->_cgaMappingAlt);
if (_vm->gameFlags().platform == Common::kPlatformPC98)
- _screen->loadPC98Palette(1, _screen->getPalette(0));
+ _screen->selectPC98Palette(1, _screen->getPalette(0));
if (_vm->gameFlags().platform == Common::kPlatformDOS) {
loadAndSetPalette(_filesOpening[5], 1);
@@ -275,8 +400,8 @@ void EoBIntroPlayer::tower() {
whirlTransition();
- loadAndSetPalette(_filesTower[0], 0);
- _screen->setPC98PaletteBrightness(-15);
+ loadAndSetPalette(_filesTower[0], -1);
+ _screen->selectPC98Palette(0, _screen->getPalette(0), -15, true);
_screen->setCurPage(cp);
_screen->clearCurPage();
@@ -292,12 +417,12 @@ void EoBIntroPlayer::tower() {
uint32 end = _vm->_system->getMillis() + 2 * _vm->_tickLength;
_screen->copyRegion(0, 142 - i, 96, 0, 128, i + 1, 4, 0, Screen::CR_NO_P_CHECK);
_screen->copyRegion(0, 0, 96, i + 1, 128, 167 - i, 2, 0, Screen::CR_NO_P_CHECK);
- _screen->setPC98PaletteBrightness(MIN(i / 4 - 14, 0));
+ _screen->selectPC98Palette(0, _screen->getPalette(0), MIN(i / 4 - 14, 0), true);
_screen->updateScreen();
_vm->delayUntil(end);
}
- _screen->setPC98PaletteBrightness(0);
+ _screen->selectPC98Palette(0, _screen->getPalette(0), 0, true);
for (int i = 0; i < 24 && !_vm->shouldQuit() && !_vm->skipFlag(); i += 2) {
uint32 end = _vm->_system->getMillis() + 2 * _vm->_tickLength;
@@ -633,7 +758,7 @@ void EoBIntroPlayer::hands() {
_screen->fillRect(0, 0, 191, 63, _fillColor2, 2);
_screen->drawShape(2, shp1, 0, 4, 0);
_screen->drawShape(2, shp2, 151, 4, 0);
- _vm->boxMorphTransition(25, 8, 18, 4, 3, 0, 21, 8, 6, 0, 28, 23);
+ boxMorphTransition(25, 8, 18, 4, 3, 0, 21, 8, 6, 0, 28, 23);
displaySubtitle(128, 176, 16, _stringsHands, 0, 24, 23, 0xE1, 0);
@@ -666,7 +791,7 @@ void EoBIntroPlayer::hands() {
_screen->fillRect(0, 0, 135, 63, _fillColor2);
_screen->drawShape(2, shp1, 32, -80, 0);
_screen->drawShape(2, shp2, 40, -16, 0);
- _vm->boxMorphTransition(18, 16, 10, 12, 0, 0, 17, 8, 17, 3, 25, 10);
+ boxMorphTransition(18, 16, 10, 12, 0, 0, 17, 8, 17, 3, 25, 10);
_vm->delay(15 * _vm->_tickLength);
for (int i = -80; i <= 0 && !_vm->shouldQuit() && !_vm->skipFlag(); i += 4) {
@@ -705,7 +830,7 @@ void EoBIntroPlayer::hands() {
_screen->fillRect(0, 0, 143, 95, _fillColor2);
_screen->drawShape(2, shp1, -56, -56, 0);
_screen->drawShape(2, shp2, 52, 49, 0);
- _vm->boxMorphTransition(9, 6, 0, 0, 0, 0, 18, 12, 8, 11, 21, 10);
+ boxMorphTransition(9, 6, 0, 0, 0, 0, 18, 12, 8, 11, 21, 10);
_vm->delay(15 * _vm->_tickLength);
_vm->snd_playSoundEffect(11);
@@ -731,7 +856,7 @@ void EoBIntroPlayer::hands() {
_screen->setCurPage(2);
_screen->fillRect(0, 0, 87, 112, _fillColor2);
_screen->drawShape(2, shp2, 0, 90, 0);
- _vm->boxMorphTransition(20, 13, 15, 6, 0, 0, 11, 14, 0, 0, 24, 16);
+ boxMorphTransition(20, 13, 15, 6, 0, 0, 11, 14, 0, 0, 24, 16);
_vm->delay(15 * _vm->_tickLength);
int dy = 90;
@@ -990,7 +1115,7 @@ void EoBIntroPlayer::loadAndSetPalette(const char *dosPaletteFile, int pc98Palet
if (_vm->gameFlags().platform == Common::kPlatformDOS)
_screen->loadPalette(dosPaletteFile, _screen->getPalette(0));
else if (_vm->gameFlags().platform == Common::kPlatformPC98 && pc98PaletteID >= 0)
- _screen->loadPC98Palette(pc98PaletteID, _screen->getPalette(0));
+ _screen->selectPC98Palette(pc98PaletteID, _screen->getPalette(0));
_screen->getPalette(0).fill(0, 1, 0);
_screen->setScreenPalette(_screen->getPalette(0));
@@ -1081,60 +1206,7 @@ void EoBIntroPlayer::whirlTransition() {
}
}
-void EoBIntroPlayer::printSubtitle(const char *str, int textmodeX, int textmodeY, int col, int mode) {
- if (col)
- _textColor = col & 0xFF;
-
- char charStr[3];
- charStr[2] = 0;
- int curX = 0;
-
- if (!str)
- return;
-
- Screen::FontId of = _screen->setFont(Screen::FID_SJIS_TEXTMODE_FNT);
- int cp = _screen->setCurPage(0);
-
- for (int i = 0; str[i]; ) {
- uint8 c = str[i++];
- if (c == 13) {
- curX = 0;
- textmodeY++;
- } else if (c == 10) {
- _textColor = str[i++];
- } else if (c == 7) {
- _vm->delay(960);
- _screen->fillRect(0, 160, 319, 199, _fillColor1, 0);
- curX = 0;
- }
-
- charStr[0] = c;
- charStr[1] = (c >= 0x81 && (c <= 0x9F || (c >= 0xE0 && c <= 0xFC))) ? str[i++] : 0;
-
- _screen->printText(charStr, (textmodeX << 2) + (curX << 3), textmodeY << 3, _textColor, 0);
-
- if ((++curX + textmodeX) == 80) {
- curX = 0;
- textmodeY++;
- }
-
- if (mode == 0) {
- _vm->_system->delayMillis(40);
- _screen->updateScreen();
- } else if (mode == 1) {
- _vm->delay(40);
- _screen->updateScreen();
- }
- }
-
- if (mode == 2)
- _screen->updateScreen();
-
- _screen->setFont(of);
- _screen->setCurPage(cp);
-}
-
-EoBAmigaFinalePlayer::EoBAmigaFinalePlayer(EoBEngine *vm, Screen_EoB *screen) : _vm(vm), _screen(screen) {
+EoBAmigaFinalePlayer::EoBAmigaFinalePlayer(EoBEngine *vm, Screen_EoB *screen) : EoBSeqPlayerCommon(vm, screen) {
_animCurFrame = 0;
int size = 0;
_textShapes = new uint8*[10];
@@ -1281,7 +1353,7 @@ void EoBAmigaFinalePlayer::inspection() {
_screen->fillRect(0, 48, 9, 120, 31, 0);
_screen->fillRect(312, 48, 319, 120, 31, 0);
- _vm->boxMorphTransition(18, 6, 12, 3, 12, 3, 16, 5, 1, 5, 39, 10, 31);
+ boxMorphTransition(18, 6, 12, 3, 12, 3, 16, 5, 1, 5, 39, 10, 31);
for (int i = 0; i < 5; ++i)
shp[i] = _screen->encodeShape((i << 2) + 8, 0, 4, 24, true);
@@ -1327,7 +1399,7 @@ void EoBAmigaFinalePlayer::surprise() {
_screen->copyRegion(crds[0] << 3, crds[1], crds[4] << 3, crds[5], crds[2] << 3, crds[3], 4, 2, Screen::CR_NO_P_CHECK);
}
- _vm->boxMorphTransition(0, 9, 0, 6, 0, 10, 40, 9, 12, 3, 16, 21, 31);
+ boxMorphTransition(0, 9, 0, 6, 0, 10, 40, 9, 12, 3, 16, 21, 31);
for (int i = 0; i < 15 && !_vm->skipFlag() && !_vm->shouldQuit(); ++i) {
animateCouncil1(4, 2);
@@ -1546,7 +1618,7 @@ int EoBEngine::mainMenu() {
if (_ttlCfg->fade)
_screen->fadeToBlack(10);
- _screen->loadPC98Palette(_ttlCfg->pc98PaletteID, _screen->getPalette(0));
+ _screen->selectPC98Palette(_ttlCfg->pc98PaletteID, _screen->getPalette(0));
for (int i = 0; i < 3; ++i) {
if (_ttlCfg->palFiles[i].renderMode == -1)
break;
@@ -1751,68 +1823,6 @@ void EoBEngine::seq_xdeath() {
gui_drawAllCharPortraitsWithStats();
}
-void EoBEngine::boxMorphTransition(int targetDestX, int targetDestY, int targetFinalX, int targetFinalY, int targetSrcX, int targetSrcY, int targetFinalW, int targetFinalH, int originX1, int originY1, int originW, int originH, int fillColor) {
- int originX2 = originX1 + originW;
- int originY2 = originY1 + originH;
- if (originY2 > 21)
- originY2 = 21;
-
- if (fillColor != -1) {
- _screen->fillRect(0, 170, 319, 186, fillColor, 0);
- _screen->fillRect(0, 170, 319, 186, fillColor, 2);
- }
-
- int w = 1;
- int h = 1;
- for (bool runloop = true; runloop && !shouldQuit() && !skipFlag();) {
- uint32 end = _system->getMillis() + _tickLength;
- _screen->copyRegion(targetSrcX << 3, targetSrcY << 3, targetDestX << 3, targetDestY << 3, w << 3, h << 3, 2, 0, Screen::CR_NO_P_CHECK);
- if (originX1 < targetDestX)
- _screen->copyRegion(312, 0, originX1 << 3, 0, 8, 176, 0, 0, Screen::CR_NO_P_CHECK);
- if (originY1 < targetDestY)
- _screen->copyRegion(0, 192, 0, originY1 << 3, 320, 8, 0, 0, Screen::CR_NO_P_CHECK);
- if ((targetFinalX + targetFinalW) <= originX2)
- _screen->copyRegion(312, 0, originX2 << 3, 0, 8, 176, 0, 0, Screen::CR_NO_P_CHECK);
- if ((targetFinalY + targetFinalH) <= originY2)
- _screen->copyRegion(0, 192, 0, originY2 << 3, 320, 8, 0, 0, Screen::CR_NO_P_CHECK);
-
- if (!(targetDestX != targetFinalX || targetDestY != targetFinalY || w != targetFinalW || h != targetFinalH || originX1 < targetFinalX || originY1 < targetFinalY || (targetFinalX + targetFinalW) < originX2 || (targetFinalY + targetFinalH) < originY2))
- runloop = false;
-
- int v = targetFinalX - targetDestX;
- v = (v < 0) ? -1 : ((v > 0) ? 1 : 0);
- targetDestX += v;
- v = targetFinalY - targetDestY;
- v = (v < 0) ? -1 : ((v > 0) ? 1 : 0);
- targetDestY += v;
-
- if (w != targetFinalW)
- w += 2;
- if (w > targetFinalW)
- w = targetFinalW;
-
- if (h != targetFinalH)
- h += 2;
- if (h > targetFinalH)
- h = targetFinalH;
-
- if (++originX1 > targetFinalX)
- originX1 = targetFinalX;
-
- if (++originY1 > targetFinalY)
- originY1 = targetFinalY;
-
- if ((targetFinalX + targetFinalW) < originX2)
- originX2--;
-
- if ((targetFinalY + targetFinalH) < originY2)
- originY2--;
-
- _screen->updateScreen();
- delayUntil(end);
- }
-}
-
#undef displaySubtitle
#undef printSub