- complete support for the playable HOF demo

svn-id: r31560
This commit is contained in:
Florian Kagerer 2008-04-18 19:11:58 +00:00
parent ba90659705
commit 1d086550a7
5 changed files with 53 additions and 14 deletions

View File

@ -1088,6 +1088,7 @@ protected:
int o2_isVoicePlaying(ScriptState *script);
int o2_stopVoicePlaying(ScriptState *script);
int o2_getGameLanguage(ScriptState *script);
int o2_demoFinale(ScriptState *script);
int o2_dummy(ScriptState *script);
// opcodes temporary

View File

@ -306,22 +306,24 @@ Common::SeekableReadStream *Resource::getFileStream(const Common::String &file)
if (iter == _map.end())
return 0;
if (!iter->_value.parent.empty()) {
Common::SeekableReadStream *parent = getFileStream(iter->_value.parent);
assert(parent);
ResFileMap::const_iterator parentIter = _map.find(iter->_value.parent);
const ResArchiveLoader *loader = getLoader(parentIter->_value.type);
assert(loader);
return loader->loadFileFromArchive(file, parent, iter->_value);
Common::File *stream = new Common::File();
if (stream->open(file)) {
return stream;
} else {
Common::File *stream = new Common::File();
if (!stream->open(file)) {
delete stream;
if (!iter->_value.parent.empty()) {
Common::SeekableReadStream *parent = getFileStream(iter->_value.parent);
assert(parent);
ResFileMap::const_iterator parentIter = _map.find(iter->_value.parent);
const ResArchiveLoader *loader = getLoader(parentIter->_value.type);
assert(loader);
return loader->loadFileFromArchive(file, parent, iter->_value);
} else {
warning("Couldn't open file '%s'", file.c_str());
return 0;
}
return stream;
}
return 0;

View File

@ -226,6 +226,7 @@ enum kKyraResources {
k2IngameTalkObjIndex,
k2IngameTimJpStrings,
k2IngameShapeAnimData,
k2IngameTlkDemoStrings,
kMaxResIDs
};

View File

@ -1748,6 +1748,40 @@ int KyraEngine_v2::o2_getGameLanguage(ScriptState *script) {
return _lang;
}
int KyraEngine_v2::o2_demoFinale(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_demoFinale(%p) ()", (const void *)script);
if (!_flags.isDemo)
return 0;
int tmpSize;
const char *const *strings = _staticres->loadStrings(k2IngameTlkDemoStrings, tmpSize);
assert(strings);
_screen->clearPage(0);
_screen->loadPalette("THANKS.COL", _screen->_currentPalette);
_screen->loadBitmap("THANKS.CPS", 3, 3, 0);
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0);
_screen->_curPage = 0;
_screen->setFont(Screen::FID_6_FNT);
int y = _lang == 1 ? 70 : 65;
for (int i = 0; i < 6; i++)
_text->printText(strings[i], _text->getCenterStringX(strings[i], 1, 319), y + i * 10, 255, 207, 0);
_screen->setScreenPalette(_screen->_currentPalette);
_screen->updateScreen();
_eventList.clear();
while (!skipFlag())
delay(10);
_sound->beginFadeOut();
_screen->fadeToBlack();
_runFlag = 0;
return 0;
}
int KyraEngine_v2::o2_dummy(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_dummy(%p) ()", (const void *)script);
return 0;
@ -2023,7 +2057,7 @@ void KyraEngine_v2::setupOpcodeTable() {
// 0xac
Opcode(o2_stopVoicePlaying),
Opcode(o2_getGameLanguage),
Opcode(o2_dummy),
Opcode(o2_demoFinale),
Opcode(o2_dummy),
};

View File

@ -39,7 +39,7 @@
namespace Kyra {
#define RESFILE_VERSION 23
#define RESFILE_VERSION 24
bool StaticResource::checkKyraDat() {
Common::File kyraDat;
@ -257,6 +257,7 @@ bool StaticResource::init() {
{ k2IngameTalkObjIndex, kRawData, "I_TALKOBJECTS.MAP" },
{ k2IngameTimJpStrings, kStringList, "I_TIMJPSTR.TXT" },
{ k2IngameShapeAnimData, k2ShpAnimDataV2, "I_INVANIM.SHP" },
{ k2IngameTlkDemoStrings, kLanguageList, "I_TLKDEMO.TXT." },
{ 0, 0, 0 }
};