aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOystein Eftevaag2006-04-17 17:39:08 +0000
committerOystein Eftevaag2006-04-17 17:39:08 +0000
commitbdd5a25c16096604fa3001900699e2e8cec9cced (patch)
treedd70d2cf63140543ba73d4e0734d163eb6a0c9d2
parentac24769196e238485e9c365af3469db8a03b564a (diff)
downloadscummvm-rg350-bdd5a25c16096604fa3001900699e2e8cec9cced.tar.gz
scummvm-rg350-bdd5a25c16096604fa3001900699e2e8cec9cced.tar.bz2
scummvm-rg350-bdd5a25c16096604fa3001900699e2e8cec9cced.zip
Implements the end credits, and disables fast forwarding in the intro.
svn-id: r21980
-rw-r--r--engines/kyra/kyra.cpp3
-rw-r--r--engines/kyra/screen.h2
-rw-r--r--engines/kyra/sequences_v1.cpp138
3 files changed, 135 insertions, 8 deletions
diff --git a/engines/kyra/kyra.cpp b/engines/kyra/kyra.cpp
index bb3a445c24..c3376b5cac 100644
--- a/engines/kyra/kyra.cpp
+++ b/engines/kyra/kyra.cpp
@@ -817,6 +817,9 @@ void KyraEngine::delay(uint32 amount, bool update, bool isMainLoop) {
updateKyragemFading();
}
+ if (_skipFlag && !_abortIntroFlag && !queryGameFlag(0xFE))
+ _skipFlag = false;
+
if (amount > 0 && !_skipFlag) {
_system->delayMillis((amount > 10) ? 10 : amount);
}
diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h
index 22586e4c01..b3fed26413 100644
--- a/engines/kyra/screen.h
+++ b/engines/kyra/screen.h
@@ -170,6 +170,7 @@ public:
int _curPage;
uint8 *_currentPalette;
uint8 *_shapePages[2];
+ FontId _currentFont;
const ScreenDim *_curDim;
@@ -186,7 +187,6 @@ private:
uint8 *_saveLoadPage[8];
uint8 *_screenPalette;
uint8 *_palettes[3];
- FontId _currentFont;
Font _fonts[FID_NUM];
uint8 _textColorsMap[16];
uint8 *_decodeShapeBuffer;
diff --git a/engines/kyra/sequences_v1.cpp b/engines/kyra/sequences_v1.cpp
index 2e68e1966f..112944dc41 100644
--- a/engines/kyra/sequences_v1.cpp
+++ b/engines/kyra/sequences_v1.cpp
@@ -998,24 +998,148 @@ void KyraEngine::seq_playEnding() {
void KyraEngine::seq_playCredits() {
debugC(9, kDebugLevelMain, "KyraEngine::seq_playCredits()");
static const uint8 colorMap[] = { 0, 0, 0xC, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+ static const char stringTerms[] = { 0x5, 0xd, 0x0};
+ static const int numStrings = 250;
+
+ struct {
+ int16 x, y;
+ uint8 code;
+ uint8 unk1;
+ Screen::FontId font;
+ uint8 *str;
+ } strings[numStrings];
+
+ memset(strings, 0, sizeof(strings));
+
_screen->hideMouse();
uint32 sz = 0;
if (_features & GF_FLOPPY) {
_screen->loadFont(Screen::FID_CRED6_FNT, _res->fileData("CREDIT6.FNT", &sz));
_screen->loadFont(Screen::FID_CRED8_FNT, _res->fileData("CREDIT8.FNT", &sz));
- }
- loadBitmap("CHALET.CPS", 2, 2, _screen->_currentPalette);
+ } else
+ _screen->setFont(Screen::FID_8_FNT);
+
+ loadBitmap("CHALET.CPS", 4, 4, _screen->_currentPalette);
_screen->setScreenPalette(_screen->_currentPalette);
+
_screen->setCurPage(0);
_screen->clearCurPage();
- _screen->copyRegion(8, 8, 8, 8, 304, 128, 2, 0);
_screen->setTextColorMap(colorMap);
_screen->_charWidth = -1;
snd_playWanderScoreViaMap(53, 1);
- // delete
- _screen->updateScreen();
- // XXX
- delay(120 * _tickLength); // wait until user presses escape normally
+
+ uint8 *buffer = 0;
+ uint32 size;
+
+ if (_features & GF_FLOPPY) {
+ Common::File file;
+ if (file.open("CREDITS.TXT")) {
+ size = file.size();
+ buffer = new uint8[size];
+ file.read(buffer, size);
+ file.close();
+ }
+ } else {
+ buffer = _res->fileData("CREDITS.TXT", &size);
+ }
+
+ assert(buffer);
+
+ uint8 *nextString = buffer;
+ uint8 *currentString = buffer;
+ int currentY = 200;
+
+ for (int i = 0; i < numStrings; i++) {
+ if (*nextString == 0)
+ break;
+
+ currentString = nextString;
+ nextString = (uint8 *)strpbrk((const char *)currentString, stringTerms);
+ if (!nextString)
+ nextString = (uint8 *)strchr((const char *)currentString, 0);
+
+ strings[i].code = nextString[0];
+ *nextString = 0;
+ if (strings[i].code != 0)
+ nextString++;
+
+ if (*currentString == 3 || *currentString == 4) {
+ strings[i].unk1 = *currentString;
+ currentString++;
+ }
+
+ if (*currentString == 1) {
+ currentString++;
+ if (_features & GF_FLOPPY)
+ _screen->setFont(Screen::FID_CRED6_FNT);
+ } else {
+ if (*currentString == 2)
+ currentString++;
+ if (_features & GF_FLOPPY)
+ _screen->setFont(Screen::FID_CRED8_FNT);
+ }
+ strings[i].font = _screen->_currentFont;
+
+ if (strings[i].unk1 == 3)
+ strings[i].x = 157 - _screen->getTextWidth((const char *)currentString);
+ else if (strings[i].unk1 == 4)
+ strings[i].x = 161;
+ else
+ strings[i].x = (320 - _screen->getTextWidth((const char *)currentString)) / 2 + 1;
+
+ strings[i].y = currentY;
+ if (strings[i].code != 5)
+ currentY += 10;
+
+ strings[i].str = currentString;
+ }
+
+ _screen->setCurPage(2);
+
+ OSystem::Event event;
+ bool finished = false;
+ int bottom = 201;
+ uint32 startLoop, waitTime;
+ while (!finished) {
+ startLoop = _system->getMillis();
+ if (bottom > 175) {
+ _screen->copyRegion(8, 32, 8, 32, 312, 128, 4, 2);
+ bottom = 0;
+
+ for (int i = 0; i < numStrings; i++) {
+ if (strings[i].y < 200 && strings[i].y > 0) {
+ if (strings[i].font != _screen->_currentFont)
+ _screen->setFont(strings[i].font);
+ _screen->printText((const char *)strings[i].str, strings[i].x, strings[i].y, 15, 0);
+ }
+ strings[i].y--;
+ if (strings[i].y > bottom)
+ bottom = strings[i].y;
+ }
+ _screen->copyRegion(8, 32, 8, 32, 312, 128, 2, 0);
+ _screen->updateScreen();
+ }
+
+ while (_system->pollEvent(event)) {
+ switch (event.type) {
+ case OSystem::EVENT_KEYDOWN:
+ finished = true;
+ break;
+ case OSystem::EVENT_QUIT:
+ quitGame();
+ break;
+ default:
+ break;
+ }
+ }
+
+ waitTime = startLoop + _tickLength * 5 - _system->getMillis();
+ if (waitTime > 0)
+ _system->delayMillis(waitTime);
+ }
+
+ delete[] buffer;
+
_screen->fadeToBlack();
_screen->clearCurPage();
_screen->showMouse();