mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-08 20:07:11 +00:00
GROOVIE: TLC Music / Small Bugfixes / Better Comments
This commit is contained in:
parent
e0ed66fe58
commit
6525123663
@ -180,11 +180,18 @@ Common::Error GroovieEngine::run() {
|
||||
error("GROOVIE: Unknown Game version. groovie.cpp:run()");
|
||||
}
|
||||
|
||||
|
||||
switch (_gameDescription->version) {
|
||||
case kGroovieT7G:
|
||||
case kGroovieT11H:
|
||||
case kGroovieCDY:
|
||||
case kGroovieUHP:
|
||||
// Detect ScummVM Music Enhancement Project presence (T7G only)
|
||||
if (Common::File::exists("gu16.ogg") && _gameDescription->version == kGroovieT7G) {
|
||||
// Load player for external files
|
||||
_musicPlayer = new MusicPlayerIOS(this);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// Create the music player
|
||||
switch (getPlatform()) {
|
||||
case Common::kPlatformMacintosh:
|
||||
@ -201,6 +208,13 @@ Common::Error GroovieEngine::run() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case kGroovieTLC:
|
||||
_musicPlayer = new MusicPlayerTlc(this);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Load volume levels
|
||||
syncSoundSettings();
|
||||
@ -268,7 +282,7 @@ Common::Error GroovieEngine::run() {
|
||||
|
||||
// Check that the game files and the audio tracks aren't together run from
|
||||
// the same cd
|
||||
if (getPlatform() != Common::kPlatformIOS) {
|
||||
if (getPlatform() != Common::kPlatformIOS && _gameDescription->version != kGroovieTLC) {
|
||||
if (!existExtractedCDAudioFiles()
|
||||
&& !isDataAndCDAudioReadFromSameCD()) {
|
||||
warnMissingExtractedCDAudio();
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "groovie/music.h"
|
||||
#include "groovie/groovie.h"
|
||||
#include "groovie/resource.h"
|
||||
#include "groovie/tlcgame.h"
|
||||
|
||||
#include "backends/audiocd/audiocd.h"
|
||||
#include "common/config-manager.h"
|
||||
@ -37,6 +38,7 @@
|
||||
#include "audio/audiostream.h"
|
||||
#include "audio/midiparser.h"
|
||||
#include "audio/miles.h"
|
||||
#include "audio/decoders/mp3.h"
|
||||
|
||||
namespace Groovie {
|
||||
|
||||
@ -746,4 +748,59 @@ bool MusicPlayerIOS::load(uint32 fileref, bool loop) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
MusicPlayerTlc::MusicPlayerTlc(GroovieEngine *vm) : MusicPlayer(vm) {
|
||||
vm->getTimerManager()->installTimerProc(&onTimer, 50 * 1000, this, "groovieMusic");
|
||||
}
|
||||
|
||||
MusicPlayerTlc::~MusicPlayerTlc() {
|
||||
_vm->getTimerManager()->removeTimerProc(&onTimer);
|
||||
}
|
||||
|
||||
void MusicPlayerTlc::updateVolume() {
|
||||
// Just set the mixer volume for the music sound type
|
||||
_vm->_system->getMixer()->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, _userVolume * _gameVolume / 100);
|
||||
}
|
||||
|
||||
void MusicPlayerTlc::unload() {
|
||||
MusicPlayer::unload();
|
||||
|
||||
_vm->_system->getMixer()->stopHandle(_handle);
|
||||
}
|
||||
|
||||
bool MusicPlayerTlc::load(uint32 fileref, bool loop) {
|
||||
// Find correct filename
|
||||
Common::String filename;
|
||||
Common::File *fileHandle = new Common::File();
|
||||
Audio::SeekableAudioStream *seekStream = NULL;
|
||||
|
||||
// Create the audio stream from fileref
|
||||
filename = TlcGame::getTlcMusicFilename(fileref);
|
||||
fileHandle->open(filename);
|
||||
if (fileHandle->isOpen()) {
|
||||
seekStream = Audio::makeMP3Stream(fileHandle, DisposeAfterUse::YES);
|
||||
} else {
|
||||
delete fileHandle;
|
||||
}
|
||||
|
||||
if (!seekStream) {
|
||||
warning("Could not play audio file '%s'", filename.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
Audio::AudioStream *audStream = seekStream;
|
||||
|
||||
// Loop if requested
|
||||
if (loop || 1)
|
||||
audStream = Audio::makeLoopingAudioStream(seekStream, 0);
|
||||
|
||||
// MIDI player handles volume reset on load, IOS player doesn't - force update here
|
||||
updateVolume();
|
||||
|
||||
// Play!
|
||||
_vm->_system->getMixer()->playStream(Audio::Mixer::kMusicSoundType, &_handle, audStream);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
} // End of Groovie namespace
|
||||
|
@ -35,6 +35,7 @@ class MidiParser;
|
||||
namespace Groovie {
|
||||
|
||||
class GroovieEngine;
|
||||
class TlcGame;
|
||||
|
||||
class MusicPlayer {
|
||||
public:
|
||||
@ -204,6 +205,20 @@ private:
|
||||
Audio::SoundHandle _handle;
|
||||
};
|
||||
|
||||
class MusicPlayerTlc : public MusicPlayer {
|
||||
public:
|
||||
MusicPlayerTlc(GroovieEngine *vm);
|
||||
~MusicPlayerTlc();
|
||||
|
||||
protected:
|
||||
void updateVolume();
|
||||
bool load(uint32 fileref, bool loop);
|
||||
void unload();
|
||||
|
||||
private:
|
||||
Audio::SoundHandle _handle;
|
||||
};
|
||||
|
||||
} // End of Groovie namespace
|
||||
|
||||
#endif // GROOVIE_MUSIC_H
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -146,8 +146,9 @@ private:
|
||||
uint32 readScript32bits();
|
||||
uint16 readScript8or16bits();
|
||||
uint8 readScriptChar(bool allow7C, bool limitVal, bool limitVar);
|
||||
void readScriptString(Common::String &str);
|
||||
uint8 readScriptVar();
|
||||
uint32 getVideoRefString();
|
||||
uint32 getVideoRefString(Common::String &resName);
|
||||
|
||||
bool hotspot(Common::Rect rect, uint16 addr, uint8 cursor);
|
||||
|
||||
@ -243,6 +244,7 @@ private:
|
||||
|
||||
void o2_printstring();
|
||||
void o2_playsong();
|
||||
void o2_midicontrol();
|
||||
void o2_setbackgroundsong();
|
||||
void o2_videofromref();
|
||||
void o2_vdxtransition();
|
||||
|
@ -34,7 +34,7 @@
|
||||
namespace Groovie {
|
||||
|
||||
// This a list of files for background music. These list is hard-coded in the TLC player.
|
||||
const Common::String kTlcMidiFiles[] = {"ep01epm.mpg", "ep01tatm.mpg", "amb_hs.mpg", "amb_mr.mpg", "amb_kr.mpg", "amb_mo.mpg", "music_rc.mpg", "amb_ds.mpg", "amb_ds3.mpg", "amb_jr.mpg", "amb_mr4.mpg", "amb_jr4.mpg", "amb_jr2.mpg", "amb_kr2.mpg", "amb_mr2.mpg", "amb_br.mpg", "amb_ds2.mpg", "amb_jr3.mpg", "amb_ds4.mpg", "amb_kr3.mpg", "amb_to1.mpg", "amb_to2.mpg", "ep02epm.mpg", "ep02tatm.mpg", "ep03epm.mpg", "ep03tatm.mpg", "ep04epm.mpg", "ep04tatm.mpg", "ep05epm.mpg", "ep05tatm.mpg", "ep06epm.mpg", "ep06tatm.mpg", "ep07epm.mpg", "ep07tatm.mpg", "ep08epm.mpg", "ep08tatm.mpg", "ep09epm.mpg", "ep09tatm.mpg", "ep10epm.mpg", "ep10tatm.mpg", "ep11epm.mpg", "ep11tatm.mpg", "ep12epm.mpg", "ep12tatm.mpg", "ep13epm.mpg", "ep13tatm.mpg", "ep14epm.mpg", "ep14tatm.mpg", "ep15epm.mpg", "ep15tatm.mpg" };
|
||||
const Common::String kTlcMusicFiles[] = {"ep01epm.mpg", "ep01tatm.mpg", "amb_hs.mpg", "amb_mr.mpg", "amb_kr.mpg", "amb_mo.mpg", "music_rc.mpg", "amb_ds.mpg", "amb_ds3.mpg", "amb_jr.mpg", "amb_mr4.mpg", "amb_jr4.mpg", "amb_jr2.mpg", "amb_kr2.mpg", "amb_mr2.mpg", "amb_br.mpg", "amb_ds2.mpg", "amb_jr3.mpg", "amb_ds4.mpg", "amb_kr3.mpg", "amb_to1.mpg", "amb_to2.mpg", "ep02epm.mpg", "ep02tatm.mpg", "ep03epm.mpg", "ep03tatm.mpg", "ep04epm.mpg", "ep04tatm.mpg", "ep05epm.mpg", "ep05tatm.mpg", "ep06epm.mpg", "ep06tatm.mpg", "ep07epm.mpg", "ep07tatm.mpg", "ep08epm.mpg", "ep08tatm.mpg", "ep09epm.mpg", "ep09tatm.mpg", "ep10epm.mpg", "ep10tatm.mpg", "ep11epm.mpg", "ep11tatm.mpg", "ep12epm.mpg", "ep12tatm.mpg", "ep13epm.mpg", "ep13tatm.mpg", "ep14epm.mpg", "ep14tatm.mpg", "ep15epm.mpg", "ep15tatm.mpg" };
|
||||
const uint8 kTlcEpQuestToPlay[] = { 0x0E, 0x0F, 0x0B, 0x10, 0x11, 0x12, 0x0C, 0x0C, 0x09, 0x06, 0x0F, 0x0C, 0x0B, 0x0D, 0x0D };
|
||||
|
||||
|
||||
@ -78,6 +78,10 @@ uint16 inline TlcGame::getScriptVar16(uint16 var) {
|
||||
return value;
|
||||
}
|
||||
|
||||
// Gets the filename of the background music file.
|
||||
Common::String TlcGame::getTlcMusicFilename(int musicId) {
|
||||
return kTlcMusicFiles[musicId];
|
||||
}
|
||||
|
||||
void TlcGame::opRegions() {
|
||||
if (_scriptVariables[0x1A] == 1) {
|
||||
|
@ -74,6 +74,8 @@ public:
|
||||
TlcGame();
|
||||
~TlcGame();
|
||||
|
||||
static Common::String getTlcMusicFilename(int musicId);
|
||||
|
||||
/**
|
||||
* Sets a pointer to the script variables. This makes it easier if we want
|
||||
* to debug write accesses to the script variables
|
||||
|
Loading…
x
Reference in New Issue
Block a user