Merge branch 'master' of github.com:scummvm/scummvm

This commit is contained in:
Willem Jan Palenstijn 2015-12-26 14:20:15 +01:00
commit ae519716a2
16 changed files with 1208 additions and 65 deletions

BIN
dists/scummvm_logo.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View file

@ -41,6 +41,7 @@
#include "common/error.h"
#include "common/list.h"
#include "common/list_intern.h"
#include "common/memstream.h"
#include "common/scummsys.h"
#include "common/taskbar.h"
#include "common/textconsole.h"
@ -48,7 +49,9 @@
#include "common/singleton.h"
#include "backends/keymapper/keymapper.h"
#include "base/version.h"
#include "gui/gui-manager.h"
#include "gui/debugger.h"
#include "gui/dialog.h"
#include "gui/message.h"
@ -56,7 +59,9 @@
#include "audio/mixer.h"
#include "graphics/cursorman.h"
#include "graphics/fontman.h"
#include "graphics/pixelformat.h"
#include "image/bmp.h"
#ifdef _WIN32_WCE
extern bool isSmartphone();
@ -240,6 +245,59 @@ void initCommonGFX(bool defaultTo1XScaler) {
g_system->setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen"));
}
// Please leave the splash screen in working order for your releases, even if they're commercial.
// This is a proper and good way to show your appreciation for our hard work over these years.
bool splash = false;
#include "logo_data.h"
void splashScreen() {
Common::MemoryReadStream stream(logo_data, ARRAYSIZE(logo_data));
Image::BitmapDecoder bitmap;
if (!bitmap.loadStream(stream)) {
warning("Error loading logo file");
return;
}
g_system->showOverlay();
// Fill with orange
Graphics::Surface screen;
screen.create(g_system->getOverlayWidth(), g_system->getOverlayHeight(), g_system->getOverlayFormat());
screen.fillRect(Common::Rect(screen.w, screen.h), screen.format.ARGBToColor(0xff, 0xd4, 0x75, 0x0b));
// Load logo
Graphics::Surface *logo = bitmap.getSurface()->convertTo(g_system->getOverlayFormat(), bitmap.getPalette());
int lx = (g_system->getOverlayWidth() - logo->w) / 2;
int ly = (g_system->getOverlayHeight() - logo->h) / 2;
// Print version information
const Graphics::Font *font = FontMan.getFontByUsage(Graphics::FontManager::kConsoleFont);
int w = font->getStringWidth(gScummVMVersionDate);
int x = g_system->getOverlayWidth() - w - 5; // lx + logo->w - w + 5;
int y = g_system->getOverlayHeight() - font->getFontHeight() - 5; //ly + logo->h + 5;
font->drawString(&screen, gScummVMVersionDate, x, y, w, screen.format.ARGBToColor(0xff, 0, 0, 0));
g_system->copyRectToOverlay(screen.getPixels(), screen.pitch, 0, 0, screen.w, screen.h);
// Draw logo
g_system->copyRectToOverlay(logo->getPixels(), logo->pitch, lx, ly, logo->w, logo->h);
// Delay 0.6 secs
uint time0 = g_system->getMillis();
Common::Event event;
while (time0 + 600 > g_system->getMillis()) {
g_system->updateScreen();
g_system->getEventManager()->pollEvent(event);
g_system->delayMillis(10);
}
g_system->hideOverlay();
splash = true;
}
void initGraphics(int width, int height, bool defaultTo1xScaler, const Graphics::PixelFormat *format) {
g_system->beginGFXTransaction();
@ -258,6 +316,9 @@ void initGraphics(int width, int height, bool defaultTo1xScaler, const Graphics:
OSystem::TransactionError gfxError = g_system->endGFXTransaction();
if (!splash && !GUI::GuiManager::instance()._launched)
splashScreen();
if (gfxError == OSystem::kTransactionSuccess)
return;

View file

@ -80,6 +80,9 @@ void Anim::setOutputBuffer(byte *memoryBuffer) {
_outputBuffer = memoryBuffer;
}
uint16 Anim::getDIFFHeight() {
return _headerdata._height;
}
void Anim::diffNextFrame(bool onlyDiffData) {
if (_lastBlockHeader == 65535)
@ -90,7 +93,7 @@ void Anim::diffNextFrame(bool onlyDiffData) {
byte *startOfBuf = _outputBuffer;
int bufPitch = _vm->_graphics->_screenWidth;
if (!_outputBuffer) {
if (!startOfBuf) {
startOfBuf = _vm->_graphics->getCurrentDrawingBuffer();
drawOnScreen = true;
}
@ -217,7 +220,9 @@ void Anim::diffNextFrame(bool onlyDiffData) {
_sampleSpeed = _diffFile->readUint16LE();
_diffFile->skip(2);
_vm->_music->playSoundEffect(_sampleSpeed, _size, _diffFile);
// Sound effects embedded in animations are started here. These are
// usually animation-specific, like door opening sounds, and are not looped
_vm->_music->playSoundEffect(_sampleSpeed, _size, false, _diffFile);
break;
case 65535:

View file

@ -66,12 +66,12 @@ private:
uint32 _diffHeight;
byte *_outputBuffer;
DIFFHeader _headerdata;
public:
Anim(LabEngine *vm);
virtual ~Anim();
DIFFHeader _headerdata;
char _diffPalette[256 * 3];
bool _waitForEffect; // Wait for each sound effect to finish before continuing.
bool _doBlack; // Black the screen before new picture
@ -94,6 +94,8 @@ public:
* Stops an animation from running.
*/
void stopDiffEnd();
uint16 getDIFFHeight();
};
} // End of namespace Lab

View file

@ -43,7 +43,6 @@ static const ADGameDescription labDescriptions[] = {
"",
{
{ "doors", 0, "d77536010e7e5ae17ee066323ceb9585", 2537 }, // game/doors
{ "notes11", 0, "63e873f659f8f46f9809d16a2bf653c7", 3562 }, // fonts/notes11
{ "noteold.fon", 0, "6c1d90ad55149556e79d3f7bfddb4bd7", 9252 }, // game/spict/noteold.fon
{ NULL, 0, NULL, 0 }
},
@ -57,7 +56,6 @@ static const ADGameDescription labDescriptions[] = {
"Lowres",
{
{ "doors", 0, "d77536010e7e5ae17ee066323ceb9585", 2537 }, // game/doors
{ "notes11", 0, "63e873f659f8f46f9809d16a2bf653c7", 3562 }, // fonts/notes11
{ "64b", 0, "3a84d41bcc6a782f22e8e954bce09721", 39916 }, // game/pict/h2/64b
{ NULL, 0, NULL, 0 }
},
@ -71,7 +69,6 @@ static const ADGameDescription labDescriptions[] = {
"Rerelease",
{
{ "doors", 0, "d77536010e7e5ae17ee066323ceb9585", 2537 }, // game/doors
{ "notes11", 0, "63e873f659f8f46f9809d16a2bf653c7", 3562 }, // fonts/notes11
{ "noteold.fon", 0, "6c1d90ad55149556e79d3f7bfddb4bd7", 9252 }, // game/spict/noteold.fon
{ "wyrmkeep",0, "97c7064c54c28b952d37c4ebff6efa50", 52286 }, // game/spict/intro
{ NULL, 0, NULL, 0 }
@ -94,7 +91,6 @@ static const ADGameDescription labDescriptions[] = {
};
static const char *const directoryGlobs[] = {
"fonts",
"game",
"pict",
"spict",

View file

@ -88,10 +88,6 @@ void DisplayMan::readPict(const Common::String filename, bool playOnce, bool onl
_vm->_anim->stopDiff();
loadPict(filename);
_vm->updateMusicAndEvents();
if (!_vm->_music->_loopSoundEffect)
_vm->_music->stopSoundEffect();
_vm->_anim->setOutputBuffer(memoryBuffer);
_vm->_anim->readDiff(_curBitmap, playOnce, onlyDiffData);
}
@ -677,20 +673,19 @@ void DisplayMan::doScrollWipe(const Common::String filename) {
uint16 nheight = height;
uint16 startLine = 0, onRow = 0;
while (onRow < _vm->_anim->_headerdata._height) {
while (onRow < _vm->_anim->getDIFFHeight()) {
_vm->updateMusicAndEvents();
if ((by > nheight) && nheight)
by = nheight;
if ((startLine + by) > (_vm->_anim->_headerdata._height - height - 1))
if ((startLine + by) > (_vm->_anim->getDIFFHeight() - height - 1))
break;
if (nheight)
nheight -= by;
copyPage(width, height, nheight, startLine, mem);
screenUpdate();
if (!nheight)
@ -719,7 +714,7 @@ void DisplayMan::doScrollBounce() {
byte *mem = _vm->_anim->_scrollScreenBuffer;
_vm->updateMusicAndEvents();
int startLine = _vm->_anim->_headerdata._height - height - 1;
int startLine = _vm->_anim->getDIFFHeight() - height - 1;
for (int i = 0; i < 5; i++) {
_vm->updateMusicAndEvents();
@ -832,19 +827,19 @@ void DisplayMan::doTransition(TransitionType transitionType, const Common::Strin
case kTransitionTransporter:
doTransWipe(filename);
break;
case kTransitionScrollWipe:
case kTransitionScrollWipe: // only used in scene 7 (street, when teleporting to the surreal maze)
doScrollWipe(filename);
break;
case kTransitionScrollBlack:
case kTransitionScrollBlack: // only used in scene 7 (street, when teleporting to the surreal maze)
doScrollBlack();
break;
case kTransitionScrollBounce:
case kTransitionScrollBounce: // only used in scene 7 (street, when teleporting to the surreal maze)
doScrollBounce();
break;
case kTransitionReadFirstFrame:
case kTransitionReadFirstFrame: // only used in scene 7 (street, when teleporting to the surreal maze)
readPict(filename, false);
break;
case kTransitionReadNextFrame:
case kTransitionReadNextFrame: // only used in scene 7 (street, when teleporting to the surreal maze)
_vm->_anim->diffNextFrame();
break;
case kTransitionNone:

View file

@ -191,9 +191,6 @@ void EventManager::processInput() {
case Common::KEYCODE_RIGHTBRACKET:
_vm->changeVolume(1);
break;
case Common::KEYCODE_z:
//saveSettings();
break;
case Common::KEYCODE_d:
if (event.kbd.hasFlags(Common::KBD_CTRL)) {
// Open debugger console

View file

@ -221,7 +221,12 @@ void LabEngine::drawStaticMessage(byte index) {
}
void LabEngine::changeVolume(int delta) {
warning("STUB: changeVolume()");
int sfxPrev = _mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType);
int musicPrev = _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType);
int sfxNew = (delta > 0) ? MIN<int>(sfxPrev + 10, Audio::Mixer::kMaxMixerVolume) : MAX<int>(sfxPrev - 10, 0);
int musicNew = (delta > 0) ? MIN<int>(musicPrev + 10, Audio::Mixer::kMaxMixerVolume) : MAX<int>(musicPrev - 10, 0);
_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, sfxNew);
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, musicNew);
}
void LabEngine::waitTOF() {

View file

@ -83,8 +83,6 @@ void LabEngine::loadMapData() {
Common::File *mapFile = _resource->openDataFile("Lab:Maps", MKTAG('M', 'A', 'P', '0'));
updateMusicAndEvents();
if (!_music->_loopSoundEffect)
_music->stopSoundEffect();
_maxRooms = mapFile->readUint16LE();
_maps = new MapData[_maxRooms + 1]; // will be freed when the user exits the map
@ -339,10 +337,11 @@ void LabEngine::drawMap(uint16 curRoom, uint16 curMsg, uint16 floorNum, bool fad
for (int i = 1; i <= _maxRooms; i++) {
if ((_maps[i]._pageNumber == floorNum) && _roomsFound->in(i) && _maps[i]._x) {
drawRoomMap(i, (bool)(i == curRoom));
updateMusicAndEvents();
}
}
updateMusicAndEvents();
// Makes sure the X is drawn in corridors
// NOTE: this here on purpose just in case there's some weird
// condition, like the surreal maze where there are no rooms

View file

@ -56,7 +56,6 @@ Music::Music(LabEngine *vm) : _vm(vm) {
_leftInFile = 0;
_musicOn = false;
_loopSoundEffect = false;
_queuingAudioStream = nullptr;
_lastMusicRoom = 1;
_doReset = true;
@ -95,7 +94,7 @@ uint16 Music::getPlayingBufferCount() {
return (_queuingAudioStream) ? _queuingAudioStream->numQueuedStreams() : 0;
}
void Music::playSoundEffect(uint16 sampleSpeed, uint32 length, Common::File *dataFile) {
void Music::playSoundEffect(uint16 sampleSpeed, uint32 length, bool loop, Common::File *dataFile) {
pauseBackMusic();
stopSoundEffect();
@ -114,7 +113,7 @@ void Music::playSoundEffect(uint16 sampleSpeed, uint32 length, Common::File *dat
dataFile->read(soundData, length);
Audio::SeekableAudioStream *audioStream = Audio::makeRawStream((const byte *)soundData, length, sampleSpeed, soundFlags);
uint loops = (_loopSoundEffect) ? 0 : 1;
uint loops = (loop) ? 0 : 1;
Audio::LoopingAudioStream *loopingAudioStream = new Audio::LoopingAudioStream(audioStream, loops);
_vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, loopingAudioStream);
}
@ -274,22 +273,21 @@ void Music::resetMusic() {
_tFile = 0;
}
bool Music::readMusic(const Common::String filename, bool waitTillFinished) {
bool Music::readMusic(const Common::String filename, bool loop, bool waitTillFinished) {
Common::File *file = _vm->_resource->openDataFile(filename, MKTAG('D', 'I', 'F', 'F'));
_vm->updateMusicAndEvents();
if (!_loopSoundEffect)
stopSoundEffect();
stopSoundEffect();
if (!file)
return false;
_vm->_anim->_doBlack = false;
readSound(waitTillFinished, file);
readSound(waitTillFinished, loop, file);
return true;
}
void Music::readSound(bool waitTillFinished, Common::File *file) {
void Music::readSound(bool waitTillFinished, bool loop, Common::File *file) {
uint32 magicBytes = file->readUint32LE();
if (magicBytes != 1219009121) {
warning("readSound: Bad signature, skipping");
@ -320,7 +318,7 @@ void Music::readSound(bool waitTillFinished, Common::File *file) {
uint16 sampleRate = file->readUint16LE();
file->skip(2);
playSoundEffect(sampleRate, soundSize, file);
playSoundEffect(sampleRate, soundSize, loop, file);
} else if (soundTag == 65535) {
if (waitTillFinished) {
while (isSoundEffectActive()) {

View file

@ -74,16 +74,13 @@ private:
* Pauses the background music.
*/
void pauseBackMusic();
void readSound(bool waitTillFinished, Common::File *file);
void readSound(bool waitTillFinished, bool loop, Common::File *file);
/**
* Starts up the music initially.
*/
void startMusic(bool restartFl);
public:
bool _loopSoundEffect;
public:
Music(LabEngine *vm);
@ -107,12 +104,12 @@ public:
*/
bool initMusic(const Common::String filename);
bool isSoundEffectActive() const;
void playSoundEffect(uint16 sampleSpeed, uint32 length, Common::File *dataFile);
void playSoundEffect(uint16 sampleSpeed, uint32 length, bool loop, Common::File *dataFile);
/**
* Reads in a music file. Ignores any graphics.
*/
bool readMusic(const Common::String filename, bool waitTillFinished);
bool readMusic(const Common::String filename, bool loop, bool waitTillFinished);
/**
* Changes the background music to the original piece playing.

View file

@ -239,18 +239,15 @@ void LabEngine::doActions(const ActionList &actionList) {
switch (action->_actionType) {
case kActionPlaySound:
_music->_loopSoundEffect = false;
_music->readMusic(action->_messages[0], true);
_music->readMusic(action->_messages[0], false, true);
break;
case kActionPlaySoundNoWait:
_music->_loopSoundEffect = false;
_music->readMusic(action->_messages[0], false);
case kActionPlaySoundNoWait: // only used in scene 7 (street, when teleporting to the surreal maze)
_music->readMusic(action->_messages[0], false, false);
break;
case kActionPlaySoundLooping:
_music->_loopSoundEffect = true;
_music->readMusic(action->_messages[0], false);
_music->readMusic(action->_messages[0], true, false);
break;
case kActionShowDiff:
@ -411,12 +408,7 @@ void LabEngine::doActions(const ActionList &actionList) {
break;
case kActionClearSound:
if (_music->_loopSoundEffect) {
_music->_loopSoundEffect = false;
_music->stopSoundEffect();
} else if (_music->isSoundEffectActive())
_music->stopSoundEffect();
_music->stopSoundEffect();
break;
case kActionWinMusic:
@ -474,16 +466,7 @@ void LabEngine::doActions(const ActionList &actionList) {
}
}
if (_music->_loopSoundEffect) {
_music->_loopSoundEffect = false;
_music->stopSoundEffect();
} else {
while (_music->isSoundEffectActive()) {
updateMusicAndEvents();
_anim->diffNextFrame();
waitTOF();
}
}
_music->stopSoundEffect();
}
bool LabEngine::doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr closePtr, bool allowDefaults) {

1099
engines/logo_data.h Normal file

File diff suppressed because it is too large Load diff

View file

@ -64,6 +64,8 @@ GuiManager::GuiManager() : _redrawStatus(kRedrawDisabled), _stateIsSaved(false),
_width = _system->getOverlayWidth();
_height = _system->getOverlayHeight();
_launched = false;
// Clear the cursor
memset(_cursor, 0xFF, sizeof(_cursor));

View file

@ -98,6 +98,8 @@ public:
*/
bool checkScreenChange();
bool _launched;
protected:
enum RedrawStatus {
kRedrawDisabled = 0,

View file

@ -683,6 +683,8 @@ LauncherDialog::LauncherDialog()
// Create Load dialog
_loadDialog = new SaveLoadChooser(_("Load game:"), _("Load"), false);
GUI::GuiManager::instance()._launched = true;
}
void LauncherDialog::selectTarget(const String &target) {