aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorathrxx2019-11-20 23:56:41 +0100
committerathrxx2019-12-18 20:50:42 +0100
commita0828a000b5ecff36e987db283436fc7b574232d (patch)
treeb0cfc4338e0acdf07a5af90a0767283821b24ea4 /engines/kyra
parent1db3ec1f712ba75e04911e0a936f873998f9d1c9 (diff)
downloadscummvm-rg350-a0828a000b5ecff36e987db283436fc7b574232d.tar.gz
scummvm-rg350-a0828a000b5ecff36e987db283436fc7b574232d.tar.bz2
scummvm-rg350-a0828a000b5ecff36e987db283436fc7b574232d.zip
KYRA: (EOB/PC98) - fix intro and main menu screen
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/engine/chargen.cpp15
-rw-r--r--engines/kyra/engine/eob.cpp12
-rw-r--r--engines/kyra/engine/eob.h21
-rw-r--r--engines/kyra/engine/eobcommon.cpp2
-rw-r--r--engines/kyra/graphics/screen.cpp20
-rw-r--r--engines/kyra/graphics/screen.h3
-rw-r--r--engines/kyra/graphics/screen_eob.cpp20
-rw-r--r--engines/kyra/graphics/screen_eob.h3
-rw-r--r--engines/kyra/gui/gui_eob.cpp8
-rw-r--r--engines/kyra/gui/gui_eob.h1
-rw-r--r--engines/kyra/resource/staticres_eob.cpp42
-rw-r--r--engines/kyra/sequence/sequences_eob.cpp210
12 files changed, 285 insertions, 72 deletions
diff --git a/engines/kyra/engine/chargen.cpp b/engines/kyra/engine/chargen.cpp
index ef61bb987c..696f6efdf6 100644
--- a/engines/kyra/engine/chargen.cpp
+++ b/engines/kyra/engine/chargen.cpp
@@ -195,7 +195,7 @@ bool CharacterGenerator::start(EoBCharacter *characters, uint8 ***faceShapes) {
checkForCompleteParty();
initButtonsFromList(0, 5);
- _vm->snd_playSong(_vm->game() == GI_EOB1 ? 20 : 13);
+ _vm->snd_playSong(_vm->game() == GI_EOB1 ? (_vm->gameFlags().platform == Common::kPlatformPC98 ? 1 : 20) : 13);
_activeBox = 0;
for (bool loop = true; loop && (!_vm->shouldQuit());) {
@@ -266,7 +266,7 @@ bool CharacterGenerator::start(EoBCharacter *characters, uint8 ***faceShapes) {
}
void CharacterGenerator::init() {
- _screen->loadShapeSetBitmap("CHARGENA", 3, 3);
+ _screen->loadShapeSetBitmap("CHARGENA", 5, 3);
if (_faceShapes) {
for (int i = 0; i < 44; i++)
delete[] _faceShapes[i];
@@ -278,15 +278,16 @@ void CharacterGenerator::init() {
_faceShapes[i] = _screen->encodeShape((i % 10) << 2, (i / 10) << 5, 4, 32, true, _vm->_cgaMappingDefault);
_screen->_curPage = 0;
- if (_vm->gameFlags().platform == Common::kPlatformAmiga)
+ if (_vm->gameFlags().platform == Common::kPlatformAmiga || (_vm->game() == GI_EOB1 && _vm->gameFlags().platform == Common::kPlatformPC98))
_screen->fadeToBlack(32);
- _screen->loadEoBBitmap("CHARGEN", _vm->_cgaMappingDefault, 3, 3, 0);
+ _screen->loadEoBBitmap("CHARGEN", _vm->_cgaMappingDefault, 5, 3, 0);
+ _screen->loadPC98Palette(4, _screen->getPalette(0));
- if (_vm->gameFlags().platform == Common::kPlatformAmiga)
+ if (_vm->gameFlags().platform == Common::kPlatformAmiga || (_vm->game() == GI_EOB1 && _vm->gameFlags().platform == Common::kPlatformPC98))
_screen->fadeFromBlack(32);
- _screen->loadShapeSetBitmap("CHARGENB", 3, 3);
+ _screen->loadShapeSetBitmap("CHARGENB", 5, 3);
if (_chargenMagicShapes) {
for (int i = 0; i < 10; i++)
delete[] _chargenMagicShapes[i];
@@ -301,7 +302,7 @@ void CharacterGenerator::init() {
const CreatePartyModButton *c = &_chargenModButtons[i];
_chargenButtonLabels[i] = c->labelW ? _screen->encodeShape(c->encodeLabelX, c->encodeLabelY, c->labelW, c->labelH, true, _vm->_cgaMappingDefault) : 0;
}
-
+
_screen->convertPage(3, 2, _vm->_cgaMappingDefault);
_screen->_curPage = 0;
_screen->convertToHiColor(2);
diff --git a/engines/kyra/engine/eob.cpp b/engines/kyra/engine/eob.cpp
index f9c872dee3..00aeffbe8a 100644
--- a/engines/kyra/engine/eob.cpp
+++ b/engines/kyra/engine/eob.cpp
@@ -45,6 +45,7 @@ EoBEngine::EoBEngine(OSystem *system, const GameFlags &flags)
_doorSwitchShapeEncodeDefs = _doorSwitchCoords = 0;
_dscDoorCoordsExt = 0;
_useMainMenuGUISettings = false;
+ _ttlCfg = 0;
}
EoBEngine::~EoBEngine() {
@@ -58,6 +59,12 @@ Common::Error EoBEngine::init() {
initStaticResource();
+ for (int i = 0; i < ARRAYSIZE(_titleConfig); ++i) {
+ if (_flags.platform == _titleConfig[i].platform)
+ _ttlCfg = &_titleConfig[i];
+ }
+ assert(_ttlCfg);
+
if (_configRenderMode != Common::kRenderCGA)
_itemsOverlay = _res->fileData((_configRenderMode == Common::kRenderEGA) ? "ITEMRMP.EGA" : "ITEMRMP.VGA", 0);
@@ -65,6 +72,9 @@ Common::Error EoBEngine::init() {
_screen->modifyScreenDim(9, 0x01, 0x7D, 0x26, 0x3F);
_screen->modifyScreenDim(12, 0x01, 0x04, 0x14, 0xA0);
+ if (_flags.platform == Common::kPlatformPC98)
+ _screen->modifyScreenDim(28, 0x0A, 0xA4, 0x15, 0x18);
+
_scriptTimersCount = 1;
if (_configRenderMode == Common::kRenderEGA) {
@@ -607,7 +617,7 @@ void EoBEngine::healParty() {
const KyraRpgGUISettings *EoBEngine::guiSettings() const {
if (_flags.platform == Common::kPlatformAmiga)
return _useMainMenuGUISettings ? &_guiSettingsAmigaMainMenu : &_guiSettingsAmiga;
- else if (_configRenderMode == Common::kRenderCGA || _configRenderMode == Common::kRenderEGA)
+ else if (_flags.platform == Common::kPlatformPC98 || _configRenderMode == Common::kRenderCGA || _configRenderMode == Common::kRenderEGA)
return &_guiSettingsEGA;
else
return &_guiSettingsVGA;
diff --git a/engines/kyra/engine/eob.h b/engines/kyra/engine/eob.h
index 09e769bb72..9fbc22ab6e 100644
--- a/engines/kyra/engine/eob.h
+++ b/engines/kyra/engine/eob.h
@@ -48,6 +48,27 @@ private:
int mainMenuLoop();
int _menuChoiceInit;
+ struct RenderModePalFile {
+ int renderMode;
+ char filename[12];
+ };
+
+ struct TitleScreenConfig {
+ const Common::Platform platform;
+ const char bmpFile[12];
+ const RenderModePalFile *palFiles;
+ const int pc98PaletteID;
+ const int page;
+ const bool fade;
+ const int menu1X, menu1Y, menu1W, menu1H, menu1col1, menu1col2, menu1col3;
+ const int menu2X, menu2Y, menu2W, menu2H, menu2col1, menu2col2, menu2col3;
+ const int versionStrYOffs;
+ };
+
+ static const RenderModePalFile _renderModePalFiles[3];
+ static const TitleScreenConfig _titleConfig[3];
+ const TitleScreenConfig *_ttlCfg;
+
// Main loop
void startupNew();
void startupLoad();
diff --git a/engines/kyra/engine/eobcommon.cpp b/engines/kyra/engine/eobcommon.cpp
index 826502d405..1767857f3b 100644
--- a/engines/kyra/engine/eobcommon.cpp
+++ b/engines/kyra/engine/eobcommon.cpp
@@ -564,7 +564,7 @@ Common::Error EoBCoreEngine::init() {
Common::Error EoBCoreEngine::go() {
_debugger->initialize();
_txt->removePageBreakFlag();
- _screen->setFont(Screen::FID_8_FNT);
+ _screen->setFont(_flags.platform == Common::kPlatformPC98 ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT);
loadItemsAndDecorationsShapes();
_screen->setMouseCursor(0, 0, _itemIconShapes[0]);
diff --git a/engines/kyra/graphics/screen.cpp b/engines/kyra/graphics/screen.cpp
index f53400a22c..3bcbf3967e 100644
--- a/engines/kyra/graphics/screen.cpp
+++ b/engines/kyra/graphics/screen.cpp
@@ -62,6 +62,7 @@ Screen::Screen(KyraEngine_v1 *vm, OSystem *system, const ScreenDim *dimTable, co
_16bitConversionPalette = 0;
_16bitShadingLevel = 0;
_bytesPerPixel = 1;
+ _4bitPixelPacking = false;
_currentFont = FID_8_FNT;
_paletteChanged = true;
@@ -99,6 +100,7 @@ bool Screen::init() {
_useOverlays = false;
_useSJIS = false;
_use16ColorMode = _vm->gameFlags().use16ColorMode;
+ _4bitPixelPacking = (_use16ColorMode && _vm->game() == GI_LOL);
_isAmiga = (_vm->gameFlags().platform == Common::kPlatformAmiga);
// Amiga copper palette magic requires the use of more than 32 colors for some purposes.
_useAmigaExtraColors = (_isAmiga && _vm->game() == GI_EOB2);
@@ -762,12 +764,12 @@ void Screen::setPagePixel(int pageNum, int x, int y, uint8 color) {
if (pageNum == 0 || pageNum == 1)
addDirtyRect(x, y, 1, 1);
- if (_use16ColorMode) {
+ if (_4bitPixelPacking) {
color &= 0x0F;
color |= (color << 4);
} else if (_renderMode == Common::kRenderCGA) {
color &= 0x03;
- } else if (_renderMode == Common::kRenderEGA && !_useHiResEGADithering) {
+ } else if (_use16ColorMode || (_renderMode == Common::kRenderEGA && !_useHiResEGADithering)) {
color &= 0x0F;
}
@@ -1204,12 +1206,12 @@ void Screen::fillRect(int x1, int y1, int x2, int y2, uint8 color, int pageNum,
clearOverlayRect(pageNum, x1, y1, x2-x1+1, y2-y1+1);
- if (_use16ColorMode) {
+ if (_4bitPixelPacking) {
color &= 0x0F;
color |= (color << 4);
} else if (_renderMode == Common::kRenderCGA) {
color &= 0x03;
- } else if (_renderMode == Common::kRenderEGA && !_useHiResEGADithering) {
+ } else if (_use16ColorMode || (_renderMode == Common::kRenderEGA && !_useHiResEGADithering)) {
color &= 0x0F;
} else if (_bytesPerPixel == 2)
color16 = shade16bitColor(_16bitPalette[color]);
@@ -1289,12 +1291,12 @@ void Screen::drawClippedLine(int x1, int y1, int x2, int y2, int color) {
void Screen::drawLine(bool vertical, int x, int y, int length, int color) {
uint8 *ptr = getPagePtr(_curPage) + y * SCREEN_W * _bytesPerPixel + x * _bytesPerPixel;
- if (_use16ColorMode) {
+ if (_4bitPixelPacking) {
color &= 0x0F;
color |= (color << 4);
} else if (_renderMode == Common::kRenderCGA) {
color &= 0x03;
- } else if (_renderMode == Common::kRenderEGA && !_useHiResEGADithering) {
+ } else if (_use16ColorMode || (_renderMode == Common::kRenderEGA && !_useHiResEGADithering)) {
color &= 0x0F;
} else if (_bytesPerPixel == 2)
color = shade16bitColor(_16bitPalette[color]);
@@ -3769,7 +3771,7 @@ void AMIGAFont::unload() {
}
SJISFont::SJISFont(Graphics::FontSJIS *font, const uint8 invisColor, bool is16Color, bool drawOutline, bool fatPrint, int extraSpacing)
- : _colorMap(0), _font(font), _invisColor(invisColor), _is16Color(is16Color), _drawOutline(drawOutline), _sjisWidthOffset(extraSpacing) {
+ : _colorMap(0), _font(font), _invisColor(invisColor), _isTextMode(is16Color), _drawOutline(drawOutline), _sjisWidthOffset(extraSpacing) {
assert(_font);
_font->setDrawingMode(_drawOutline ? Graphics::FontSJIS::kOutlineMode : Graphics::FontSJIS::kDefaultMode);
_font->toggleFatPrint(fatPrint);
@@ -3801,7 +3803,7 @@ int SJISFont::getCharWidth(uint16 c) const {
void SJISFont::setColorMap(const uint8 *src) {
_colorMap = src;
- if (!_is16Color) {
+ if (!_isTextMode) {
if (_colorMap[0] == _invisColor)
_font->setDrawingMode(Graphics::FontSJIS::kDefaultMode);
else
@@ -3812,7 +3814,7 @@ void SJISFont::setColorMap(const uint8 *src) {
void SJISFont::drawChar(uint16 c, byte *dst, int pitch, int) const {
uint8 color1, color2;
- if (_is16Color) {
+ if (_isTextMode) {
// PC98 16 color games specify a color value which is for the
// PC98 text mode palette, thus we need to remap it.
color1 = ((_colorMap[1] >> 5) & 0x7) + 16;
diff --git a/engines/kyra/graphics/screen.h b/engines/kyra/graphics/screen.h
index b1b2d86e48..c1a1cfefa5 100644
--- a/engines/kyra/graphics/screen.h
+++ b/engines/kyra/graphics/screen.h
@@ -313,7 +313,7 @@ protected:
private:
const uint8 _invisColor;
- const bool _is16Color;
+ const bool _isTextMode;
// We use this for cases where the font width returned by getWidth() or getCharWidth() does not match the original.
// The original Japanese game versions use hard coded sjis font widths of 8 or 9. However, this does not necessarily
// depend on whether an outline is used or not (neither LOL/PC-9801 nor LOL/FM-TOWNS use an outline, but the first
@@ -684,6 +684,7 @@ protected:
bool _useOverlays;
bool _useSJIS;
bool _use16ColorMode;
+ bool _4bitPixelPacking;
bool _useHiResEGADithering;
bool _useHiColorScreen;
bool _isAmiga;
diff --git a/engines/kyra/graphics/screen_eob.cpp b/engines/kyra/graphics/screen_eob.cpp
index 882c45c5d0..ad967fe5ed 100644
--- a/engines/kyra/graphics/screen_eob.cpp
+++ b/engines/kyra/graphics/screen_eob.cpp
@@ -65,6 +65,8 @@ Screen_EoB::Screen_EoB(EoBCoreEngine *vm, OSystem *system) : Screen(vm, system,
_useHiResEGADithering = _dualPaletteMode = false;
_cpsFileExt = 0;
_decodeTempBuffer = 0;
+ _curPalID = 0;
+ _curPal = 0;
for (int i = 0; i < 10; ++i)
_palette16c[i] = 0;
}
@@ -258,7 +260,7 @@ void Screen_EoB::loadShapeSetBitmap(const char *file, int tempPage, int destPage
}
void Screen_EoB::loadBitmap(const char *filename, int tempPage, int dstPage, Palette *pal, bool skip) {
- if (_use16ColorMode) {
+ if (!scumm_stricmp(filename + strlen(filename) - 3, "BIN")) {
Common::SeekableReadStream *str = _vm->resource()->createReadStream(filename);
if (!str)
error("Screen_EoB::loadBitmap(): Failed to load file '%s'", filename);
@@ -1568,11 +1570,25 @@ void Screen_EoB::shadeRect(int x1, int y1, int x2, int y2, int shadingLevel) {
}
void Screen_EoB::loadPC98Palette(int palID, Palette &dest) {
- if (!_palette16c[palID])
+ if (palID < 0 || palID > 9)
return;
+ if (!_use16ColorMode || !_palette16c[palID])
+ 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);
+}
+
void Screen_EoB::decodeBIN(const uint8 *src, uint8 *dst, uint16 inSize) {
const uint8 *end = src + inSize;
memset(_decodeTempBuffer, 0, 2048);
diff --git a/engines/kyra/graphics/screen_eob.h b/engines/kyra/graphics/screen_eob.h
index aaae79a13c..b457ba2c83 100644
--- a/engines/kyra/graphics/screen_eob.h
+++ b/engines/kyra/graphics/screen_eob.h
@@ -92,10 +92,13 @@ public:
// PC-98 specific
void loadPC98Palette(int palID, Palette &dest);
+ void setPC98PaletteBrightness(int modifier);
void decodeBIN(const uint8 *src, uint8 *dst, uint16 inSize);
void decodePC98PlanarBitmap(int srcDstPage, int tempPage);
uint8 *_decodeTempBuffer;
+ int _curPalID;
+ Palette *_curPal;
// Amiga specific
void loadSpecialAmigaCPS(const char *fileName, int destPage, bool isGraphics);
diff --git a/engines/kyra/gui/gui_eob.cpp b/engines/kyra/gui/gui_eob.cpp
index 2d51adb498..5b8c3c6974 100644
--- a/engines/kyra/gui/gui_eob.cpp
+++ b/engines/kyra/gui/gui_eob.cpp
@@ -1441,6 +1441,8 @@ GUI_EoB::GUI_EoB(EoBCoreEngine *vm) : GUI(vm), _vm(vm), _screen(vm->_screen) {
_highLightColorTable = _highlightColorTableAmiga;
else if (_vm->game() == GI_EOB1 && (_vm->_configRenderMode == Common::kRenderCGA || _vm->_configRenderMode == Common::kRenderEGA))
_highLightColorTable = _highlightColorTableEGA;
+ else if (_vm->game() == GI_EOB1 && _vm->gameFlags().platform == Common::kPlatformPC98)
+ _highLightColorTable = _highlightColorTablePC98;
else
_highLightColorTable = _highlightColorTableVGA;
@@ -3076,12 +3078,12 @@ int GUI_EoB::selectSaveSlotDialogue(int x, int y, int id) {
drawSaveSlotButton(newHighlight, 0, _vm->guiSettings()->colors.guiColorLightRed);
// Display highlighted slot index in the bottom left corner to avoid people getting lost with the 990 save slots
- _screen->setFont(Screen::FID_6_FNT);
+ Screen::FontId of = _screen->setFont(Screen::FID_6_FNT);
int sli = (newHighlight == 6) ? _savegameOffset : (_savegameOffset + newHighlight);
_screen->set16bitShadingLevel(4);
_screen->printText(Common::String::format("%03d/989", sli).c_str(), _saveSlotX + 5, _saveSlotY + 135, _vm->guiSettings()->colors.frame2, _vm->guiSettings()->colors.fill);
_screen->set16bitShadingLevel(0);
- _screen->setFont(Screen::FID_8_FNT);
+ _screen->setFont(of);
_screen->updateScreen();
lastHighlight = newHighlight;
@@ -4377,6 +4379,8 @@ const uint8 GUI_EoB::_highlightColorTableEGA[] = { 0x0C, 0x0D, 0x0E, 0x0F, 0x0E,
const uint8 GUI_EoB::_highlightColorTableAmiga[] = { 0x13, 0x0B, 0x12, 0x0A, 0x11, 0x09, 0x11, 0x0A, 0x12, 0x0B, 0x00 };
+const uint8 GUI_EoB::_highlightColorTablePC98[] = { 0x0C, 0x0D, 0x0E, 0x0F, 0x0E, 0x0D, 0x00 };
+
} // End of namespace Kyra
#endif // ENABLE_EOB
diff --git a/engines/kyra/gui/gui_eob.h b/engines/kyra/gui/gui_eob.h
index 0e10d56b6e..696c013594 100644
--- a/engines/kyra/gui/gui_eob.h
+++ b/engines/kyra/gui/gui_eob.h
@@ -155,6 +155,7 @@ private:
static const uint8 _highlightColorTableVGA[];
static const uint8 _highlightColorTableEGA[];
static const uint8 _highlightColorTableAmiga[];
+ static const uint8 _highlightColorTablePC98[];
// FM-Towns specific
int checkKatakanaSelection();
diff --git a/engines/kyra/resource/staticres_eob.cpp b/engines/kyra/resource/staticres_eob.cpp
index a1585c1e91..7186603df9 100644
--- a/engines/kyra/resource/staticres_eob.cpp
+++ b/engines/kyra/resource/staticres_eob.cpp
@@ -1357,6 +1357,48 @@ const uint8 EoBEngine::_monsterAcHitChanceTbl2[] = {
2, 1, 1, 1
};
+const EoBEngine::RenderModePalFile EoBEngine::_renderModePalFiles[3] = {
+ { Common::kRenderDefault, "EOBPAL.COL" },
+ { Common::kRenderVGA, "EOBPAL.COL" },
+ { -1, "" }
+};
+
+const EoBEngine::TitleScreenConfig EoBEngine::_titleConfig[3] = {
+ {
+ Common::kPlatformDOS,
+ "INTRO",
+ _renderModePalFiles,
+ -1,
+ 2,
+ false,
+ 77, 165, 173, 29, 14, 13, 12,
+ 76, 164, 175, 31, 14, 13, -1,
+ 0
+ },
+ {
+ Common::kPlatformAmiga,
+ "TITLE",
+ &_renderModePalFiles[2],
+ -1,
+ 1,
+ true,
+ 75, 165, 177, 29, 22, 28, -1,
+ 74, 164, 179, 31, 22, 28, -1,
+ 0
+ },
+ {
+ Common::kPlatformPC98,
+ "EOBTITLE",
+ &_renderModePalFiles[2],
+ 1,
+ 2,
+ false,
+ 77, 161, 173, 29, 1, 2, 12,
+ 76, 160, 175, 31, 1, 2, -1,
+ -8
+ }
+};
+
void DarkMoonEngine::initStaticResource() {
int temp;
_mainMenuStrings = _staticres->loadStrings(kEoB2MainMenuStrings, temp);
diff --git a/engines/kyra/sequence/sequences_eob.cpp b/engines/kyra/sequence/sequences_eob.cpp
index 9139a25f04..0119965d09 100644
--- a/engines/kyra/sequence/sequences_eob.cpp
+++ b/engines/kyra/sequence/sequences_eob.cpp
@@ -56,13 +56,17 @@ private:
void waterdeepExit();
void tunnel();
- void loadAndSetPalette(const char *dosPaletteFile, int pc98PaletteID = 0);
+ 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;
const char *const *_filesTower;
const char *const *_filesOrb;
@@ -71,6 +75,13 @@ private:
const char *const *_filesHands;
const char *const *_filesWdExit;
const char *const *_filesTunnel;
+ const char *const *_stringsTower;
+ const char *const *_stringsOrb;
+ const char *const *_stringsWdEntry;
+ const char *const *_stringsKing;
+ const char *const *_stringsHands;
+ const char *const *_stringsWdExit;
+ const char *const *_stringsTunnel;
const uint8 *_openingFrmDelay;
const uint8 *_wdEncodeX;
const uint8 *_wdEncodeY;
@@ -123,9 +134,10 @@ private:
};
EoBIntroPlayer::EoBIntroPlayer(EoBEngine *vm, Screen_EoB *screen) : _vm(vm), _screen(screen),
- _fillColor1(vm->gameFlags().platform == Common::kPlatformAmiga ? 19 : 12), _fillColor2(vm->gameFlags().platform == Common::kPlatformAmiga ? 10 : 157) {
+ _fillColor1(vm->gameFlags().platform == Common::kPlatformAmiga ? 19 : (vm->gameFlags().platform == Common::kPlatformPC98 ? 0 : 12)), _fillColor2(vm->gameFlags().platform == Common::kPlatformAmiga ? 10 : 157) {
int temp = 0;
_filesOpening = _vm->staticres()->loadStrings(kEoB1IntroFilesOpening, temp);
+ _lastFileOpening = temp - 2;
_filesTower = _vm->staticres()->loadStrings(kEoB1IntroFilesTower, temp);
_filesOrb = _vm->staticres()->loadStrings(kEoB1IntroFilesOrb, temp);
_filesWdEntry = _vm->staticres()->loadStrings(kEoB1IntroFilesWdEntry, temp);
@@ -133,6 +145,13 @@ EoBIntroPlayer::EoBIntroPlayer(EoBEngine *vm, Screen_EoB *screen) : _vm(vm), _sc
_filesHands = _vm->staticres()->loadStrings(kEoB1IntroFilesHands, temp);
_filesWdExit = _vm->staticres()->loadStrings(kEoB1IntroFilesWdExit, temp);
_filesTunnel = _vm->staticres()->loadStrings(kEoB1IntroFilesTunnel, temp);
+ _stringsTower = _vm->staticres()->loadStrings(kEoB1IntroStringsTower, temp);
+ _stringsOrb = _vm->staticres()->loadStrings(kEoB1IntroStringsOrb, temp);
+ _stringsWdEntry = _vm->staticres()->loadStrings(kEoB1IntroStringsWdEntry, temp);
+ _stringsKing = _vm->staticres()->loadStrings(kEoB1IntroStringsKing, temp);
+ _stringsHands = _vm->staticres()->loadStrings(kEoB1IntroStringsHands, temp);
+ _stringsWdExit = _vm->staticres()->loadStrings(kEoB1IntroStringsWdExit, temp);
+ _stringsTunnel = _vm->staticres()->loadStrings(kEoB1IntroStringsTunnel, temp);
_openingFrmDelay = _vm->staticres()->loadRawData(kEoB1IntroOpeningFrmDelay, temp);
_wdEncodeX = _vm->staticres()->loadRawData(kEoB1IntroWdEncodeX, temp);
_wdEncodeY = _vm->staticres()->loadRawData(kEoB1IntroWdEncodeY, temp);
@@ -147,6 +166,7 @@ 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) {
@@ -173,6 +193,8 @@ void EoBIntroPlayer::start(int part) {
s->seek(768);
_screen->loadFileDataToPage(s, 5, s->size() - 768);
delete s;
+ } else if (_vm->gameFlags().platform == Common::kPlatformPC98) {
+ _screen->clearPage(5);
} else {
_screen->loadBitmap(_vm->gameFlags().platform == Common::kPlatformAmiga ? "TEXT.CPS" : (_vm->gameFlags().platform == Common::kPlatformPC98 ? "TEXT.BIN" : "TEXT.CMP"), 3, 5, 0);
}
@@ -190,6 +212,7 @@ void EoBIntroPlayer::start(int part) {
tunnel();
whirlTransition();
+
_vm->snd_stopSound();
_vm->_allowSkip = false;
}
@@ -198,23 +221,29 @@ void EoBIntroPlayer::openingCredits() {
if (_vm->gameFlags().platform != Common::kPlatformPC98)
_vm->snd_playSong(1);
- _screen->loadBitmap(_filesOpening[4], 5, 3, 0);
+ _screen->loadBitmap(_filesOpening[_lastFileOpening], 5, 3, 0);
_screen->convertPage(3, 0, _vm->_cgaMappingAlt);
- if (_vm->gameFlags().platform == Common::kPlatformAmiga) {
- _screen->fadeFromBlack(64);
- } else {
+ if (_vm->gameFlags().platform == Common::kPlatformPC98)
+ _screen->loadPC98Palette(1, _screen->getPalette(0));
+
+ if (_vm->gameFlags().platform == Common::kPlatformDOS) {
loadAndSetPalette(_filesOpening[5], 1);
_screen->updateScreen();
+ } else {
+ _screen->fadeFromBlack(64);
}
_vm->delay(_openingFrmDelay[0] * _vm->_tickLength);
- for (int i = 0; i < 4 && !_vm->shouldQuit() && !_vm->skipFlag(); i++) {
+ for (int i = 0; i < _lastFileOpening && !_vm->shouldQuit() && !_vm->skipFlag(); i++) {
_screen->loadBitmap(_filesOpening[i], 5, 3, 0);
uint32 nextFrameTimer = _vm->_system->getMillis() + _openingFrmDelay[i + 1] * _vm->_tickLength;
_screen->convertPage(3, 4, _vm->_cgaMappingAlt);
- _screen->crossFadeRegion(0, 50, 0, 50, 320, 102, 4, 0);
+ if (i == 5)
+ _screen->crossFadeRegion(0, 0, 0, 0, 320, 200, 4, 0);
+ else
+ _screen->crossFadeRegion(0, 50, 0, 50, 320, 102, 4, 0);
_vm->delayUntil(nextFrameTimer);
}
@@ -222,6 +251,11 @@ void EoBIntroPlayer::openingCredits() {
_vm->delay(50 * _vm->_tickLength);
}
+#define printSub(stringArray, index, x, y, col, mode) if (stringArray) printSubtitle(stringArray[index], x, y, col, mode)
+#define displaySubtitle(gfxTitleSrcY, gfxTitleDstY, gfxTitleH, stringArray, index, x, y, col, mode) \
+ printSub(stringArray, index, x, y, col, mode); \
+ else _screen->copyRegion(0, gfxTitleSrcY, 0, gfxTitleDstY, 320, gfxTitleH, 6, 0, Screen::CR_NO_P_CHECK)
+
void EoBIntroPlayer::tower() {
if (_vm->shouldQuit() || _vm->skipFlag())
return;
@@ -240,8 +274,9 @@ void EoBIntroPlayer::tower() {
int cp = _screen->setCurPage(0);
whirlTransition();
- loadAndSetPalette(_filesTower[0]);
+ loadAndSetPalette(_filesTower[0], 0);
+ _screen->setPC98PaletteBrightness(-15);
_screen->setCurPage(cp);
_screen->clearCurPage();
@@ -250,16 +285,20 @@ void EoBIntroPlayer::tower() {
_screen->setCurPage(0);
+ displaySubtitle(0, 168, 32, _stringsTower, 0, 17, 22, 0xE1, 2);
+ printSub(_stringsTower, 1, 13, 24, 0xE1, 2);
+
for (int i = 0; i < 64 && !_vm->shouldQuit() && !_vm->skipFlag(); i += 2) {
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);
- if (!i)
- _screen->copyRegion(0, 0, 0, 168, 320, 32, 6, 0, Screen::CR_NO_P_CHECK);
+ _screen->setPC98PaletteBrightness(MIN(i / 4 - 14, 0));
_screen->updateScreen();
_vm->delayUntil(end);
}
+ _screen->setPC98PaletteBrightness(0);
+
for (int i = 0; i < 24 && !_vm->shouldQuit() && !_vm->skipFlag(); i += 2) {
uint32 end = _vm->_system->getMillis() + 2 * _vm->_tickLength;
_screen->copyRegion(0, 79 - i, 96, 0, 24, 65 + i, 4, 0, Screen::CR_NO_P_CHECK);
@@ -293,7 +332,8 @@ void EoBIntroPlayer::tower() {
_vm->delayUntil(end);
}
- _screen->copyRegion(0, 32, 0, 168, 320, 32, 6, 0, Screen::CR_NO_P_CHECK);
+ _screen->fillRect(0, 168, 319, 199, _fillColor1);
+ displaySubtitle(32, 168, 32, _stringsTower, 2, 20, 23, 0xE1, 0);
_screen->updateScreen();
_vm->delay(65 * _vm->_tickLength);
delete[] shp;
@@ -320,9 +360,9 @@ void EoBIntroPlayer::orb() {
_screen->setCurPage(0);
_screen->convertPage(3, 4, _vm->_cgaMappingAlt);
- if (_vm->gameFlags().platform == Common::kPlatformAmiga) {
+ if (_vm->gameFlags().platform != Common::kPlatformDOS) {
_screen->fadeToBlack(16);
- loadAndSetPalette(0);
+ loadAndSetPalette(0, 0);
}
_screen->clearCurPage();
@@ -341,7 +381,7 @@ void EoBIntroPlayer::orb() {
_vm->delayUntil(end);
}
- _screen->copyRegion(0, 64, 0, 168, 320, 16, 6, 0, Screen::CR_NO_P_CHECK);
+ displaySubtitle(64, 168, 16, _stringsOrb, 0, 32, 23, 0xE1, 0);
_screen->updateScreen();
if (_vm->gameFlags().platform == Common::kPlatformAmiga) {
@@ -381,7 +421,8 @@ void EoBIntroPlayer::waterdeepEntry() {
uint8 *shp2[31];
uint8 *shp3[3];
- loadAndSetPalette(_filesWdEntry[0]);
+ if (_vm->gameFlags().platform != Common::kPlatformPC98)
+ loadAndSetPalette(_filesWdEntry[0], -1);
_screen->loadBitmap(_filesWdEntry[1], 5, 3, 0);
if (_vm->gameFlags().platform == Common::kPlatformAmiga)
@@ -408,7 +449,8 @@ void EoBIntroPlayer::waterdeepEntry() {
_vm->delayUntil(end);
}
- _screen->copyRegion(0, 80, 0, 168, 320, 16, 6, 0, Screen::CR_NO_P_CHECK);
+ displaySubtitle(80, 168, 16, _stringsWdEntry, 0, 21, 23, 0xE1, 0);
+
_screen->updateScreen();
_vm->delay(50 * _vm->_tickLength);
@@ -485,9 +527,9 @@ void EoBIntroPlayer::king() {
_screen->loadBitmap(_filesKing[0], 5, 3, 0);
_screen->convertPage(3, 4, _vm->_cgaMappingAlt);
- if (_vm->gameFlags().platform == Common::kPlatformAmiga) {
+ if (_vm->gameFlags().platform != Common::kPlatformDOS) {
_screen->fadeToBlack(32);
- loadAndSetPalette(0);
+ loadAndSetPalette(0, 3);
}
int x = 15;
@@ -561,7 +603,7 @@ void EoBIntroPlayer::king() {
_vm->delayUntil(end);
}
- _screen->copyRegion(0, 96, 0, 160, 320, 32, 6, 0, Screen::CR_NO_P_CHECK);
+ displaySubtitle(96, 160, 32, _stringsKing, 0, 10, 24, 0xE1, 0);
_screen->updateScreen();
_vm->delay(70 * _vm->_tickLength);
@@ -574,10 +616,16 @@ void EoBIntroPlayer::hands() {
return;
_screen->setCurPage(2);
+ _screen->clearPage(0);
uint8 *shp1 = _screen->encodeShape(0, 140, 21, 60, true, _vm->_cgaMappingAlt);
uint8 *shp2 = _screen->encodeShape(21, 140, 12, 60, true, _vm->_cgaMappingAlt);
_screen->loadBitmap(_filesHands[0], 3, 5, 0);
+ if (_vm->gameFlags().platform == Common::kPlatformPC98) {
+ _screen->fadeToBlack(32);
+ loadAndSetPalette(0, 2);
+ }
+
if (_vm->gameFlags().platform == Common::kPlatformAmiga)
_vm->delay(60 * _vm->_tickLength);
@@ -586,7 +634,8 @@ void EoBIntroPlayer::hands() {
_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);
- _screen->copyRegion(0, 128, 0, 176, 320, 16, 6, 0, Screen::CR_NO_P_CHECK);
+
+ displaySubtitle(128, 176, 16, _stringsHands, 0, 24, 23, 0xE1, 0);
_screen->updateScreen();
_vm->delay(15 * _vm->_tickLength);
@@ -778,10 +827,10 @@ void EoBIntroPlayer::waterdeepExit() {
_screen->loadBitmap(_filesWdExit[2], 3, dstPage, 0);
_screen->convertPage(dstPage, 2, _vm->_cgaMappingAlt);
whirlTransition();
- loadAndSetPalette(_filesWdExit[1]);
+ loadAndSetPalette(_filesWdExit[1], 0);
_vm->delay(6 * _vm->_tickLength);
- _screen->copyRegion(0, 144, 0, 184, 320, 16, 6, 0, Screen::CR_NO_P_CHECK);
+ displaySubtitle(144, 184, 16, _stringsWdExit, 0, 24, 23, 0xE1, 0);
cx = 0;
cy = 136;
@@ -799,7 +848,9 @@ void EoBIntroPlayer::waterdeepExit() {
_vm->delayUntil(end);
}
- _vm->snd_playSong(3);
+ if (_vm->gameFlags().platform != Common::kPlatformPC98)
+ _vm->snd_playSong(3);
+
_vm->delay(60 * _vm->_tickLength);
for (int i = 0; i < 56 && !_vm->shouldQuit() && !_vm->skipFlag(); i++) {
@@ -824,7 +875,7 @@ void EoBIntroPlayer::waterdeepExit() {
_screen->fillRect(0, 16, 319, 31, _fillColor1);
_screen->fillRect(0, 136, 319, 199, _fillColor1);
_screen->copyRegion(0, 0, 80, 32, 160, 120, 2, 0, Screen::CR_NO_P_CHECK);
- loadAndSetPalette(_filesWdExit[4]);
+ loadAndSetPalette(_filesWdExit[4], 0);
_screen->updateScreen();
_vm->delay(50 * _vm->_tickLength);
}
@@ -854,8 +905,10 @@ void EoBIntroPlayer::tunnel() {
_vm->delayUntil(end);
}
+ // subtitle "We have them" - the PC-98 version does not have this string.
_screen->copyRegion(0, 160, 0, 184, 320, 16, 6, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
+
_vm->delay(18 * _vm->_tickLength);
_screen->copyRegion(160, 0, 80, 32, 160, 120, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
@@ -922,10 +975,12 @@ void EoBIntroPlayer::tunnel() {
_vm->delay(2 * _vm->_tickLength);
_screen->copyRegion(0, 120, 80, 30, 160, 64, 4, 0, Screen::CR_NO_P_CHECK);
_screen->copyRegion(160, 120, 80, 94, 160, 64, 4, 0, Screen::CR_NO_P_CHECK);
- _screen->copyRegion(0, 176, 0, 184, 320, 16, 6, 0, Screen::CR_NO_P_CHECK);
+
+ displaySubtitle(176, 184, 16, _stringsTunnel, 0, 27, 23, 0xE1, 0);
+
_screen->setCurPage(0);
_screen->updateScreen();
- _vm->delay(50 * _vm->_tickLength);
+ _vm->delay((_vm->gameFlags().platform == Common::kPlatformPC98 ? 130 : 50) * _vm->_tickLength);
}
void EoBIntroPlayer::loadAndSetPalette(const char *dosPaletteFile, int pc98PaletteID) {
@@ -934,7 +989,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)
+ else if (_vm->gameFlags().platform == Common::kPlatformPC98 && pc98PaletteID >= 0)
_screen->loadPC98Palette(pc98PaletteID, _screen->getPalette(0));
_screen->getPalette(0).fill(0, 1, 0);
@@ -1010,13 +1065,13 @@ void EoBIntroPlayer::whirlTransition() {
for (int i = 0; i < 2; i++) {
for (int ii = 0; ii < 8; ii++) {
- uint32 e = _vm->_system->getMillis() + 3;
+ uint32 e = _vm->_system->getMillis() + 16;
if (ii & 1) {
for (int iii = i + ii; iii < 320; iii += 8)
- _screen->drawClippedLine(iii, 0, iii, 199, 12);
+ _screen->drawClippedLine(iii, 0, iii, 199, _fillColor1);
} else {
for (int iii = i + ii; iii < 200; iii += 8)
- _screen->drawClippedLine(0, iii, 319, iii, 12);
+ _screen->drawClippedLine(0, iii, 319, iii, _fillColor1);
}
_screen->updateScreen();
uint32 c = _vm->_system->getMillis();
@@ -1026,6 +1081,57 @@ 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;
+
+ 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->setCurPage(cp);
+}
+
EoBAmigaFinalePlayer::EoBAmigaFinalePlayer(EoBEngine *vm, Screen_EoB *screen) : _vm(vm), _screen(screen) {
_animCurFrame = 0;
int size = 0;
@@ -1430,37 +1536,38 @@ void EoBAmigaFinalePlayer::playDialogue(int line, bool withAnim) {
int EoBEngine::mainMenu() {
int menuChoice = _menuChoiceInit;
_menuChoiceInit = 0;
-
Screen::FontId of = _screen->_currentFont;
while (menuChoice >= 0 && !shouldQuit()) {
switch (menuChoice) {
case 0: {
- if (_flags.platform == Common::kPlatformAmiga) {
+ if (_ttlCfg->fade)
_screen->fadeToBlack(10);
- _screen->loadEoBBitmap("TITLE", 0, 5, 3, 1);
+
+ _screen->loadPC98Palette(_ttlCfg->pc98PaletteID, _screen->getPalette(0));
+ for (int i = 0; i < 3; ++i) {
+ if (_ttlCfg->palFiles[i].renderMode == -1)
+ break;
+ if (_configRenderMode == (Common::RenderMode)_ttlCfg->palFiles[i].renderMode)
+ _screen->loadPalette(_ttlCfg->palFiles[i].filename, _screen->getPalette(0));
+ }
+
+ _screen->loadEoBBitmap(_ttlCfg->bmpFile, _cgaMappingDefault, 5, 3, _ttlCfg->page);
+
+ if (_ttlCfg->fade)
_screen->fadeFromBlack(10);
- } else {
- if (_configRenderMode != Common::kRenderEGA)
- _screen->loadPalette("EOBPAL.COL", _screen->getPalette(0));
- _screen->loadEoBBitmap("INTRO", _cgaMappingDefault, 5, 3, 2);
+ else
_screen->setScreenPalette(_screen->getPalette(0));
- }
_screen->_curPage = 2;
of = _screen->setFont(Screen::FID_6_FNT);
Common::String versionString(Common::String::format("ScummVM %s", gScummVMVersion));
- _screen->printText(versionString.c_str(), 280 - versionString.size() * 6, 153, _screen->getPagePixel(2, 0, 0), 0);
+ _screen->printText(versionString.c_str(), 280 - versionString.size() * 6, 153 + _ttlCfg->versionStrYOffs, _screen->getPagePixel(2, 0, 0), 0);
_screen->setFont(of);
- _screen->fillRect(0, 159, 319, 199, _screen->getPagePixel(2, 0, 0));
+ _screen->fillRect(0, 159 + _ttlCfg->versionStrYOffs, 319, 199, _screen->getPagePixel(2, 0, 0));
- if (_flags.platform == Common::kPlatformAmiga) {
- gui_drawBox(75, 165, 177, 29, 22, 28, -1);
- gui_drawBox(74, 164, 179, 31, 22, 28, -1);
- } else {
- gui_drawBox(77, 165, 173, 29, 14, 13, 12);
- gui_drawBox(76, 164, 175, 31, 14, 13, -1);
- }
+ gui_drawBox(_ttlCfg->menu1X, _ttlCfg->menu1Y, _ttlCfg->menu1W, _ttlCfg->menu1H, _ttlCfg->menu1col1, _ttlCfg->menu1col2, _ttlCfg->menu1col3);
+ gui_drawBox(_ttlCfg->menu2X, _ttlCfg->menu2Y, _ttlCfg->menu2W, _ttlCfg->menu2H, _ttlCfg->menu2col1, _ttlCfg->menu2col2, _ttlCfg->menu2col3);
_screen->_curPage = 0;
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK);
@@ -1490,9 +1597,11 @@ int EoBEngine::mainMenu() {
_screen->showMouse();
_sound->selectAudioResourceSet(kMusicIngame);
_sound->loadSoundFile(0);
+ resetSkipFlag();
+ _eventList.clear();
}
- menuChoice = -2;
+ menuChoice = shouldQuit() ? -5 : -2;
break;
case 3:
@@ -1702,6 +1811,9 @@ void EoBEngine::boxMorphTransition(int targetDestX, int targetDestY, int targetF
}
}
+#undef displaySubtitle
+#undef printSub
+
} // End of namespace Kyra
#endif // ENABLE_EOB