2012-09-15 00:27:15 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "hopkins/anim.h"
|
2013-02-15 21:20:24 +00:00
|
|
|
|
2012-09-15 00:27:15 +00:00
|
|
|
#include "hopkins/files.h"
|
|
|
|
#include "hopkins/globals.h"
|
|
|
|
#include "hopkins/graphics.h"
|
|
|
|
#include "hopkins/hopkins.h"
|
|
|
|
|
2013-02-15 21:20:24 +00:00
|
|
|
#include "common/system.h"
|
|
|
|
#include "graphics/palette.h"
|
|
|
|
#include "common/file.h"
|
|
|
|
#include "common/rect.h"
|
|
|
|
#include "engines/util.h"
|
|
|
|
|
2012-09-15 00:27:15 +00:00
|
|
|
namespace Hopkins {
|
|
|
|
|
2013-03-19 07:17:01 +00:00
|
|
|
AnimationManager::AnimationManager(HopkinsEngine *vm) {
|
|
|
|
_vm = vm;
|
2012-12-09 23:23:51 +00:00
|
|
|
_clearAnimationFl = false;
|
2012-09-15 00:27:15 +00:00
|
|
|
NO_SEQ = false;
|
2012-11-25 11:38:37 +00:00
|
|
|
NO_COUL = false;
|
2012-09-15 00:27:15 +00:00
|
|
|
}
|
|
|
|
|
2012-12-09 21:35:59 +00:00
|
|
|
/**
|
2012-12-10 11:16:09 +00:00
|
|
|
* Play Animation
|
|
|
|
* @param filename Filename of animation to play
|
|
|
|
* @param rate1 Delay amount before starting animation
|
|
|
|
* @param rate2 Delay amount between animation frames
|
|
|
|
* @param rate3 Delay amount after animation finishes
|
2012-12-09 21:35:59 +00:00
|
|
|
*/
|
|
|
|
void AnimationManager::playAnim(const Common::String &filename, uint32 rate1, uint32 rate2, uint32 rate3) {
|
2012-12-14 00:49:22 +00:00
|
|
|
byte *screenCopy = NULL;
|
2012-09-15 00:27:15 +00:00
|
|
|
Common::File f;
|
|
|
|
|
2012-10-28 13:00:18 +00:00
|
|
|
if (_vm->shouldQuit())
|
|
|
|
return;
|
|
|
|
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->mouseOff();
|
2013-02-10 21:26:12 +00:00
|
|
|
|
2013-01-07 07:33:55 +00:00
|
|
|
bool hasScreenCopy = false;
|
|
|
|
byte *screenP = _vm->_graphicsManager._vesaScreen;
|
2012-09-15 00:27:15 +00:00
|
|
|
|
2013-01-07 22:56:39 +00:00
|
|
|
Common::String tmpStr;
|
2013-01-07 15:40:41 +00:00
|
|
|
// The Windows 95 demo only contains the interlaced version of the BOMBE1 and BOMBE2 videos
|
|
|
|
if (_vm->getPlatform() == Common::kPlatformWindows && _vm->getIsDemo() && filename == "BOMBE1A.ANM")
|
2013-01-07 22:56:39 +00:00
|
|
|
tmpStr = "BOMBE1.ANM";
|
2013-01-07 15:40:41 +00:00
|
|
|
else if (_vm->getPlatform() == Common::kPlatformWindows && _vm->getIsDemo() && filename == "BOMBE2A.ANM")
|
2013-01-07 22:56:39 +00:00
|
|
|
tmpStr = "BOMBE2.ANM";
|
2013-01-07 15:40:41 +00:00
|
|
|
else
|
2013-01-07 22:56:39 +00:00
|
|
|
tmpStr = filename;
|
|
|
|
if (!f.open(tmpStr))
|
|
|
|
error("File not found - %s", tmpStr.c_str());
|
2012-09-15 00:27:15 +00:00
|
|
|
|
2012-12-10 11:16:09 +00:00
|
|
|
f.skip(6);
|
2012-12-23 18:08:23 +00:00
|
|
|
f.read(_vm->_graphicsManager._palette, 800);
|
2012-12-10 11:16:09 +00:00
|
|
|
f.skip(4);
|
2013-01-07 07:33:55 +00:00
|
|
|
size_t nbytes = f.readUint32LE();
|
2012-12-10 11:16:09 +00:00
|
|
|
f.skip(14);
|
|
|
|
f.read(screenP, nbytes);
|
2012-09-15 11:42:20 +00:00
|
|
|
|
2012-12-10 11:16:09 +00:00
|
|
|
if (_clearAnimationFl) {
|
2012-12-19 01:15:32 +00:00
|
|
|
_vm->_graphicsManager.lockScreen();
|
|
|
|
_vm->_graphicsManager.clearScreen();
|
|
|
|
_vm->_graphicsManager.unlockScreen();
|
2012-12-10 11:16:09 +00:00
|
|
|
}
|
2012-12-15 22:28:58 +00:00
|
|
|
if (_vm->_graphicsManager.WinScan / 2 > SCREEN_WIDTH) {
|
2012-12-10 11:16:09 +00:00
|
|
|
hasScreenCopy = true;
|
2013-03-20 06:27:42 +00:00
|
|
|
screenCopy = _vm->_globals->allocMemory(307200);
|
2012-12-21 07:12:02 +00:00
|
|
|
memcpy(screenCopy, screenP, 307200);
|
2012-12-10 11:16:09 +00:00
|
|
|
}
|
|
|
|
if (NO_SEQ) {
|
|
|
|
if (hasScreenCopy)
|
2012-12-21 07:12:02 +00:00
|
|
|
memcpy(screenCopy, _vm->_graphicsManager._vesaBuffer, 307200);
|
2013-01-07 07:33:55 +00:00
|
|
|
_vm->_graphicsManager.setPaletteVGA256(_vm->_graphicsManager._palette);
|
2012-12-10 11:16:09 +00:00
|
|
|
} else {
|
2013-01-07 07:33:55 +00:00
|
|
|
_vm->_graphicsManager.setPaletteVGA256(_vm->_graphicsManager._palette);
|
2012-12-19 01:15:32 +00:00
|
|
|
_vm->_graphicsManager.lockScreen();
|
2012-12-15 22:28:58 +00:00
|
|
|
if (hasScreenCopy)
|
|
|
|
_vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
|
|
|
|
else
|
|
|
|
_vm->_graphicsManager.m_scroll16(screenP, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
|
2012-12-19 01:15:32 +00:00
|
|
|
_vm->_graphicsManager.unlockScreen();
|
2013-03-05 14:42:06 +00:00
|
|
|
|
2013-03-17 15:29:00 +00:00
|
|
|
_vm->_graphicsManager.addRefreshRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
2013-02-25 00:42:35 +00:00
|
|
|
_vm->_graphicsManager.updateScreen();
|
2012-12-10 11:16:09 +00:00
|
|
|
}
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->_rateCounter = 0;
|
|
|
|
_vm->_eventsManager->_escKeyFl = false;
|
2013-01-19 23:56:19 +00:00
|
|
|
_vm->_soundManager.loadAnimSound();
|
2012-12-10 11:16:09 +00:00
|
|
|
|
2013-03-20 06:27:42 +00:00
|
|
|
if (_vm->_globals->iRegul == 1) {
|
2012-12-10 11:16:09 +00:00
|
|
|
// Do pre-animation delay
|
|
|
|
do {
|
2013-03-19 19:40:55 +00:00
|
|
|
if (_vm->_eventsManager->_escKeyFl)
|
2013-02-03 06:59:48 +00:00
|
|
|
break;
|
2012-12-10 11:16:09 +00:00
|
|
|
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->refreshEvents();
|
|
|
|
} while (!_vm->shouldQuit() && _vm->_eventsManager->_rateCounter < rate1);
|
2012-10-13 05:42:07 +00:00
|
|
|
}
|
2012-12-10 11:16:09 +00:00
|
|
|
|
2013-03-19 19:40:55 +00:00
|
|
|
if (!_vm->_eventsManager->_escKeyFl) {
|
|
|
|
_vm->_eventsManager->_rateCounter = 0;
|
2013-02-04 19:38:31 +00:00
|
|
|
int frameNumber = 0;
|
2013-02-03 06:59:48 +00:00
|
|
|
while (!_vm->shouldQuit()) {
|
|
|
|
++frameNumber;
|
|
|
|
_vm->_soundManager.playAnimSound(frameNumber);
|
2012-10-13 05:42:07 +00:00
|
|
|
|
2013-02-04 19:38:31 +00:00
|
|
|
byte imageStr[17];
|
2013-02-03 06:59:48 +00:00
|
|
|
// Read frame header
|
2013-02-04 07:24:49 +00:00
|
|
|
if (f.read(imageStr, 16) != 16)
|
2013-02-03 06:59:48 +00:00
|
|
|
break;
|
2013-02-04 19:38:31 +00:00
|
|
|
imageStr[16] = 0;
|
2013-02-04 07:24:49 +00:00
|
|
|
if (strncmp((const char *)imageStr, "IMAGE=", 6))
|
2013-02-03 06:59:48 +00:00
|
|
|
break;
|
2012-12-10 11:16:09 +00:00
|
|
|
|
2013-02-04 07:24:49 +00:00
|
|
|
f.read(screenP, READ_LE_UINT32(imageStr + 8));
|
2012-12-10 11:16:09 +00:00
|
|
|
|
2013-03-20 06:27:42 +00:00
|
|
|
if (_vm->_globals->iRegul == 1) {
|
2013-02-03 06:59:48 +00:00
|
|
|
do {
|
2013-03-19 19:40:55 +00:00
|
|
|
if (_vm->_eventsManager->_escKeyFl)
|
2013-02-03 06:59:48 +00:00
|
|
|
break;
|
2012-12-10 11:16:09 +00:00
|
|
|
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->refreshEvents();
|
2013-02-03 06:59:48 +00:00
|
|
|
_vm->_soundManager.checkSoundEnd();
|
2013-03-19 19:40:55 +00:00
|
|
|
} while (!_vm->shouldQuit() && _vm->_eventsManager->_rateCounter < rate2);
|
2013-02-03 06:59:48 +00:00
|
|
|
}
|
2012-12-10 11:16:09 +00:00
|
|
|
|
2013-03-19 19:40:55 +00:00
|
|
|
if (!_vm->_eventsManager->_escKeyFl) {
|
|
|
|
_vm->_eventsManager->_rateCounter = 0;
|
2013-02-03 06:59:48 +00:00
|
|
|
_vm->_graphicsManager.lockScreen();
|
|
|
|
if (hasScreenCopy) {
|
|
|
|
if (*screenP != kByteStop) {
|
2013-02-20 07:30:16 +00:00
|
|
|
_vm->_graphicsManager.copyWinscanVbe3(screenP, screenCopy);
|
2013-02-03 06:59:48 +00:00
|
|
|
_vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
|
|
|
|
}
|
|
|
|
} else if (*screenP != kByteStop) {
|
2013-02-20 07:30:16 +00:00
|
|
|
_vm->_graphicsManager.copyVideoVbe16(screenP);
|
2013-02-03 06:59:48 +00:00
|
|
|
}
|
|
|
|
_vm->_graphicsManager.unlockScreen();
|
2013-03-05 14:42:06 +00:00
|
|
|
|
2013-03-17 15:29:00 +00:00
|
|
|
_vm->_graphicsManager.addRefreshRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
2013-02-25 00:42:35 +00:00
|
|
|
_vm->_graphicsManager.updateScreen();
|
2013-02-03 06:59:48 +00:00
|
|
|
_vm->_soundManager.checkSoundEnd();
|
2012-10-13 05:42:07 +00:00
|
|
|
}
|
|
|
|
}
|
2012-09-15 00:27:15 +00:00
|
|
|
}
|
2012-12-10 11:16:09 +00:00
|
|
|
|
2013-03-20 06:27:42 +00:00
|
|
|
if (_vm->_globals->iRegul == 1 && !_vm->_eventsManager->_escKeyFl) {
|
2012-12-10 11:16:09 +00:00
|
|
|
// Do post-animation delay
|
|
|
|
do {
|
2013-03-19 19:40:55 +00:00
|
|
|
if (_vm->_eventsManager->_escKeyFl)
|
2012-10-13 05:42:07 +00:00
|
|
|
break;
|
|
|
|
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->refreshEvents();
|
2013-01-19 23:56:19 +00:00
|
|
|
_vm->_soundManager.checkSoundEnd();
|
2013-03-19 19:40:55 +00:00
|
|
|
} while (_vm->_eventsManager->_rateCounter < rate3);
|
2012-10-13 05:42:07 +00:00
|
|
|
}
|
2012-12-10 11:16:09 +00:00
|
|
|
|
2013-03-19 19:40:55 +00:00
|
|
|
if (!_vm->_eventsManager->_escKeyFl) {
|
|
|
|
_vm->_eventsManager->_rateCounter = 0;
|
2013-02-03 06:59:48 +00:00
|
|
|
_vm->_soundManager.checkSoundEnd();
|
|
|
|
}
|
|
|
|
|
2012-10-13 05:42:07 +00:00
|
|
|
if (_vm->_graphicsManager.FADE_LINUX == 2 && !hasScreenCopy) {
|
2013-03-20 06:27:42 +00:00
|
|
|
screenCopy = _vm->_globals->allocMemory(307200);
|
2012-09-15 00:27:15 +00:00
|
|
|
|
2013-02-04 19:38:31 +00:00
|
|
|
f.seek(6);
|
2012-12-23 18:08:23 +00:00
|
|
|
f.read(_vm->_graphicsManager._palette, 800);
|
2012-09-15 00:27:15 +00:00
|
|
|
f.skip(4);
|
|
|
|
nbytes = f.readUint32LE();
|
2012-10-13 05:42:07 +00:00
|
|
|
f.skip(14);
|
2012-12-10 11:16:09 +00:00
|
|
|
f.read(screenP, nbytes);
|
2012-12-14 00:49:22 +00:00
|
|
|
|
2012-12-21 07:12:02 +00:00
|
|
|
memcpy(screenCopy, screenP, 307200);
|
2012-09-15 00:27:15 +00:00
|
|
|
|
2013-01-07 07:33:55 +00:00
|
|
|
for (;;) {
|
2013-02-04 19:38:31 +00:00
|
|
|
byte imageStr[17];
|
2013-02-04 07:24:49 +00:00
|
|
|
if (f.read(imageStr, 16) != 16)
|
2013-01-07 07:33:55 +00:00
|
|
|
break;
|
2013-02-04 19:38:31 +00:00
|
|
|
imageStr[16] = 0;
|
|
|
|
|
2013-02-04 07:24:49 +00:00
|
|
|
if (strncmp((const char *)imageStr, "IMAGE=", 6))
|
2013-01-07 07:33:55 +00:00
|
|
|
break;
|
2012-12-14 00:49:22 +00:00
|
|
|
|
2013-02-04 07:24:49 +00:00
|
|
|
f.read(screenP, READ_LE_UINT32(imageStr + 8));
|
2013-01-07 07:33:55 +00:00
|
|
|
if (*screenP != kByteStop)
|
2013-02-20 07:30:16 +00:00
|
|
|
_vm->_graphicsManager.copyWinscanVbe3(screenP, screenCopy);
|
2013-01-07 07:33:55 +00:00
|
|
|
}
|
2013-01-03 21:32:22 +00:00
|
|
|
_vm->_graphicsManager.fadeOutDefaultLength(screenCopy);
|
2013-03-20 06:27:42 +00:00
|
|
|
screenCopy = _vm->_globals->freeMemory(screenCopy);
|
2012-09-15 00:27:15 +00:00
|
|
|
}
|
2012-12-10 11:16:09 +00:00
|
|
|
if (hasScreenCopy) {
|
2012-09-15 00:27:15 +00:00
|
|
|
if (_vm->_graphicsManager.FADE_LINUX == 2)
|
2013-01-03 21:32:22 +00:00
|
|
|
_vm->_graphicsManager.fadeOutDefaultLength(screenCopy);
|
2013-03-20 06:27:42 +00:00
|
|
|
screenCopy = _vm->_globals->freeMemory(screenCopy);
|
2012-09-15 00:27:15 +00:00
|
|
|
}
|
2012-12-14 00:49:22 +00:00
|
|
|
|
2012-09-15 00:27:15 +00:00
|
|
|
_vm->_graphicsManager.FADE_LINUX = 0;
|
|
|
|
f.close();
|
2012-12-19 01:15:32 +00:00
|
|
|
_vm->_graphicsManager._skipVideoLockFl = false;
|
2013-02-10 21:26:12 +00:00
|
|
|
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->mouseOn();
|
2012-09-15 00:27:15 +00:00
|
|
|
}
|
|
|
|
|
2012-12-09 21:35:59 +00:00
|
|
|
/**
|
|
|
|
* Play Animation, type 2
|
|
|
|
*/
|
2013-01-29 07:12:43 +00:00
|
|
|
void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, uint32 rate2, uint32 rate3) {
|
2013-01-07 07:33:55 +00:00
|
|
|
byte *screenCopy = NULL;
|
2013-02-03 10:08:37 +00:00
|
|
|
int oldScrollPosX = 0;
|
2013-01-07 07:33:55 +00:00
|
|
|
byte *screenP = NULL;
|
2012-10-04 14:55:25 +00:00
|
|
|
Common::File f;
|
|
|
|
|
2012-10-28 13:00:18 +00:00
|
|
|
if (_vm->shouldQuit())
|
|
|
|
return;
|
|
|
|
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->mouseOff();
|
2013-02-10 21:26:12 +00:00
|
|
|
|
2013-01-07 07:33:55 +00:00
|
|
|
bool hasScreenCopy = false;
|
2012-10-28 13:00:18 +00:00
|
|
|
while (!_vm->shouldQuit()) {
|
2012-12-23 19:36:08 +00:00
|
|
|
memcpy(_vm->_graphicsManager._oldPalette, _vm->_graphicsManager._palette, 769);
|
2012-10-28 07:04:06 +00:00
|
|
|
|
2012-12-19 07:00:22 +00:00
|
|
|
if (_vm->_graphicsManager._lineNbr == SCREEN_WIDTH)
|
2013-01-07 22:56:39 +00:00
|
|
|
_vm->_saveLoadManager.saveFile("TEMP.SCR", _vm->_graphicsManager._vesaScreen, 307200);
|
2012-12-19 07:00:22 +00:00
|
|
|
else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2))
|
2013-01-07 22:56:39 +00:00
|
|
|
_vm->_saveLoadManager.saveFile("TEMP.SCR", _vm->_graphicsManager._vesaScreen, 614400);
|
2013-02-03 10:08:37 +00:00
|
|
|
|
2012-12-19 07:00:22 +00:00
|
|
|
if (!_vm->_graphicsManager._lineNbr)
|
2013-01-01 12:53:07 +00:00
|
|
|
_vm->_graphicsManager._scrollOffset = 0;
|
2012-10-28 07:04:06 +00:00
|
|
|
|
2013-01-07 07:33:55 +00:00
|
|
|
screenP = _vm->_graphicsManager._vesaScreen;
|
2013-01-07 22:56:39 +00:00
|
|
|
if (!f.open(filename))
|
|
|
|
error("Error opening file - %s", filename.c_str());
|
2012-10-04 14:55:25 +00:00
|
|
|
|
2013-02-04 19:38:31 +00:00
|
|
|
f.skip(6);
|
2012-12-23 18:08:23 +00:00
|
|
|
f.read(_vm->_graphicsManager._palette, 800);
|
2013-02-04 19:38:31 +00:00
|
|
|
f.skip(4);
|
2013-02-03 10:22:20 +00:00
|
|
|
size_t nbytes = f.readUint32LE();
|
2013-02-04 19:38:31 +00:00
|
|
|
f.skip(14);
|
2012-10-04 14:55:25 +00:00
|
|
|
|
2013-01-07 07:33:55 +00:00
|
|
|
f.read(screenP, nbytes);
|
2012-12-14 00:49:22 +00:00
|
|
|
|
2012-12-23 18:08:23 +00:00
|
|
|
_vm->_graphicsManager.clearPalette();
|
2013-02-03 10:08:37 +00:00
|
|
|
oldScrollPosX = _vm->_graphicsManager._scrollPosX;
|
2013-02-25 22:40:19 +00:00
|
|
|
_vm->_graphicsManager.setScreenWidth(SCREEN_WIDTH);
|
2012-12-19 01:15:32 +00:00
|
|
|
_vm->_graphicsManager.scrollScreen(0);
|
|
|
|
_vm->_graphicsManager.lockScreen();
|
|
|
|
_vm->_graphicsManager.clearScreen();
|
|
|
|
_vm->_graphicsManager.unlockScreen();
|
2013-03-05 14:42:06 +00:00
|
|
|
|
2013-01-20 10:28:39 +00:00
|
|
|
_vm->_graphicsManager._maxX = SCREEN_WIDTH;
|
2012-12-15 22:28:58 +00:00
|
|
|
if (_vm->_graphicsManager.WinScan / 2 > SCREEN_WIDTH) {
|
2013-01-07 07:33:55 +00:00
|
|
|
hasScreenCopy = true;
|
2013-03-20 06:27:42 +00:00
|
|
|
screenCopy = _vm->_globals->allocMemory(307200);
|
2013-01-07 07:33:55 +00:00
|
|
|
memcpy(screenCopy, screenP, 307200);
|
2012-10-04 14:55:25 +00:00
|
|
|
}
|
2012-12-28 07:51:25 +00:00
|
|
|
if (NO_SEQ) {
|
2013-01-07 07:33:55 +00:00
|
|
|
if (hasScreenCopy)
|
|
|
|
memcpy(screenCopy, _vm->_graphicsManager._vesaBuffer, 307200);
|
|
|
|
_vm->_graphicsManager.setPaletteVGA256(_vm->_graphicsManager._palette);
|
2012-10-04 14:55:25 +00:00
|
|
|
} else {
|
2013-01-07 07:33:55 +00:00
|
|
|
_vm->_graphicsManager.setPaletteVGA256(_vm->_graphicsManager._palette);
|
2012-12-19 01:15:32 +00:00
|
|
|
_vm->_graphicsManager.lockScreen();
|
2013-01-07 07:33:55 +00:00
|
|
|
if (hasScreenCopy)
|
|
|
|
_vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
|
2012-12-15 22:28:58 +00:00
|
|
|
else
|
2013-01-07 07:33:55 +00:00
|
|
|
_vm->_graphicsManager.m_scroll16(screenP, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
|
2013-03-05 14:42:06 +00:00
|
|
|
|
2012-12-19 01:15:32 +00:00
|
|
|
_vm->_graphicsManager.unlockScreen();
|
2013-03-17 15:29:00 +00:00
|
|
|
|
2013-03-09 14:44:46 +00:00
|
|
|
_vm->_graphicsManager.addRefreshRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
2013-02-25 00:42:35 +00:00
|
|
|
_vm->_graphicsManager.updateScreen();
|
2012-10-04 14:55:25 +00:00
|
|
|
}
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->_rateCounter = 0;
|
|
|
|
_vm->_eventsManager->_escKeyFl = false;
|
2013-01-19 23:56:19 +00:00
|
|
|
_vm->_soundManager.loadAnimSound();
|
2013-03-20 06:27:42 +00:00
|
|
|
if (_vm->_globals->iRegul == 1) {
|
2013-03-19 19:40:55 +00:00
|
|
|
while (!_vm->_eventsManager->_escKeyFl && _vm->_eventsManager->_rateCounter < rate1) {
|
|
|
|
_vm->_eventsManager->refreshEvents();
|
2013-02-03 09:19:42 +00:00
|
|
|
}
|
2012-10-04 14:55:25 +00:00
|
|
|
}
|
2013-02-03 09:19:42 +00:00
|
|
|
break;
|
2012-10-04 14:55:25 +00:00
|
|
|
}
|
2013-02-03 09:19:42 +00:00
|
|
|
|
2013-03-19 19:40:55 +00:00
|
|
|
if (!_vm->_eventsManager->_escKeyFl) {
|
|
|
|
_vm->_eventsManager->_rateCounter = 0;
|
2013-02-03 10:08:37 +00:00
|
|
|
int frameNumber = 0;
|
|
|
|
for (;;) {
|
2013-03-19 19:40:55 +00:00
|
|
|
if (_vm->_eventsManager->_escKeyFl)
|
2013-02-03 10:08:37 +00:00
|
|
|
break;
|
|
|
|
++frameNumber;
|
|
|
|
_vm->_soundManager.playAnimSound(frameNumber);
|
2013-02-04 19:38:31 +00:00
|
|
|
byte imageStr[17];
|
2013-02-03 10:22:20 +00:00
|
|
|
if (f.read(imageStr, 16) != 16)
|
2013-02-04 07:24:49 +00:00
|
|
|
break;
|
2013-02-04 19:38:31 +00:00
|
|
|
imageStr[16] = 0;
|
2012-10-04 14:55:25 +00:00
|
|
|
|
2013-02-03 10:22:20 +00:00
|
|
|
if (strncmp((const char *)imageStr, "IMAGE=", 6))
|
2013-02-03 10:08:37 +00:00
|
|
|
break;
|
2013-02-04 07:24:49 +00:00
|
|
|
|
|
|
|
f.read(screenP, READ_LE_UINT32(imageStr + 8));
|
2013-03-20 06:27:42 +00:00
|
|
|
if (_vm->_globals->iRegul == 1) {
|
2013-03-19 19:40:55 +00:00
|
|
|
while (!_vm->_eventsManager->_escKeyFl && _vm->_eventsManager->_rateCounter < rate2) {
|
|
|
|
_vm->_eventsManager->refreshEvents();
|
2013-02-04 07:24:49 +00:00
|
|
|
_vm->_soundManager.checkSoundEnd();
|
2013-02-03 09:27:53 +00:00
|
|
|
}
|
2013-02-04 07:24:49 +00:00
|
|
|
}
|
2013-02-03 09:04:03 +00:00
|
|
|
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->_rateCounter = 0;
|
2013-02-04 07:24:49 +00:00
|
|
|
_vm->_graphicsManager.lockScreen();
|
|
|
|
if (*screenP != kByteStop) {
|
|
|
|
if (hasScreenCopy) {
|
2013-02-20 07:30:16 +00:00
|
|
|
_vm->_graphicsManager.copyWinscanVbe3(screenP, screenCopy);
|
2013-02-04 07:24:49 +00:00
|
|
|
_vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
|
|
|
|
} else {
|
2013-02-20 07:30:16 +00:00
|
|
|
_vm->_graphicsManager.copyVideoVbe16(screenP);
|
2012-10-04 14:55:25 +00:00
|
|
|
}
|
2013-02-04 07:24:49 +00:00
|
|
|
}
|
|
|
|
_vm->_graphicsManager.unlockScreen();
|
2013-03-17 15:29:00 +00:00
|
|
|
|
2013-03-09 14:44:46 +00:00
|
|
|
_vm->_graphicsManager.addRefreshRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
2013-02-25 00:42:35 +00:00
|
|
|
_vm->_graphicsManager.updateScreen();
|
2013-02-04 07:24:49 +00:00
|
|
|
_vm->_soundManager.checkSoundEnd();
|
|
|
|
}
|
|
|
|
|
2013-03-20 06:27:42 +00:00
|
|
|
if (_vm->_globals->iRegul == 1) {
|
2013-03-19 19:40:55 +00:00
|
|
|
while (!_vm->_eventsManager->_escKeyFl && _vm->_eventsManager->_rateCounter < rate3) {
|
|
|
|
_vm->_eventsManager->refreshEvents();
|
2013-02-03 10:08:37 +00:00
|
|
|
_vm->_soundManager.checkSoundEnd();
|
2012-10-04 14:55:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-02-03 10:08:37 +00:00
|
|
|
|
2012-12-19 01:15:32 +00:00
|
|
|
_vm->_graphicsManager._skipVideoLockFl = false;
|
2012-10-04 14:55:25 +00:00
|
|
|
f.close();
|
|
|
|
|
2013-01-07 07:33:55 +00:00
|
|
|
if (_vm->_graphicsManager.FADE_LINUX == 2 && !hasScreenCopy) {
|
2013-02-03 10:22:20 +00:00
|
|
|
f.seek(6);
|
2012-12-23 18:08:23 +00:00
|
|
|
f.read(_vm->_graphicsManager._palette, 800);
|
2013-02-04 19:38:31 +00:00
|
|
|
f.skip(4);
|
2013-02-03 10:22:20 +00:00
|
|
|
size_t nbytes = f.readUint32LE();
|
2013-02-04 19:38:31 +00:00
|
|
|
f.skip(14);
|
2013-01-07 07:33:55 +00:00
|
|
|
f.read(screenP, nbytes);
|
2013-03-20 06:27:42 +00:00
|
|
|
byte *ptra = _vm->_globals->allocMemory(307200);
|
2013-01-07 07:33:55 +00:00
|
|
|
memcpy(ptra, screenP, 307200);
|
2012-10-04 14:55:25 +00:00
|
|
|
|
2013-02-03 10:08:37 +00:00
|
|
|
for (;;) {
|
2013-02-04 19:38:31 +00:00
|
|
|
byte imageStr[17];
|
2013-02-03 10:22:20 +00:00
|
|
|
if (f.read(imageStr, 16) != 16)
|
2013-02-03 10:08:37 +00:00
|
|
|
break;
|
2013-02-04 19:38:31 +00:00
|
|
|
imageStr[16] = 0;
|
|
|
|
|
2013-02-03 10:22:20 +00:00
|
|
|
if (strncmp((const char *)imageStr, "IMAGE=", 6))
|
2013-02-03 10:08:37 +00:00
|
|
|
break;
|
2012-10-04 14:55:25 +00:00
|
|
|
|
2013-02-03 10:22:20 +00:00
|
|
|
f.read(screenP, READ_LE_UINT32(imageStr + 8));
|
2013-02-03 10:08:37 +00:00
|
|
|
if (*screenP != kByteStop)
|
2013-02-20 07:30:16 +00:00
|
|
|
_vm->_graphicsManager.copyWinscanVbe3(screenP, ptra);
|
2013-02-03 10:08:37 +00:00
|
|
|
}
|
2013-01-03 21:32:22 +00:00
|
|
|
_vm->_graphicsManager.fadeOutDefaultLength(ptra);
|
2013-03-20 06:27:42 +00:00
|
|
|
ptra = _vm->_globals->freeMemory(ptra);
|
2012-10-04 14:55:25 +00:00
|
|
|
}
|
2013-01-07 07:33:55 +00:00
|
|
|
if (hasScreenCopy) {
|
2012-10-04 14:55:25 +00:00
|
|
|
if (_vm->_graphicsManager.FADE_LINUX == 2)
|
2013-01-07 07:33:55 +00:00
|
|
|
_vm->_graphicsManager.fadeOutDefaultLength(screenCopy);
|
2013-03-20 06:27:42 +00:00
|
|
|
_vm->_globals->freeMemory(screenCopy);
|
2012-10-04 14:55:25 +00:00
|
|
|
}
|
|
|
|
_vm->_graphicsManager.FADE_LINUX = 0;
|
2012-10-28 07:04:06 +00:00
|
|
|
|
2012-12-19 23:30:01 +00:00
|
|
|
_vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen);
|
2012-10-28 07:04:06 +00:00
|
|
|
g_system->getSavefileManager()->removeSavefile("TEMP.SCR");
|
|
|
|
|
2012-12-23 19:36:08 +00:00
|
|
|
memcpy(_vm->_graphicsManager._palette, _vm->_graphicsManager._oldPalette, 769);
|
2012-12-23 18:08:23 +00:00
|
|
|
_vm->_graphicsManager.clearPalette();
|
2012-12-19 01:15:32 +00:00
|
|
|
_vm->_graphicsManager.lockScreen();
|
|
|
|
_vm->_graphicsManager.clearScreen();
|
|
|
|
_vm->_graphicsManager.unlockScreen();
|
2013-03-05 14:42:06 +00:00
|
|
|
|
2013-02-03 10:08:37 +00:00
|
|
|
_vm->_graphicsManager._scrollPosX = oldScrollPosX;
|
|
|
|
_vm->_graphicsManager.scrollScreen(oldScrollPosX);
|
2013-01-01 20:03:24 +00:00
|
|
|
if (_vm->_graphicsManager._largeScreenFl) {
|
2013-02-25 22:40:19 +00:00
|
|
|
_vm->_graphicsManager.setScreenWidth(2 * SCREEN_WIDTH);
|
2013-02-03 10:22:20 +00:00
|
|
|
_vm->_graphicsManager._maxX = 2 * SCREEN_WIDTH;
|
2012-12-19 01:15:32 +00:00
|
|
|
_vm->_graphicsManager.lockScreen();
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, _vm->_eventsManager->_startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
|
2012-10-04 14:55:25 +00:00
|
|
|
} else {
|
2013-02-25 22:40:19 +00:00
|
|
|
_vm->_graphicsManager.setScreenWidth(SCREEN_WIDTH);
|
2013-01-20 10:28:39 +00:00
|
|
|
_vm->_graphicsManager._maxX = SCREEN_WIDTH;
|
2012-12-19 01:15:32 +00:00
|
|
|
_vm->_graphicsManager.lockScreen();
|
|
|
|
_vm->_graphicsManager.clearScreen();
|
|
|
|
_vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
|
2012-10-04 14:55:25 +00:00
|
|
|
}
|
2012-12-19 01:15:32 +00:00
|
|
|
_vm->_graphicsManager.unlockScreen();
|
2013-03-09 14:44:46 +00:00
|
|
|
_vm->_graphicsManager.addRefreshRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
2013-03-05 14:42:06 +00:00
|
|
|
|
2013-01-03 21:32:22 +00:00
|
|
|
_vm->_graphicsManager.fadeInShort();
|
2013-02-25 00:42:35 +00:00
|
|
|
_vm->_graphicsManager.updateScreen();
|
2013-02-10 21:26:12 +00:00
|
|
|
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->mouseOn();
|
2012-09-30 11:02:39 +00:00
|
|
|
}
|
|
|
|
|
2012-12-09 21:35:59 +00:00
|
|
|
/**
|
|
|
|
* Load Animation
|
|
|
|
*/
|
|
|
|
void AnimationManager::loadAnim(const Common::String &animName) {
|
|
|
|
clearAnim();
|
2012-09-16 07:21:24 +00:00
|
|
|
|
|
|
|
Common::String filename = animName + ".ANI";
|
|
|
|
Common::File f;
|
2013-01-07 22:56:39 +00:00
|
|
|
if (!f.open(filename))
|
|
|
|
error("Failed to open %s", filename.c_str());
|
2012-12-14 00:49:22 +00:00
|
|
|
|
2012-09-16 07:21:24 +00:00
|
|
|
int filesize = f.size();
|
|
|
|
int nbytes = filesize - 115;
|
2013-01-31 07:18:01 +00:00
|
|
|
|
|
|
|
char header[10];
|
|
|
|
char dummyBuf[15];
|
|
|
|
char filename1[15];
|
|
|
|
char filename2[15];
|
|
|
|
char filename3[15];
|
|
|
|
char filename4[15];
|
|
|
|
char filename5[15];
|
|
|
|
char filename6[15];
|
|
|
|
|
2012-09-16 07:21:24 +00:00
|
|
|
f.read(header, 10);
|
2013-01-12 14:19:46 +00:00
|
|
|
f.read(dummyBuf, 15);
|
2012-09-16 07:21:24 +00:00
|
|
|
f.read(filename1, 15);
|
|
|
|
f.read(filename2, 15);
|
|
|
|
f.read(filename3, 15);
|
|
|
|
f.read(filename4, 15);
|
|
|
|
f.read(filename5, 15);
|
|
|
|
f.read(filename6, 15);
|
|
|
|
|
2013-01-29 23:17:08 +00:00
|
|
|
if (READ_BE_UINT32(header) != MKTAG('A', 'N', 'I', 'S'))
|
2013-01-12 14:19:46 +00:00
|
|
|
error("Invalid animation File: %s", filename.c_str());
|
2012-09-16 07:21:24 +00:00
|
|
|
|
|
|
|
const char *files[6] = { &filename1[0], &filename2[0], &filename3[0], &filename4[0],
|
|
|
|
&filename5[0], &filename6[0] };
|
|
|
|
|
2012-12-22 00:28:31 +00:00
|
|
|
for (int idx = 0; idx <= 5; ++idx) {
|
|
|
|
if (files[idx][0]) {
|
2013-01-07 22:56:39 +00:00
|
|
|
if (!f.exists(files[idx]))
|
2013-01-12 14:19:46 +00:00
|
|
|
error("Missing file %s in animation File: %s", files[idx], filename.c_str());
|
2012-12-22 00:28:31 +00:00
|
|
|
if (loadSpriteBank(idx + 1, files[idx]))
|
2013-01-12 14:19:46 +00:00
|
|
|
error("Invalid sprite bank in animation File: %s", filename.c_str());
|
2012-09-16 07:21:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-20 06:27:42 +00:00
|
|
|
byte *data = _vm->_globals->allocMemory(nbytes + 1);
|
2012-09-16 07:21:24 +00:00
|
|
|
f.read(data, nbytes);
|
|
|
|
f.close();
|
|
|
|
|
2012-12-22 00:28:31 +00:00
|
|
|
for (int idx = 1; idx <= 20; ++idx)
|
2012-12-09 21:35:59 +00:00
|
|
|
searchAnim(data, idx, nbytes);
|
2012-09-16 07:21:24 +00:00
|
|
|
|
2013-03-20 06:27:42 +00:00
|
|
|
_vm->_globals->freeMemory(data);
|
2012-09-16 07:21:24 +00:00
|
|
|
}
|
|
|
|
|
2012-12-09 21:35:59 +00:00
|
|
|
/**
|
|
|
|
* Clear animation
|
|
|
|
*/
|
|
|
|
void AnimationManager::clearAnim() {
|
2012-09-16 07:21:24 +00:00
|
|
|
for (int idx = 0; idx < 35; ++idx) {
|
2013-03-20 06:27:42 +00:00
|
|
|
_vm->_globals->_animBqe[idx]._data = _vm->_globals->freeMemory(_vm->_globals->_animBqe[idx]._data);
|
|
|
|
_vm->_globals->_animBqe[idx]._enabledFl = false;
|
2012-09-16 07:21:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (int idx = 0; idx < 8; ++idx) {
|
2013-03-20 06:27:42 +00:00
|
|
|
_vm->_globals->Bank[idx]._data = _vm->_globals->freeMemory(_vm->_globals->Bank[idx]._data);
|
|
|
|
_vm->_globals->Bank[idx]._loadedFl = false;
|
|
|
|
_vm->_globals->Bank[idx]._filename = "";
|
|
|
|
_vm->_globals->Bank[idx]._fileHeader = 0;
|
2012-09-16 07:21:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-12-09 21:35:59 +00:00
|
|
|
/**
|
|
|
|
* Load Sprite Bank
|
|
|
|
*/
|
|
|
|
int AnimationManager::loadSpriteBank(int idx, const Common::String &filename) {
|
2012-09-16 07:21:24 +00:00
|
|
|
int result = 0;
|
2013-03-20 06:27:42 +00:00
|
|
|
_vm->_globals->Bank[idx]._loadedFl = true;
|
|
|
|
_vm->_globals->Bank[idx]._filename = filename;
|
2012-09-16 07:21:24 +00:00
|
|
|
|
2013-03-19 20:57:28 +00:00
|
|
|
byte *fileDataPtr = _vm->_fileManager->loadFile(filename);
|
2012-09-16 07:21:24 +00:00
|
|
|
|
2013-03-20 06:27:42 +00:00
|
|
|
_vm->_globals->Bank[idx]._fileHeader = 0;
|
2012-12-29 22:57:50 +00:00
|
|
|
if (fileDataPtr[1] == 'L' && fileDataPtr[2] == 'E')
|
2013-03-20 06:27:42 +00:00
|
|
|
_vm->_globals->Bank[idx]._fileHeader = 1;
|
2012-12-29 22:57:50 +00:00
|
|
|
else if (fileDataPtr[1] == 'O' && fileDataPtr[2] == 'R')
|
2013-03-20 06:27:42 +00:00
|
|
|
_vm->_globals->Bank[idx]._fileHeader = 2;
|
2012-12-14 00:49:22 +00:00
|
|
|
|
2013-03-20 06:27:42 +00:00
|
|
|
if (!_vm->_globals->Bank[idx]._fileHeader) {
|
|
|
|
_vm->_globals->freeMemory(fileDataPtr);
|
|
|
|
_vm->_globals->Bank[idx]._loadedFl = false;
|
2013-01-12 14:19:46 +00:00
|
|
|
result = -1;
|
|
|
|
}
|
|
|
|
|
2013-03-20 06:27:42 +00:00
|
|
|
_vm->_globals->Bank[idx]._data = fileDataPtr;
|
2013-01-12 14:19:46 +00:00
|
|
|
|
2013-01-21 06:50:12 +00:00
|
|
|
int objectDataIdx = 0;
|
|
|
|
for(objectDataIdx = 0; objectDataIdx <= 249; objectDataIdx++) {
|
2013-02-04 19:38:31 +00:00
|
|
|
int width = _vm->_objectsManager.getWidth(fileDataPtr, objectDataIdx);
|
|
|
|
int height = _vm->_objectsManager.getHeight(fileDataPtr, objectDataIdx);
|
2013-01-12 14:19:46 +00:00
|
|
|
if (!width && !height)
|
|
|
|
break;
|
|
|
|
}
|
2012-12-14 00:49:22 +00:00
|
|
|
|
2013-01-21 06:50:12 +00:00
|
|
|
if (objectDataIdx > 249) {
|
2013-03-20 06:27:42 +00:00
|
|
|
_vm->_globals->freeMemory(fileDataPtr);
|
|
|
|
_vm->_globals->Bank[idx]._loadedFl = false;
|
2013-01-12 14:19:46 +00:00
|
|
|
result = -2;
|
|
|
|
}
|
2013-03-20 06:27:42 +00:00
|
|
|
_vm->_globals->Bank[idx]._objDataIdx = objectDataIdx;
|
2012-12-14 00:49:22 +00:00
|
|
|
|
2013-03-20 06:27:42 +00:00
|
|
|
Common::String ofsFilename = _vm->_globals->Bank[idx]._filename;
|
2013-01-12 14:19:46 +00:00
|
|
|
char ch;
|
|
|
|
do {
|
|
|
|
ch = ofsFilename.lastChar();
|
|
|
|
ofsFilename.deleteLastChar();
|
|
|
|
} while (ch != '.');
|
|
|
|
ofsFilename += ".OFS";
|
2012-12-14 00:49:22 +00:00
|
|
|
|
2013-01-12 14:19:46 +00:00
|
|
|
Common::File f;
|
|
|
|
if (f.exists(ofsFilename)) {
|
2013-03-19 20:57:28 +00:00
|
|
|
byte *ofsData = _vm->_fileManager->loadFile(ofsFilename);
|
2013-01-21 06:50:12 +00:00
|
|
|
byte *curOfsData = ofsData;
|
2013-03-20 06:27:42 +00:00
|
|
|
for (int objIdx = 0; objIdx < _vm->_globals->Bank[idx]._objDataIdx; ++objIdx, curOfsData += 8) {
|
2013-02-18 00:37:21 +00:00
|
|
|
int x1 = READ_LE_INT16(curOfsData);
|
|
|
|
int y1 = READ_LE_INT16(curOfsData + 2);
|
|
|
|
int x2 = READ_LE_INT16(curOfsData + 4);
|
|
|
|
int y2 = READ_LE_INT16(curOfsData + 6);
|
2013-01-12 14:19:46 +00:00
|
|
|
|
2013-03-20 06:27:42 +00:00
|
|
|
_vm->_objectsManager.setOffsetXY(_vm->_globals->Bank[idx]._data, objIdx, x1, y1, 0);
|
|
|
|
if (_vm->_globals->Bank[idx]._fileHeader == 2)
|
|
|
|
_vm->_objectsManager.setOffsetXY(_vm->_globals->Bank[idx]._data, objIdx, x2, y2, 1);
|
2012-09-16 07:21:24 +00:00
|
|
|
}
|
2013-01-12 14:19:46 +00:00
|
|
|
|
2013-03-20 06:27:42 +00:00
|
|
|
_vm->_globals->freeMemory(ofsData);
|
2013-01-12 14:19:46 +00:00
|
|
|
result = 0;
|
2012-09-16 07:21:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2012-12-14 00:49:22 +00:00
|
|
|
/**
|
2012-12-09 21:35:59 +00:00
|
|
|
* Search Animation
|
|
|
|
*/
|
2013-01-31 07:24:34 +00:00
|
|
|
void AnimationManager::searchAnim(const byte *data, int animIndex, int bufSize) {
|
|
|
|
for (int dataIdx = 0; dataIdx <= bufSize; dataIdx++) {
|
2013-01-31 07:18:01 +00:00
|
|
|
if (READ_BE_UINT32(&data[dataIdx]) == MKTAG('A', 'N', 'I', 'M')) {
|
|
|
|
int entryIndex = data[dataIdx + 4];
|
2012-10-15 21:51:31 +00:00
|
|
|
if (animIndex == entryIndex) {
|
2013-01-31 07:24:34 +00:00
|
|
|
int curBufferPos = dataIdx + 5;
|
|
|
|
int count = 0;
|
2012-12-28 07:51:25 +00:00
|
|
|
bool innerLoopCond = false;
|
2012-09-16 07:21:24 +00:00
|
|
|
do {
|
2013-01-31 07:24:34 +00:00
|
|
|
if (READ_BE_UINT32(&data[curBufferPos]) == MKTAG('A', 'N', 'I', 'M') || READ_BE_UINT24(&data[curBufferPos]) == MKTAG24('F', 'I', 'N'))
|
2012-12-28 07:51:25 +00:00
|
|
|
innerLoopCond = true;
|
2013-01-31 07:24:34 +00:00
|
|
|
if (bufSize < curBufferPos) {
|
2013-03-20 06:27:42 +00:00
|
|
|
_vm->_globals->_animBqe[animIndex]._enabledFl = false;
|
|
|
|
_vm->_globals->_animBqe[animIndex]._data = g_PTRNUL;
|
2012-10-15 21:51:31 +00:00
|
|
|
return;
|
2012-09-16 07:21:24 +00:00
|
|
|
}
|
2013-01-31 07:24:34 +00:00
|
|
|
++curBufferPos;
|
|
|
|
++count;
|
2012-12-28 07:51:25 +00:00
|
|
|
} while (!innerLoopCond);
|
2013-03-20 06:27:42 +00:00
|
|
|
_vm->_globals->_animBqe[animIndex]._data = _vm->_globals->allocMemory(count + 50);
|
|
|
|
_vm->_globals->_animBqe[animIndex]._enabledFl = true;
|
|
|
|
memcpy(_vm->_globals->_animBqe[animIndex]._data, data + dataIdx + 5, 20);
|
2012-09-16 07:21:24 +00:00
|
|
|
|
2013-03-20 06:27:42 +00:00
|
|
|
byte *dataP = _vm->_globals->_animBqe[animIndex]._data;
|
2013-01-31 07:24:34 +00:00
|
|
|
int curDestDataIndx = 20;
|
|
|
|
int curSrcDataIndx = dataIdx + 25;
|
2012-10-15 21:51:31 +00:00
|
|
|
|
2013-01-31 07:24:34 +00:00
|
|
|
for (int i = 0; i <= 4999; i++) {
|
2013-01-31 22:52:01 +00:00
|
|
|
memcpy(dataP + curDestDataIndx, data + curSrcDataIndx, 10);
|
|
|
|
if (!READ_LE_UINT16(data + curSrcDataIndx + 4))
|
|
|
|
break;
|
2013-01-31 07:24:34 +00:00
|
|
|
curDestDataIndx += 10;
|
|
|
|
curSrcDataIndx += 10;
|
2012-11-21 07:04:50 +00:00
|
|
|
}
|
2013-01-31 07:18:01 +00:00
|
|
|
break;
|
2012-09-16 07:21:24 +00:00
|
|
|
}
|
|
|
|
}
|
2013-01-31 07:18:01 +00:00
|
|
|
if (READ_BE_UINT24(&data[dataIdx]) == MKTAG24('F', 'I', 'N'))
|
|
|
|
break;
|
|
|
|
}
|
2012-09-16 07:21:24 +00:00
|
|
|
}
|
|
|
|
|
2012-12-09 21:35:59 +00:00
|
|
|
/**
|
|
|
|
* Play sequence
|
|
|
|
*/
|
2013-02-03 21:51:34 +00:00
|
|
|
void AnimationManager::playSequence(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3, bool skipEscFl) {
|
2012-10-28 13:00:18 +00:00
|
|
|
if (_vm->shouldQuit())
|
|
|
|
return;
|
|
|
|
|
2013-01-07 07:33:55 +00:00
|
|
|
bool hasScreenCopy = false;
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->_mouseFl = false;
|
2012-10-04 22:09:09 +00:00
|
|
|
if (!NO_COUL) {
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->refreshScreenAndEvents();
|
2012-10-28 07:04:06 +00:00
|
|
|
|
2012-12-19 07:00:22 +00:00
|
|
|
if (_vm->_graphicsManager._lineNbr == SCREEN_WIDTH)
|
2013-01-07 22:56:39 +00:00
|
|
|
_vm->_saveLoadManager.saveFile("TEMP.SCR", _vm->_graphicsManager._vesaScreen, 307200);
|
2012-12-19 07:00:22 +00:00
|
|
|
else if (_vm->_graphicsManager._lineNbr == (SCREEN_WIDTH * 2))
|
2013-01-07 22:56:39 +00:00
|
|
|
_vm->_saveLoadManager.saveFile("TEMP.SCR", _vm->_graphicsManager._vesaScreen, 614400);
|
2012-12-19 07:00:22 +00:00
|
|
|
if (!_vm->_graphicsManager._lineNbr)
|
2013-01-01 12:53:07 +00:00
|
|
|
_vm->_graphicsManager._scrollOffset = 0;
|
2012-10-04 22:09:09 +00:00
|
|
|
}
|
2013-02-03 22:07:51 +00:00
|
|
|
byte *screenP = _vm->_graphicsManager._vesaScreen;
|
|
|
|
Common::File f;
|
2013-01-07 22:56:39 +00:00
|
|
|
if (!f.open(file))
|
|
|
|
error("Error opening file - %s", file.c_str());
|
2012-10-04 22:09:09 +00:00
|
|
|
|
2012-11-17 23:16:05 +00:00
|
|
|
f.skip(6);
|
2012-12-23 18:08:23 +00:00
|
|
|
f.read(_vm->_graphicsManager._palette, 800);
|
2012-11-17 23:16:05 +00:00
|
|
|
f.skip(4);
|
2013-02-03 22:07:51 +00:00
|
|
|
size_t nbytes = f.readUint32LE();
|
2012-11-17 23:16:05 +00:00
|
|
|
f.skip(14);
|
2013-01-07 07:33:55 +00:00
|
|
|
f.read(screenP, nbytes);
|
2012-10-04 22:09:09 +00:00
|
|
|
|
2013-02-03 22:07:51 +00:00
|
|
|
byte *screenCopy = NULL;
|
2012-12-15 22:28:58 +00:00
|
|
|
if (_vm->_graphicsManager.WinScan / 2 > SCREEN_WIDTH) {
|
2013-01-07 07:33:55 +00:00
|
|
|
hasScreenCopy = true;
|
2013-03-20 06:27:42 +00:00
|
|
|
screenCopy = _vm->_globals->allocMemory(307200);
|
2013-01-07 07:33:55 +00:00
|
|
|
memcpy(screenCopy, screenP, 307200);
|
2012-10-04 22:09:09 +00:00
|
|
|
}
|
2012-12-28 07:51:25 +00:00
|
|
|
if (NO_SEQ) {
|
2013-01-07 07:33:55 +00:00
|
|
|
if (hasScreenCopy)
|
|
|
|
memcpy(screenCopy, _vm->_graphicsManager._vesaBuffer, 307200);
|
2012-11-15 12:34:15 +00:00
|
|
|
if (!_vm->getIsDemo()) {
|
|
|
|
_vm->_graphicsManager.SETCOLOR3(252, 100, 100, 100);
|
|
|
|
_vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100);
|
|
|
|
_vm->_graphicsManager.SETCOLOR3(251, 100, 100, 100);
|
|
|
|
_vm->_graphicsManager.SETCOLOR3(254, 0, 0, 0);
|
|
|
|
}
|
2013-01-07 07:33:55 +00:00
|
|
|
_vm->_graphicsManager.setPaletteVGA256(_vm->_graphicsManager._palette);
|
2012-10-04 22:09:09 +00:00
|
|
|
} else {
|
2012-12-19 01:15:32 +00:00
|
|
|
_vm->_graphicsManager.lockScreen();
|
2013-01-07 07:33:55 +00:00
|
|
|
if (hasScreenCopy)
|
|
|
|
_vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
|
2012-12-15 22:28:58 +00:00
|
|
|
else
|
2013-01-07 07:33:55 +00:00
|
|
|
_vm->_graphicsManager.m_scroll16(screenP, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
|
2012-12-19 01:15:32 +00:00
|
|
|
_vm->_graphicsManager.unlockScreen();
|
2013-03-05 14:42:06 +00:00
|
|
|
|
2013-03-17 15:29:00 +00:00
|
|
|
_vm->_graphicsManager.addRefreshRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
2013-02-25 00:42:35 +00:00
|
|
|
_vm->_graphicsManager.updateScreen();
|
2012-10-04 22:09:09 +00:00
|
|
|
}
|
2013-02-03 22:07:51 +00:00
|
|
|
bool skipFl = false;
|
2012-11-15 12:34:15 +00:00
|
|
|
if (_vm->getIsDemo()) {
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->_rateCounter = 0;
|
|
|
|
_vm->_eventsManager->_escKeyFl = false;
|
2013-01-19 23:56:19 +00:00
|
|
|
_vm->_soundManager.loadAnimSound();
|
2013-03-20 06:27:42 +00:00
|
|
|
if (_vm->_globals->iRegul == 1) {
|
2012-11-15 12:34:15 +00:00
|
|
|
do {
|
2013-03-19 19:40:55 +00:00
|
|
|
if (_vm->shouldQuit() || (_vm->_eventsManager->_escKeyFl && !skipEscFl)) {
|
2013-02-03 22:07:51 +00:00
|
|
|
skipFl = true;
|
2013-02-03 21:28:38 +00:00
|
|
|
break;
|
2013-02-03 22:07:51 +00:00
|
|
|
}
|
2013-02-03 21:28:38 +00:00
|
|
|
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->_escKeyFl = false;
|
|
|
|
_vm->_eventsManager->refreshEvents();
|
2013-01-19 23:56:19 +00:00
|
|
|
_vm->_soundManager.checkSoundEnd();
|
2013-03-19 19:40:55 +00:00
|
|
|
} while (_vm->_eventsManager->_rateCounter < rate1);
|
2012-11-15 12:34:15 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (NO_COUL)
|
2013-01-07 07:33:55 +00:00
|
|
|
_vm->_graphicsManager.fadeInDefaultLength(screenP);
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->_rateCounter = 0;
|
|
|
|
_vm->_eventsManager->_escKeyFl = false;
|
2013-01-19 23:56:19 +00:00
|
|
|
_vm->_soundManager.loadAnimSound();
|
2013-03-20 06:27:42 +00:00
|
|
|
if (_vm->_globals->iRegul == 1) {
|
2012-11-15 12:34:15 +00:00
|
|
|
do {
|
2013-03-19 19:40:55 +00:00
|
|
|
if (_vm->shouldQuit() || (_vm->_eventsManager->_escKeyFl && !skipEscFl)) {
|
2013-02-03 22:07:51 +00:00
|
|
|
skipFl = true;
|
2013-02-03 21:28:38 +00:00
|
|
|
break;
|
2013-02-03 22:07:51 +00:00
|
|
|
}
|
2013-02-03 21:28:38 +00:00
|
|
|
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->_escKeyFl = false;
|
|
|
|
_vm->_eventsManager->refreshEvents();
|
2013-01-19 23:56:19 +00:00
|
|
|
_vm->_soundManager.checkSoundEnd();
|
2013-03-19 19:40:55 +00:00
|
|
|
} while (_vm->_eventsManager->_rateCounter < rate1);
|
2012-11-15 12:34:15 +00:00
|
|
|
}
|
2012-10-04 22:09:09 +00:00
|
|
|
}
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->_rateCounter = 0;
|
2013-02-03 21:28:38 +00:00
|
|
|
if (!skipFl) {
|
2013-03-18 07:19:33 +00:00
|
|
|
int soundNumber = 0;
|
2013-02-04 07:24:49 +00:00
|
|
|
for (;;) {
|
2013-02-03 21:28:38 +00:00
|
|
|
++soundNumber;
|
|
|
|
_vm->_soundManager.playAnimSound(soundNumber);
|
2013-02-04 19:38:31 +00:00
|
|
|
byte imageStr[17];
|
2013-02-04 07:24:49 +00:00
|
|
|
if (f.read(imageStr, 16) != 16)
|
|
|
|
break;
|
2013-02-04 19:38:31 +00:00
|
|
|
imageStr[16] = 0;
|
2013-02-03 21:28:38 +00:00
|
|
|
|
2013-02-04 07:24:49 +00:00
|
|
|
if (strncmp((const char *)imageStr, "IMAGE=", 6))
|
|
|
|
break;
|
2013-02-03 21:28:38 +00:00
|
|
|
|
2013-02-04 07:24:49 +00:00
|
|
|
f.read(screenP, READ_LE_UINT32(imageStr + 8));
|
2013-03-20 06:27:42 +00:00
|
|
|
if (_vm->_globals->iRegul == 1) {
|
2013-02-04 07:24:49 +00:00
|
|
|
do {
|
2013-03-19 19:40:55 +00:00
|
|
|
if (_vm->shouldQuit() || (_vm->_eventsManager->_escKeyFl && !skipEscFl)) {
|
2013-02-04 07:24:49 +00:00
|
|
|
skipFl = true;
|
|
|
|
break;
|
2012-10-04 22:09:09 +00:00
|
|
|
}
|
2013-02-04 07:24:49 +00:00
|
|
|
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->_escKeyFl = false;
|
|
|
|
_vm->_eventsManager->refreshEvents();
|
2013-02-04 07:24:49 +00:00
|
|
|
_vm->_soundManager.checkSoundEnd();
|
2013-03-19 19:40:55 +00:00
|
|
|
} while (_vm->_eventsManager->_rateCounter < rate2);
|
2013-02-04 07:24:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (skipFl)
|
|
|
|
break;
|
|
|
|
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->_rateCounter = 0;
|
2013-02-04 07:24:49 +00:00
|
|
|
_vm->_graphicsManager.lockScreen();
|
|
|
|
if (hasScreenCopy) {
|
|
|
|
if (*screenP != kByteStop) {
|
2013-02-20 07:30:16 +00:00
|
|
|
_vm->_graphicsManager.copyWinscanVbe(screenP, screenCopy);
|
2013-02-04 07:24:49 +00:00
|
|
|
_vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
|
2012-10-04 22:09:09 +00:00
|
|
|
}
|
2013-02-04 07:24:49 +00:00
|
|
|
} else if (*screenP != kByteStop) {
|
2013-02-20 07:30:16 +00:00
|
|
|
_vm->_graphicsManager.copyVideoVbe16a(screenP);
|
2012-10-04 22:09:09 +00:00
|
|
|
}
|
2013-02-04 07:24:49 +00:00
|
|
|
_vm->_graphicsManager.unlockScreen();
|
2013-03-05 14:42:06 +00:00
|
|
|
|
2013-03-17 15:29:00 +00:00
|
|
|
_vm->_graphicsManager.addRefreshRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
2013-02-25 00:42:35 +00:00
|
|
|
_vm->_graphicsManager.updateScreen();
|
2013-02-04 07:24:49 +00:00
|
|
|
_vm->_soundManager.checkSoundEnd();
|
|
|
|
}
|
2013-02-03 21:28:38 +00:00
|
|
|
}
|
2012-11-17 23:16:05 +00:00
|
|
|
|
2013-03-20 06:27:42 +00:00
|
|
|
if (_vm->_globals->iRegul == 1 && !skipFl) {
|
2012-10-04 22:09:09 +00:00
|
|
|
do {
|
2013-03-19 19:40:55 +00:00
|
|
|
if (_vm->shouldQuit() || (_vm->_eventsManager->_escKeyFl && !skipEscFl)) {
|
2013-02-03 22:07:51 +00:00
|
|
|
skipFl = true;
|
2013-02-03 21:28:38 +00:00
|
|
|
break;
|
2013-02-03 22:07:51 +00:00
|
|
|
}
|
|
|
|
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->_escKeyFl = false;
|
|
|
|
_vm->_eventsManager->refreshEvents();
|
2013-01-19 23:56:19 +00:00
|
|
|
_vm->_soundManager.checkSoundEnd();
|
2013-03-19 19:40:55 +00:00
|
|
|
} while (_vm->_eventsManager->_rateCounter < rate3);
|
2012-10-04 22:09:09 +00:00
|
|
|
}
|
2013-02-03 21:28:38 +00:00
|
|
|
|
|
|
|
if (!skipFl)
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->_rateCounter = 0;
|
2013-02-03 21:28:38 +00:00
|
|
|
|
2012-12-19 01:15:32 +00:00
|
|
|
_vm->_graphicsManager._skipVideoLockFl = false;
|
2012-10-04 22:09:09 +00:00
|
|
|
f.close();
|
|
|
|
|
|
|
|
if (!NO_COUL) {
|
2012-12-19 23:30:01 +00:00
|
|
|
_vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager._vesaScreen);
|
2012-10-28 07:04:06 +00:00
|
|
|
g_system->getSavefileManager()->removeSavefile("TEMP.SCR");
|
|
|
|
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->_mouseFl = true;
|
2012-10-04 22:09:09 +00:00
|
|
|
}
|
2013-01-07 07:33:55 +00:00
|
|
|
if (hasScreenCopy)
|
2013-03-20 06:27:42 +00:00
|
|
|
_vm->_globals->freeMemory(screenCopy);
|
2012-10-04 22:09:09 +00:00
|
|
|
}
|
|
|
|
|
2012-12-09 21:35:59 +00:00
|
|
|
/**
|
|
|
|
* Play Sequence type 2
|
|
|
|
*/
|
|
|
|
void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3) {
|
2013-01-07 07:33:55 +00:00
|
|
|
byte *screenCopy = NULL;
|
|
|
|
byte *screenP;
|
2013-02-04 07:06:50 +00:00
|
|
|
int frameNumber;
|
2012-10-05 13:52:59 +00:00
|
|
|
Common::File f;
|
|
|
|
|
2013-01-06 22:12:34 +00:00
|
|
|
bool multiScreenFl = false;
|
2012-10-28 12:36:57 +00:00
|
|
|
for (;;) {
|
|
|
|
if (_vm->shouldQuit())
|
|
|
|
return;
|
|
|
|
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->_mouseFl = false;
|
2013-01-07 07:33:55 +00:00
|
|
|
screenP = _vm->_graphicsManager._vesaScreen;
|
2012-10-05 13:52:59 +00:00
|
|
|
|
2013-01-07 22:56:39 +00:00
|
|
|
if (!f.open(file))
|
|
|
|
error("File not found - %s", file.c_str());
|
2012-10-05 13:52:59 +00:00
|
|
|
|
2012-10-28 12:36:57 +00:00
|
|
|
f.skip(6);
|
2012-12-23 18:08:23 +00:00
|
|
|
f.read(_vm->_graphicsManager._palette, 800);
|
2012-10-28 12:36:57 +00:00
|
|
|
f.skip(4);
|
2013-02-04 19:38:31 +00:00
|
|
|
size_t nbytes = f.readUint32LE();
|
|
|
|
f.skip(14);
|
2013-01-07 07:33:55 +00:00
|
|
|
f.read(screenP, nbytes);
|
2012-10-05 13:52:59 +00:00
|
|
|
|
2012-12-15 22:28:58 +00:00
|
|
|
if (_vm->_graphicsManager.WinScan / 2 > SCREEN_WIDTH) {
|
2013-01-06 22:12:34 +00:00
|
|
|
multiScreenFl = true;
|
2013-03-20 06:27:42 +00:00
|
|
|
screenCopy = _vm->_globals->allocMemory(307200);
|
2013-01-07 07:33:55 +00:00
|
|
|
memcpy((void *)screenCopy, screenP, 307200);
|
2012-10-05 13:52:59 +00:00
|
|
|
}
|
2012-12-28 07:51:25 +00:00
|
|
|
if (NO_SEQ) {
|
2013-01-06 22:12:34 +00:00
|
|
|
if (multiScreenFl) {
|
2013-01-07 07:33:55 +00:00
|
|
|
assert(screenCopy != NULL);
|
|
|
|
memcpy((void *)screenCopy, _vm->_graphicsManager._vesaBuffer, 307200);
|
2012-10-28 12:36:57 +00:00
|
|
|
}
|
2013-01-07 07:33:55 +00:00
|
|
|
_vm->_graphicsManager.setPaletteVGA256(_vm->_graphicsManager._palette);
|
2012-10-05 13:52:59 +00:00
|
|
|
} else {
|
2012-12-19 01:15:32 +00:00
|
|
|
_vm->_graphicsManager.lockScreen();
|
2013-01-07 07:33:55 +00:00
|
|
|
_vm->_graphicsManager.setPaletteVGA256(_vm->_graphicsManager._palette);
|
2013-01-06 22:12:34 +00:00
|
|
|
if (multiScreenFl)
|
2013-01-07 07:33:55 +00:00
|
|
|
_vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
|
2012-12-15 22:28:58 +00:00
|
|
|
else
|
2013-01-07 07:33:55 +00:00
|
|
|
_vm->_graphicsManager.m_scroll16(screenP, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
|
2012-12-19 01:15:32 +00:00
|
|
|
_vm->_graphicsManager.unlockScreen();
|
2013-03-05 14:42:06 +00:00
|
|
|
|
2013-03-17 15:29:00 +00:00
|
|
|
_vm->_graphicsManager.addRefreshRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
2013-02-25 00:42:35 +00:00
|
|
|
_vm->_graphicsManager.updateScreen();
|
2012-10-05 13:52:59 +00:00
|
|
|
}
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->_rateCounter = 0;
|
|
|
|
_vm->_eventsManager->_escKeyFl = false;
|
2013-01-19 23:56:19 +00:00
|
|
|
_vm->_soundManager.loadAnimSound();
|
2013-03-20 06:27:42 +00:00
|
|
|
if (_vm->_globals->iRegul == 1) {
|
2013-02-04 07:06:50 +00:00
|
|
|
do {
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->refreshEvents();
|
2013-02-04 07:06:50 +00:00
|
|
|
_vm->_soundManager.checkSoundEnd();
|
2013-03-19 19:40:55 +00:00
|
|
|
} while (!_vm->shouldQuit() && !_vm->_eventsManager->_escKeyFl && _vm->_eventsManager->_rateCounter < rate1);
|
2012-10-05 13:52:59 +00:00
|
|
|
}
|
2013-02-04 07:06:50 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-03-19 19:40:55 +00:00
|
|
|
if (!_vm->_eventsManager->_escKeyFl) {
|
|
|
|
_vm->_eventsManager->_rateCounter = 0;
|
2013-02-04 07:06:50 +00:00
|
|
|
frameNumber = 0;
|
|
|
|
while (!_vm->shouldQuit()) {
|
|
|
|
_vm->_soundManager.playAnimSound(frameNumber++);
|
|
|
|
|
2013-02-04 19:38:31 +00:00
|
|
|
byte imageStr[17];
|
2013-02-04 07:24:49 +00:00
|
|
|
if (f.read(imageStr, 16) != 16)
|
2013-02-04 07:06:50 +00:00
|
|
|
break;
|
2013-02-04 19:38:31 +00:00
|
|
|
imageStr[16] = 0;
|
2013-02-04 07:06:50 +00:00
|
|
|
|
2013-02-04 07:24:49 +00:00
|
|
|
if (strncmp((const char *)imageStr, "IMAGE=", 6))
|
2013-02-04 07:06:50 +00:00
|
|
|
break;
|
|
|
|
|
2013-02-04 07:24:49 +00:00
|
|
|
f.read(screenP, READ_LE_UINT32(imageStr + 8));
|
2013-03-20 06:27:42 +00:00
|
|
|
if (_vm->_globals->iRegul == 1) {
|
2013-02-04 07:06:50 +00:00
|
|
|
do {
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->refreshEvents();
|
|
|
|
} while (!_vm->shouldQuit() && !_vm->_eventsManager->_escKeyFl && _vm->_eventsManager->_rateCounter < rate2);
|
2013-02-04 07:06:50 +00:00
|
|
|
}
|
|
|
|
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->_rateCounter = 0;
|
2013-02-04 07:06:50 +00:00
|
|
|
_vm->_graphicsManager.lockScreen();
|
|
|
|
if (multiScreenFl) {
|
|
|
|
if (*screenP != kByteStop) {
|
2013-02-20 07:30:16 +00:00
|
|
|
_vm->_graphicsManager.copyWinscanVbe(screenP, screenCopy);
|
2013-02-04 07:06:50 +00:00
|
|
|
_vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
|
2012-10-05 13:52:59 +00:00
|
|
|
}
|
2013-02-04 07:06:50 +00:00
|
|
|
} else if (*screenP != kByteStop) {
|
2013-02-20 07:30:16 +00:00
|
|
|
_vm->_graphicsManager.copyVideoVbe16a(screenP);
|
2012-10-05 13:52:59 +00:00
|
|
|
}
|
2013-02-04 07:06:50 +00:00
|
|
|
_vm->_graphicsManager.unlockScreen();
|
2013-03-17 15:29:00 +00:00
|
|
|
|
2013-03-09 14:44:46 +00:00
|
|
|
_vm->_graphicsManager.addRefreshRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
2013-02-25 00:42:35 +00:00
|
|
|
_vm->_graphicsManager.updateScreen();
|
2013-02-04 07:06:50 +00:00
|
|
|
_vm->_soundManager.checkSoundEnd();
|
2012-10-05 13:52:59 +00:00
|
|
|
}
|
|
|
|
}
|
2013-02-04 07:06:50 +00:00
|
|
|
|
2013-03-20 06:27:42 +00:00
|
|
|
if (_vm->_globals->iRegul == 1) {
|
2013-02-15 02:08:00 +00:00
|
|
|
// Wait for third rate delay
|
|
|
|
do {
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->refreshEvents();
|
2013-02-04 07:06:50 +00:00
|
|
|
_vm->_soundManager.checkSoundEnd();
|
2013-03-19 19:40:55 +00:00
|
|
|
} while (!_vm->shouldQuit() && !_vm->_eventsManager->_escKeyFl && _vm->_eventsManager->_rateCounter < rate3);
|
2012-10-05 13:52:59 +00:00
|
|
|
}
|
2013-02-04 07:06:50 +00:00
|
|
|
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->_rateCounter = 0;
|
2013-02-04 07:06:50 +00:00
|
|
|
|
2013-01-06 22:12:34 +00:00
|
|
|
if (_vm->_graphicsManager.FADE_LINUX == 2 && !multiScreenFl) {
|
2013-03-20 06:27:42 +00:00
|
|
|
byte *ptra = _vm->_globals->allocMemory(307200);
|
2012-12-14 00:49:22 +00:00
|
|
|
|
2013-02-04 19:38:31 +00:00
|
|
|
f.seek(6);
|
2012-12-23 18:08:23 +00:00
|
|
|
f.read(_vm->_graphicsManager._palette, 800);
|
2012-10-28 12:36:57 +00:00
|
|
|
f.skip(4);
|
2013-02-04 19:38:31 +00:00
|
|
|
size_t nbytes = f.readUint32LE();
|
|
|
|
f.skip(14);
|
2013-01-07 07:33:55 +00:00
|
|
|
f.read(screenP, nbytes);
|
2012-10-05 13:52:59 +00:00
|
|
|
|
2013-01-07 07:33:55 +00:00
|
|
|
memcpy(ptra, screenP, 307200);
|
2013-01-06 22:12:34 +00:00
|
|
|
for (;;) {
|
2013-02-04 19:38:31 +00:00
|
|
|
byte imageStr[17];
|
2013-02-04 07:24:49 +00:00
|
|
|
if (f.read(imageStr, 16) != 16)
|
2013-01-06 22:12:34 +00:00
|
|
|
break;
|
2013-02-04 19:38:31 +00:00
|
|
|
imageStr[16] = 0;
|
2012-10-05 13:52:59 +00:00
|
|
|
|
2013-02-04 07:24:49 +00:00
|
|
|
if (strncmp((const char *)imageStr, "IMAGE=", 6))
|
2013-01-06 22:12:34 +00:00
|
|
|
break;
|
|
|
|
|
2013-02-04 07:24:49 +00:00
|
|
|
f.read(screenP, READ_LE_UINT32(imageStr + 8));
|
2013-01-07 07:33:55 +00:00
|
|
|
if (*screenP != kByteStop)
|
2013-02-20 07:30:16 +00:00
|
|
|
_vm->_graphicsManager.copyWinscanVbe(screenP, ptra);
|
2013-01-06 22:12:34 +00:00
|
|
|
}
|
2013-01-03 21:32:22 +00:00
|
|
|
_vm->_graphicsManager.fadeOutDefaultLength(ptra);
|
2013-03-20 06:27:42 +00:00
|
|
|
ptra = _vm->_globals->freeMemory(ptra);
|
2012-10-05 13:52:59 +00:00
|
|
|
}
|
2013-01-06 22:12:34 +00:00
|
|
|
if (multiScreenFl) {
|
2012-10-05 13:52:59 +00:00
|
|
|
if (_vm->_graphicsManager.FADE_LINUX == 2)
|
2013-01-07 07:33:55 +00:00
|
|
|
_vm->_graphicsManager.fadeOutDefaultLength(screenCopy);
|
2013-03-20 06:27:42 +00:00
|
|
|
_vm->_globals->freeMemory(screenCopy);
|
2012-10-05 13:52:59 +00:00
|
|
|
}
|
|
|
|
_vm->_graphicsManager.FADE_LINUX = 0;
|
|
|
|
|
|
|
|
f.close();
|
2013-03-19 19:40:55 +00:00
|
|
|
_vm->_eventsManager->_mouseFl = true;
|
2012-10-04 22:09:09 +00:00
|
|
|
}
|
|
|
|
|
2012-09-15 00:27:15 +00:00
|
|
|
} // End of namespace Hopkins
|