aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorOystein Eftevaag2006-08-27 12:30:38 +0000
committerOystein Eftevaag2006-08-27 12:30:38 +0000
commitd11e72a168f68d33fce1c3f4ed0b10845c90b285 (patch)
tree739007f30002a821b20252c730c2033186b420a7 /engines
parent7649160dde01b5d74335e198d43d22188d6b54c6 (diff)
downloadscummvm-rg350-d11e72a168f68d33fce1c3f4ed0b10845c90b285.tar.gz
scummvm-rg350-d11e72a168f68d33fce1c3f4ed0b10845c90b285.tar.bz2
scummvm-rg350-d11e72a168f68d33fce1c3f4ed0b10845c90b285.zip
Adds voice/chats to the intro, and adds debug strings to the function calls.
svn-id: r23789
Diffstat (limited to 'engines')
-rw-r--r--engines/kyra/kyra2.cpp9
-rw-r--r--engines/kyra/kyra2.h30
-rw-r--r--engines/kyra/screen.cpp8
-rw-r--r--engines/kyra/screen.h2
-rw-r--r--engines/kyra/sequences_v2.cpp210
-rw-r--r--engines/kyra/staticres.cpp94
-rw-r--r--engines/kyra/text.cpp32
-rw-r--r--engines/kyra/text.h5
8 files changed, 317 insertions, 73 deletions
diff --git a/engines/kyra/kyra2.cpp b/engines/kyra/kyra2.cpp
index a4c74ad21d..4737de59dd 100644
--- a/engines/kyra/kyra2.cpp
+++ b/engines/kyra/kyra2.cpp
@@ -45,13 +45,18 @@ int KyraEngine_v2::init() {
KyraEngine::init();
_screen->loadFont(Screen::FID_6_FNT, "6.FNT");
_screen->loadFont(Screen::FID_8_FNT, "8FAT.FNT");
- _screen->loadFont(Screen::FID_BOOKFONT_FNT, "BOOKFONT.FNT");
+ _screen->loadFont(Screen::FID_GOLDFONT_FNT, "GOLDFONT.FNT");
_screen->setAnimBlockPtr(3500);
_screen->setScreenDim(0);
_mouseSHPBuf = _res->fileData("PWGMOUSE.SHP", 0);
assert(_mouseSHPBuf);
+ assert(_introStringsSize == 21);
+ for (int i = 0; i < 21; i++) {
+ _introStringsDuration[i] = strlen(_introStrings[i]) * 8;
+ }
+
for (int i = 0; i < 2; i++) {
_gameShapes[i] = _screen->getPtrToShape(_mouseSHPBuf, i);
assert(_gameShapes[i]);
@@ -83,7 +88,7 @@ void KyraEngine_v2::mainMenu() {
case 0:
break;
case 1:
- seq_playSequences(kSequenceOverview);
+ seq_playSequences(kSequenceOverview, kSequenceLibrary);
break;
case 2:
break;
diff --git a/engines/kyra/kyra2.h b/engines/kyra/kyra2.h
index 3f0122cd67..f7c894039c 100644
--- a/engines/kyra/kyra2.h
+++ b/engines/kyra/kyra2.h
@@ -29,7 +29,8 @@ enum kSequences {
kSequenceVirgin = 0,
kSequenceWestwood = 1,
kSequenceTitle = 2,
- kSequenceOverview = 3
+ kSequenceOverview = 3,
+ kSequenceLibrary = 4
};
class WSAMovieV2;
@@ -40,6 +41,17 @@ struct ActiveWSA {
uint16 endFrame;
uint16 frameDelay;
uint32 nextFrame;
+ void (KyraEngine_v2::*callback)(int);
+};
+
+struct ActiveChat {
+ uint16 strIndex;
+ uint16 x;
+ uint16 y;
+ int duration;
+ uint16 field_8;
+ uint16 startTime;
+ uint16 field_E;
};
struct Sequence {
@@ -67,14 +79,24 @@ private:
int seq_introWestwood(int seqNum);
int seq_introTitle(int seqNum);
int seq_introOverview(int seqNum);
- void seq_loadWSA(int wsaNum, const char *filename, int frameDelay);
+ int seq_introLibrary(int seqNum);
+ void seq_introOverviewOver1(int currentFrame);
+ void seq_introOverviewForest(int currentFrame);
+ void seq_introOverviewDragon(int currentFrame);
+ void seq_loadWSA(int wsaNum, const char *filename, int frameDelay, void (KyraEngine_v2::*callback)(int) = 0 );
void seq_unloadWSA(int wsaNum);
void seq_playWSAs();
-
+ void seq_showChats();
+ void seq_playIntroChat(uint8 chatNum);
+ void seq_resetAllChatEntries();
+ void seq_waitForChatsToFinish();
+ void seq_setChatEntry(uint16 strIndex, uint16 posX, uint16 posY, int duration, uint16 unk1);
+
void mainMenu();
int init();
ActiveWSA *_activeWSA;
+ ActiveChat *_activeChat;
uint8 *_gameShapes[50];
uint8 *_mouseSHPBuf;
@@ -83,6 +105,8 @@ private:
static const char *_introStrings[];
static const int _introStringsSize;
+ int _introStringsDuration[21];
+
};
} // end of namespace Kyra
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp
index b01116ce3a..de0a317aec 100644
--- a/engines/kyra/screen.cpp
+++ b/engines/kyra/screen.cpp
@@ -381,6 +381,14 @@ void Screen::copyRegionToBuffer(int pageNum, int x, int y, int w, int h, uint8 *
}
}
+void Screen::copyPage(uint8 srcPage, uint8 dstPage) {
+ debugC(9, kDebugLevelScreen, "Screen::copyPage(%d, %d)", srcPage, dstPage);
+
+ uint8 *src = getPagePtr(srcPage);
+ uint8 *dst = getPagePtr(dstPage);
+ memcpy(dst, src, SCREEN_W * SCREEN_H);
+}
+
void Screen::copyBlockToPage(int pageNum, int x, int y, int w, int h, const uint8 *src) {
debugC(9, kDebugLevelScreen, "Screen::copyBlockToPage(%d, %d, %d, %d, %d, %p)", pageNum, x, y, w, h, (const void *)src);
assert(x >= 0 && x < Screen::SCREEN_W && y >= 0 && y < Screen::SCREEN_H);
diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h
index 01e8b03437..48deaf8400 100644
--- a/engines/kyra/screen.h
+++ b/engines/kyra/screen.h
@@ -84,6 +84,7 @@ public:
FID_CRED6_FNT,
FID_CRED8_FNT,
FID_BOOKFONT_FNT,
+ FID_GOLDFONT_FNT,
FID_NUM
};
@@ -108,6 +109,7 @@ public:
void setScreenPalette(const uint8 *palData);
void copyToPage0(int y, int h, uint8 page, uint8 *seqBuf);
void copyRegion(int x1, int y1, int x2, int y2, int w, int h, int srcPage, int dstPage, int flags=0);
+ void copyPage(uint8 srcPage, uint8 dstPage);
void copyBlockToPage(int pageNum, int x, int y, int w, int h, const uint8 *src);
void copyFromCurPageBlock(int x, int y, int w, int h, const uint8 *src);
void copyCurPageBlock(int x, int y, int w, int h, uint8 *dst);
diff --git a/engines/kyra/sequences_v2.cpp b/engines/kyra/sequences_v2.cpp
index e94b850e8d..3475b75bd5 100644
--- a/engines/kyra/sequences_v2.cpp
+++ b/engines/kyra/sequences_v2.cpp
@@ -25,43 +25,54 @@
#include "kyra/screen.h"
#include "kyra/wsamovie.h"
#include "kyra/sound.h"
+#include "kyra/text.h"
#include "common/system.h"
namespace Kyra {
void KyraEngine_v2::seq_playSequences(int startSeq, int endSeq) {
+ debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_playSequences(%i, %i)", startSeq, endSeq);
+
if (endSeq == -1)
endSeq = startSeq;
- assert(startSeq >= 0 && endSeq < 4 && startSeq <= endSeq);
-
static const Sequence sequences[] = {
- // type, filename, callback, framedelay, duration, numframes, fadeOut, timeOut
+ // type, filename, callback, framedelay, duration, numframes, timeOut, fadeOut
{2, "virgin.cps", 0, 100, 0, 1, true, true},
{1, "westwood.wsa", &KyraEngine_v2::seq_introWestwood, 6, 160, 18, true, true},
- {1, "title.wsa", &KyraEngine_v2::seq_introTitle, 6, 10, 26, false, false},
- {2, "over.cps", &KyraEngine_v2::seq_introOverview, 16, 30, 1, false, true}
+ {1, "title.wsa", &KyraEngine_v2::seq_introTitle, 6, 10, 26, false, false},
+ {2, "over.cps", &KyraEngine_v2::seq_introOverview, 16, 30, 1, false, true},
+ {2, "library.cps", &KyraEngine_v2::seq_introLibrary, 16, 30, 1, false, true}
};
+ assert(startSeq >= 0 && endSeq < ARRAYSIZE(sequences) && startSeq <= endSeq);
+
_activeWSA = new ActiveWSA[8];
assert(_activeWSA);
memset(_activeWSA, 0, sizeof(ActiveWSA) * 8);
- _screen->hideMouse();
+ _activeChat = new ActiveChat[10];
+ assert(_activeChat);
+ memset(_activeChat, 0, sizeof(ActiveChat) * 10);
+
+ seq_resetAllChatEntries();
+ _screen->hideMouse();
+ int oldPage = _screen->setCurPage(2);
+
uint8 pal[768];
memset(pal, 0, sizeof(pal));
- _screen->setScreenPalette(pal);
for (int i = startSeq; i <= endSeq; i++) {
uint32 seqDelay = 0;
int seqNum = 0;
+ _screen->setScreenPalette(pal);
_screen->clearPage(0);
if (sequences[i].type == 2) {
- _screen->loadBitmap(sequences[i].filename, 0, 0, _screen->_currentPalette);
+ _screen->loadBitmap(sequences[i].filename, 2, 2, _screen->_currentPalette);
_screen->updateScreen();
seqDelay = sequences[i].frameDelay * _tickLength;
} else if(sequences[i].type == 1) {
@@ -73,13 +84,14 @@ void KyraEngine_v2::seq_playSequences(int startSeq, int endSeq) {
(*this.*sequences[i].callback)(seqNum++);
seq_playWSAs();
+ _screen->copyPage(2, 0);
_screen->updateScreen();
_screen->fadeFromBlack(40);
seqDelay += _system->getMillis();
bool mayEndLoop = sequences[i].timeOut;
- while(1) {
+ while(!_quitFlag && !_skipFlag) {
uint32 startTime = _system->getMillis();
if (sequences[i].callback) {
@@ -91,6 +103,8 @@ void KyraEngine_v2::seq_playSequences(int startSeq, int endSeq) {
}
seq_playWSAs();
+ _screen->copyPage(2, 0);
+ seq_showChats();
_screen->updateScreen();
uint32 currTime = _system->getMillis();
@@ -107,29 +121,73 @@ void KyraEngine_v2::seq_playSequences(int startSeq, int endSeq) {
if (sequences[i].type == 1)
seq_unloadWSA(0);
+
+ _screen->clearPage(2);
+
}
+ _screen->setCurPage(oldPage);
_screen->showMouse();
+
+ for (int i = 0; i < 8; i++)
+ seq_unloadWSA(i);
delete[] _activeWSA;
+ delete[] _activeChat;
+}
+
+int KyraEngine_v2::seq_introLibrary(int seqNum) {
+ debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_introLibrary(%i)", seqNum);
+
+ switch (seqNum) {
+ case 0:
+ _sound->playTrack(5);
+ seq_playIntroChat(4);
+ //XXX: palette stuff
+ break;
+ case 1:
+ // XXX: frame control sequence
+ seq_loadWSA(1, "library.wsa", 9);
+ break;
+ case 200:
+ return 0;
+ default:
+ break;
+ }
+
+ return -1;
}
int KyraEngine_v2::seq_introOverview(int seqNum) {
+ debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_introOverview(%i)", seqNum);
+
switch (seqNum) {
case 0:
_sound->playTrack(4);
break;
case 40:
- seq_loadWSA(1, "over1.wsa", 10);
+ seq_loadWSA(1, "over1.wsa", 10, &KyraEngine_v2::seq_introOverviewOver1);
break;
case 60:
seq_loadWSA(2, "over2.wsa", 9);
break;
+ case 120:
+ seq_playIntroChat(0);
+ break;
+ case 200:
+ seq_waitForChatsToFinish();
+ // XXX: fade to grey
+ break;
+ case 201:
+ // XXX
+ break;
case 282:
- seq_loadWSA(3, "forest.wsa", 6);
+ seq_loadWSA(3, "forest.wsa", 6, &KyraEngine_v2::seq_introOverviewForest);
+ seq_playIntroChat(1);
break;
case 434:
- seq_loadWSA(4, "dragon.wsa", 6);
+ seq_loadWSA(4, "dragon.wsa", 6, &KyraEngine_v2::seq_introOverviewDragon);
break;
case 540:
+ seq_waitForChatsToFinish();
seq_unloadWSA(1);
seq_unloadWSA(2);
seq_unloadWSA(3);
@@ -141,7 +199,38 @@ int KyraEngine_v2::seq_introOverview(int seqNum) {
return -1;
}
+void KyraEngine_v2::seq_introOverviewOver1(int currentFrame) {
+ debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_introOverviewOver1(%i)", currentFrame);
+
+ if (currentFrame == 2)
+ seq_waitForChatsToFinish();
+ else if(currentFrame == 3)
+ seq_playIntroChat(12);
+}
+
+void KyraEngine_v2::seq_introOverviewForest(int currentFrame) {
+ debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_introOverviewForest(%i)", currentFrame);
+
+ if (currentFrame == 11)
+ seq_waitForChatsToFinish();
+ else if(currentFrame == 12) {
+ delay(25);
+ seq_playIntroChat(2);
+ }
+}
+
+void KyraEngine_v2::seq_introOverviewDragon(int currentFrame) {
+ debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_introOverviewDragon(%i)", currentFrame);
+
+ if (currentFrame == 3)
+ seq_playIntroChat(3);
+ else if(currentFrame == 11)
+ seq_waitForChatsToFinish();
+}
+
int KyraEngine_v2::seq_introTitle(int seqNum) {
+ debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_introtitle(%i)", seqNum);
+
if (seqNum == 1)
_sound->playTrack(3);
else if (seqNum == 25) {
@@ -153,24 +242,104 @@ int KyraEngine_v2::seq_introTitle(int seqNum) {
}
int KyraEngine_v2::seq_introWestwood(int seqNum) {
+ debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_introWestwood(%i)", seqNum);
+
if (seqNum == 0)
_sound->playTrack(2);
return -1;
}
+void KyraEngine_v2::seq_playIntroChat(uint8 chatNum) {
+ debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_playIntroChat(%i)", chatNum);
+
+ assert(chatNum < _introSoundListSize);
+
+ if (chatNum < 12)
+ seq_setChatEntry(chatNum, 160, 168, _introStringsDuration[chatNum], 160);
+ _sound->voicePlay(_introSoundList[chatNum]);
+}
+
+void KyraEngine_v2::seq_waitForChatsToFinish() {
+ debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_waitForChatsToFinish()");
+
+ uint32 longest = 0;
+
+ for (int i = 0; i < 10; i++) {
+ if (_activeChat[i].duration != -1) {
+ uint32 currChatTime = _activeChat[i].duration + _activeChat[i].startTime;
+ if ( currChatTime > longest)
+ longest = currChatTime;
+ }
+ }
+
+ uint32 now = _system->getMillis();
+ if (longest > now)
+ delay(longest - now);
+}
+
+void KyraEngine_v2::seq_resetAllChatEntries() {
+ debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_resetAllChatEntries()");
+
+ for (int i = 0; i < 10; i++)
+ _activeChat[i].duration = -1;
+}
+
+void KyraEngine_v2::seq_setChatEntry(uint16 strIndex, uint16 posX, uint16 posY, int duration, uint16 unk1) {
+ debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_setChatEntry(%i, %i, %i, %i, %i)", strIndex, posX, posY, duration, unk1);
+
+ for (int i = 0; i < 10; i++) {
+ if (_activeChat[i].duration != -1)
+ continue;
+
+ _activeChat[i].strIndex = strIndex;
+ _activeChat[i].x = posX;
+ _activeChat[i].y = posY;
+ _activeChat[i].duration = duration * _tickLength;
+ _activeChat[i].field_8 = unk1;
+ _activeChat[i].startTime = _system->getMillis();
+
+ return;
+ }
+}
+
+void KyraEngine_v2::seq_showChats() {
+ debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_showChats()");
+
+ uint32 now = _system->getMillis();
+
+ for (int i = 0; i < 10; i++) {
+ if (_activeChat[i].duration != -1) {
+ if ((_activeChat[i].startTime + (uint32)_activeChat[i].duration) > now) {
+ assert(_activeChat[i].strIndex < _introStringsSize);
+
+ _text->printIntroTextMessage(_introStrings[_activeChat[i].strIndex], _activeChat[i].x, _activeChat[i].y + 12,
+ 0xfe, 150 /*_activeChat[i].field_8*/, 0x0, 0, Screen::FID_GOLDFONT_FNT);
+ } else
+ _activeChat[i].duration = -1;
+ }
+ }
+}
+
void KyraEngine_v2::seq_playWSAs() {
+ debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_playWSAs()");
+
uint32 currTime = _system->getMillis();
for (int i = 0; i < 8; i++) {
if (_activeWSA[i].movie && currTime >= _activeWSA[i].nextFrame && _activeWSA[i].currentFrame < _activeWSA[i].endFrame) {
- _activeWSA[i].movie->displayFrame(_activeWSA[i].currentFrame++);
+ _activeWSA[i].movie->displayFrame(_activeWSA[i].currentFrame);
+ if (_activeWSA[i].callback != 0)
+ (*this.*_activeWSA[i].callback)(_activeWSA[i].currentFrame);
+ _activeWSA[i].currentFrame++;
_activeWSA[i].nextFrame = currTime + _activeWSA[i].frameDelay * _tickLength;
}
}
}
-void KyraEngine_v2::seq_loadWSA(int wsaNum, const char *filename, int frameDelay) {
+void KyraEngine_v2::seq_loadWSA(int wsaNum, const char *filename, int frameDelay, void (KyraEngine_v2::*callback)(int)) {
+ debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_loadWSA(%i, %s, %i, %i)", wsaNum, filename, frameDelay, callback ? true : false);
+
_activeWSA[wsaNum].movie = new WSAMovieV2(this);
assert(_activeWSA[wsaNum].movie);
_activeWSA[wsaNum].endFrame = _activeWSA[wsaNum].movie->open(filename, 0, _screen->_currentPalette);
@@ -180,13 +349,18 @@ void KyraEngine_v2::seq_loadWSA(int wsaNum, const char *filename, int frameDelay
_activeWSA[wsaNum].nextFrame = _system->getMillis();
_activeWSA[wsaNum].movie->setX(0);
_activeWSA[wsaNum].movie->setY(0);
- _activeWSA[wsaNum].movie->setDrawPage(0);
+ _activeWSA[wsaNum].movie->setDrawPage(_screen->_curPage);
+ _activeWSA[wsaNum].callback = callback;
}
void KyraEngine_v2::seq_unloadWSA(int wsaNum) {
- assert(_activeWSA[wsaNum].movie);
- _activeWSA[wsaNum].movie->close();
- delete _activeWSA[wsaNum].movie;
+ debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_unloadWSA(%i)", wsaNum);
+
+ if (_activeWSA[wsaNum].movie) {
+ _activeWSA[wsaNum].movie->close();
+ delete _activeWSA[wsaNum].movie;
+ _activeWSA[wsaNum].movie = 0;
+ }
}
} // end of namespace Kyra
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index 67c49dd50c..08a8cc4567 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -1273,53 +1273,53 @@ const char *KyraEngine_v2::_introStrings[] = {
const int KyraEngine_v2::_introStringsSize = ARRAYSIZE(KyraEngine_v2::_introStrings);
const char *KyraEngine_v2::_introSoundList[] = {
- "eintro1.voc",
- "eintro2.voc",
- "eintro3.voc",
- "eintro4.voc",
- "eintro5.voc",
- "eintro6.voc",
- "eintro7.voc",
- "eintro8.voc",
- "eintro9.voc",
- "eintro10.voc",
- "eintro11voc",
- "eintro12.voc",
- "eglow.voc",
- "0000210.voc",
- "0000130.voc",
- "0000180.voc",
- "0000160.voc",
- "asong.voc",
- "crowcaw.voc",
- "eyerub2.voc",
- "pluck3.voc",
- "rodnreel.voc",
- "frog1.voc",
- "scavmov2.voc",
- "lambmom3.voc",
- "lambkid1.voc",
- "thunder2.voc",
- "tunder3.voc",
- "wind6.voc",
- "h2odrop2.voc",
- "gasleak.voc",
- "polgulp1.voc",
- "hndslap1.voc",
- "burp1.voc",
- "0000220.voc",
- "0000230.voc",
- "0000250.voc",
- "0000260.voc",
- "0000270.voc",
- "0000280.voc",
- "0000290.voc",
- "0000300.voc",
- "0000310.voc",
- "0000320.voc",
- "0000330.voc",
- "scream1.voc",
- "theend.voc"
+ "eintro1",
+ "eintro2",
+ "eintro3",
+ "eintro4",
+ "eintro5",
+ "eintro6",
+ "eintro7",
+ "eintro8",
+ "eintro9",
+ "eintro10",
+ "eintro11",
+ "eintro12",
+ "eglow",
+ "0000210",
+ "0000130",
+ "0000180",
+ "0000160",
+ "asong",
+ "crowcaw",
+ "eyerub2",
+ "pluck3",
+ "rodnreel",
+ "frog1",
+ "scavmov2",
+ "lambmom3",
+ "lambkid1",
+ "thunder2",
+ "tunder3",
+ "wind6",
+ "h2odrop2",
+ "gasleak",
+ "polgulp1",
+ "hndslap1",
+ "burp1",
+ "0000220",
+ "0000230",
+ "0000250",
+ "0000260",
+ "0000270",
+ "0000280",
+ "0000290",
+ "0000300",
+ "0000310",
+ "0000320",
+ "0000330",
+ "scream1",
+ "theend"
};
const int KyraEngine_v2::_introSoundListSize = ARRAYSIZE(KyraEngine_v2::_introSoundList);
diff --git a/engines/kyra/text.cpp b/engines/kyra/text.cpp
index edc46d3eb7..cfeca07c8d 100644
--- a/engines/kyra/text.cpp
+++ b/engines/kyra/text.cpp
@@ -551,12 +551,40 @@ void TextDisplayer::printTalkTextMessage(const char *text, int x, int y, uint8 c
_talkMessagePrinted = true;
}
-void TextDisplayer::printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2) {
+void TextDisplayer::printIntroTextMessage(const char *text, int x, int y, uint8 col1, uint8 col2, uint8 col3, int dstPage, Screen::FontId font) {
+ debugC(9, kDebugLevelMain, "TextDisplayer::printIntroTextMessage('%s', %d, %d, %d, %d, %d, %d, %d)",
+ text, x, y, col1, col2, col3, dstPage, font);
+ char *str = preprocessString(text);
+ int lineCount = buildMessageSubstrings(str);
+ int top = y - lineCount * 10;
+ if (top < 0) {
+ top = 0;
+ }
+ _talkMessageY = top;
+ _talkMessageH = lineCount * 10;
+ int w = getWidestLineWidth(lineCount);
+ int x1, x2;
+ calcWidestLineBounds(x1, x2, w, x);
+ _talkCoords.x = x1;
+ _talkCoords.w = w + 2;
+ int curPage = _screen->setCurPage(dstPage);
+
+ for (int i = 0; i < lineCount; ++i) {
+ top = i * 10 + _talkMessageY;
+ char *msg = &_talkSubstrings[i * TALK_SUBSTRING_LEN];
+ int left = getCenterStringX(msg, x1, x2);
+ printText(msg, left, top, col1, col2, col3, font);
+ }
+ _screen->_curPage = curPage;
+ _talkMessagePrinted = true;
+}
+
+void TextDisplayer::printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2, Screen::FontId font) {
debugC(9, kDebugLevelMain, "TextDisplayer::printText('%s', %d, %d, %d, %d, %d)", str, x, y, c0, c1, c2);
uint8 colorMap[] = { 0, 15, 12, 12 };
colorMap[3] = c1;
_screen->setTextColor(colorMap, 0, 3);
- Screen::FontId curFont = _screen->setFont(Screen::FID_8_FNT);
+ Screen::FontId curFont = _screen->setFont(font);
_screen->_charWidth = -2;
_screen->printText(str, x, y, c0, c2);
_screen->_charWidth = 0;
diff --git a/engines/kyra/text.h b/engines/kyra/text.h
index 7c5f1846ee..725e4c3a1a 100644
--- a/engines/kyra/text.h
+++ b/engines/kyra/text.h
@@ -25,6 +25,7 @@
namespace Kyra {
class Screen;
+class FontId;
class TextDisplayer {
struct TalkCoords {
@@ -49,7 +50,9 @@ public:
void calcWidestLineBounds(int &x1, int &x2, int w, int cx);
void restoreTalkTextMessageBkgd(int srcPage, int dstPage);
void printTalkTextMessage(const char *text, int x, int y, uint8 color, int srcPage, int dstPage);
- void printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2);
+ void printIntroTextMessage(const char *text, int x, int y, uint8 col1, uint8 col2, uint8 col3,
+ int dstPage, Screen::FontId font=Screen::FID_8_FNT);
+ void printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2, Screen::FontId font=Screen::FID_8_FNT);
void printCharacterText(const char *text, int8 charNum, int charX);
uint16 _talkMessageY;