IHNM's ending is shown correctly now (but the credits still aren't). Slight update on the music of chapter 6

svn-id: r28753
This commit is contained in:
Filippos Karapetis 2007-08-27 09:30:23 +00:00
parent 30148e505d
commit 4e5d819732
4 changed files with 17 additions and 32 deletions

View File

@ -651,11 +651,12 @@ void Anim::decodeFrame(AnimationData *anim, size_t frameOffset, byte *buf, size_
MemoryReadStream readS(anim->resourceData + frameOffset, anim->resourceLength - frameOffset);
// FIXME: This is thrown when the first video of the IHNM end sequence is shown (the "turn off screen"
// video), however the video is played correctly and the rest of the end sequence continues normally
#if 1
#define VALIDATE_WRITE_POINTER \
if ((writePointer < buf) || (writePointer >= (buf + screenWidth * screenHeight))) { \
error("VALIDATE_WRITE_POINTER: writePointer=%p buf=%p", (void *)writePointer, (void *)buf); \
warning("VALIDATE_WRITE_POINTER: writePointer=%p buf=%p", (void *)writePointer, (void *)buf); \
}
#else
#define VALIDATE_WRITE_POINTER

View File

@ -610,7 +610,11 @@ void Resource::loadResource(ResourceContext *context, uint32 resourceId, byte*&r
if (file->read(resourceBuffer, resourceSize) != resourceSize) {
error("Resource::loadResource() failed to read");
}
if (resourceData->patchData != NULL)
// ITE uses several patch files which are loaded and then not needed
// anymore (as they're in memory), so close them here. IHNM uses only
// 1 patch file, which is reused, so don't close it
if (resourceData->patchData != NULL && _vm->getGameType() == GType_ITE)
file->close();
}
@ -744,6 +748,14 @@ void Resource::loadGlobalResources(int chapter, int actorsEntrance) {
_vm->_anim->loadCutawayList(resourcePointer, resourceLength);
if (_metaResource.songTableID > 0) {
// FIXME: HACK for chapter 6 (last chapter) of IHNM. For some reason, the songtable with songTableID
// 1028 can't be loaded properly, so it's substituted here with Gorrister's songtable (ID 116)
// The strange thing is that the song invoked when each character enters the final chapter is
// supposed to be different, but the song numbers called by sfPlayMusic/sfQueueMusic are the
// same every time, which leads me to believe that a different meta resource is loaded depending
// on the character selected
if (_vm->getGameType() == GType_IHNM && _metaResource.songTableID == 1028)
_metaResource.songTableID = 116;
_vm->_resource->loadResource(resourceContext, _metaResource.songTableID, resourcePointer, resourceLength);
if (resourceLength == 0) {

View File

@ -273,18 +273,7 @@ void SagaEngine::load(const char *fileName) {
if (_scene->currentChapterNumber() == 8)
_interface->setMode(kPanelChapterSelection);
if (getGameId() != GID_IHNM_DEMO) {
// HACK for chapter 6 (last chapter) in IHNM. For some reason, the songtable loaded is
// incorrect, and the game crashes here when trying to load a music track there. For now,
// just don't change the music track for chapter 6
// FIXME: Figure out what's wrong with the loaded music track and remove this hack
// Note that when this hack is removed, remove it from Script::sfPlayMusic and
// Script::sfQueueMusic as well
if (getGameType() == GType_IHNM && _scene->currentChapterNumber() == 6) {
// do nothing
} else {
_music->play(_music->_songTable[_scene->getCurrentMusicTrack()], _scene->getCurrentMusicRepeat() ? MUSIC_LOOP : MUSIC_NORMAL);
}
//_music->play(_music->_songTable[_scene->getCurrentMusicTrack()], _scene->getCurrentMusicRepeat() ? MUSIC_LOOP : MUSIC_NORMAL);
_music->play(_music->_songTable[_scene->getCurrentMusicTrack()], _scene->getCurrentMusicRepeat() ? MUSIC_LOOP : MUSIC_NORMAL);
} else {
_music->play(3, MUSIC_LOOP);
}

View File

@ -1676,14 +1676,6 @@ void Script::sfPlayMusic(SCRIPTFUNC_PARAMS) {
warning("sfPlayMusic: Wrong song number (%d > %d)", param1, _vm->_music->_songTableLen - 1);
} else {
_vm->_music->setVolume(_vm->_musicVolume == 10 ? -1 : _vm->_musicVolume * 25, 1);
// HACK for chapter 6 (last chapter) in IHNM. For some reason, the songtable loaded is
// incorrect, and the game crashes here when trying to load a music track there. For now,
// just don't change the music track for chapter 6
// FIXME: Figure out what's wrong with the loaded music track and remove this hack
// Note that when this hack is removed, remove it from SagaEngine::load and
// Script::sfQueueMusic as well
if (_vm->getGameType() == GType_IHNM && _vm->_scene->currentChapterNumber() == 6)
return;
_vm->_music->play(_vm->_music->_songTable[param1], param2 ? MUSIC_LOOP : MUSIC_NORMAL);
if (!_vm->_scene->haveChapterPointsChanged()) {
_vm->_scene->setCurrentMusicTrack(param1);
@ -2150,15 +2142,6 @@ void Script::sfQueueMusic(SCRIPTFUNC_PARAMS) {
return;
}
// HACK for chapter 6 (last chapter) in IHNM. For some reason, the songtable loaded is
// incorrect, and the game crashes here when trying to load a music track there. For now,
// just don't change the music track for chapter 6
// FIXME: Figure out what's wrong with the loaded music track and remove this hack
// Note that when this hack is removed, remove it from SagaEngine::load and
// Script::sfPlayMusic as well
if (_vm->getGameType() == GType_IHNM && _vm->_scene->currentChapterNumber() == 6)
return;
if (param1 >= _vm->_music->_songTableLen) {
warning("sfQueueMusic: Wrong song number (%d > %d)", param1, _vm->_music->_songTableLen - 1);
} else {