EMI: Add code for one-shot playing the Aspyr logo on EMI Mac

This needs to be separate from the other videos, since the logo
is encoded as QuickTime. This solution replicates logic from
mainLoop to avoid adding any further special cases in engine code.
This commit is contained in:
Einar Johan Trøan Sømåen 2014-10-01 02:19:06 +02:00 committed by Einar Johan Trøan Sømåen
parent f41d952635
commit 223c81b144
6 changed files with 143 additions and 2 deletions

View File

@ -311,8 +311,8 @@ Common::Error GrimEngine::run() {
g_driver->loadEmergFont();
if (getGameType() == GType_MONKEY4 && SearchMan.hasFile("AMWI.m4b")) {
// TODO: Play EMI Mac Aspyr logo
warning("TODO: Play Aspyr logo");
// Play EMI Mac Aspyr logo
playAspyrLogo();
}
Bitmap *splash_bm = nullptr;
@ -358,6 +358,52 @@ Common::Error GrimEngine::run() {
return Common::kNoError;
}
void GrimEngine::playAspyrLogo() {
// A trimmed down version of the code found in mainloop
// for the purpose of playing the Aspyr-logo.
// The reason for this, is that the logo needs a different
// codec than all the other videos (which are Bink).
// Code is provided to keep within the fps-limit, as well as to
// allow for pressing ESC to skip the movie.
MoviePlayer *defaultPlayer = g_movie;
g_movie = CreateQuickTimePlayer();
g_movie->play("AMWI.m4b", false, 0, 0);
setMode(SmushMode);
while (g_movie->isPlaying()) {
_doFlip = true;
uint32 startTime = g_system->getMillis();
updateDisplayScene();
if (_doFlip) {
doFlip();
}
// Process events to allow the user to skip the logo.
Common::Event event;
while (g_system->getEventManager()->pollEvent(event)) {
// Ignore everything but ESC when movies are playing
Common::EventType type = event.type;
if (type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) {
g_movie->stop();
break;
}
}
uint32 endTime = g_system->getMillis();
if (startTime > endTime)
continue;
uint32 diffTime = endTime - startTime;
if (_speedLimitMs == 0)
continue;
if (diffTime < _speedLimitMs) {
uint32 delayTime = _speedLimitMs - diffTime;
g_system->delayMillis(delayTime);
}
}
delete g_movie;
setMode(NormalMode);
g_movie = defaultPlayer;
}
Common::Error GrimEngine::loadGameState(int slot) {
assert(slot >= 0);
if (getGameType() == GType_MONKEY4) {

View File

@ -201,6 +201,7 @@ protected:
void buildActiveActorsList();
void savegameCallback();
void createRenderer();
void playAspyrLogo();
virtual LuaBase *createLua();
virtual void updateNormalMode();
virtual void updateDrawMode();

View File

@ -80,6 +80,7 @@ MODULE_OBJS := \
movie/bink.o \
movie/mpeg.o \
movie/movie.o \
movie/quicktime.o \
movie/smush.o \
update/packfile.o \
update/mscab.o \

View File

@ -174,6 +174,7 @@ protected:
MoviePlayer *CreateMpegPlayer();
MoviePlayer *CreateSmushPlayer(bool demo);
MoviePlayer *CreateBinkPlayer(bool demo);
MoviePlayer *CreateQuickTimePlayer();
extern MoviePlayer *g_movie;
} // end of namespace Grim

View File

@ -0,0 +1,53 @@
/* ResidualVM - A 3D game interpreter
*
* ResidualVM 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 "common/system.h"
#include "video/qt_decoder.h"
#include "engines/grim/movie/quicktime.h"
#include "engines/grim/grim.h"
namespace Grim {
MoviePlayer *CreateQuickTimePlayer() {
return new QuickTimePlayer();
}
QuickTimePlayer::QuickTimePlayer() : MoviePlayer() {
_videoDecoder = new Video::QuickTimeDecoder();
}
bool QuickTimePlayer::loadFile(const Common::String &filename) {
_fname = filename;
Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(_fname);
if (!stream)
return false;
_videoDecoder->loadStream(stream);
_videoDecoder->start();
return true;
}
} // end of namespace Grim

View File

@ -0,0 +1,39 @@
/* ResidualVM - A 3D game interpreter
*
* ResidualVM 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.
*
*/
#ifndef GRIM_QUICKTIME_PLAYER_H
#define GRIM_QUICKTIME_PLAYER_H
#include "engines/grim/movie/movie.h"
namespace Grim {
class QuickTimePlayer : public MoviePlayer {
public:
QuickTimePlayer();
private:
bool loadFile(const Common::String &filename) override;
};
} // end of namespace Grim
#endif