Skip to content

Commit

Permalink
TONY: Removed redundant vdb mutex
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Jun 2, 2012
1 parent 22b4326 commit 6ecd712
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 18 deletions.
16 changes: 0 additions & 16 deletions engines/tony/custom.cpp
Expand Up @@ -275,15 +275,13 @@ DECLARE_CUSTOM_FUNCTION(SendTonyMessage)(CORO_PARAM, uint32 dwMessage, uint32 nX
_ctx->curOffset = _ctx->curVoc->offset;

// First time allocation
g_system->lockMutex(GLOBALS.vdb);
_vm->_vdbFP.seek(_ctx->curOffset);
_vm->_theSound.CreateSfx(&_ctx->voice);

_ctx->voice->LoadVoiceFromVDB(_vm->_vdbFP);
_ctx->curOffset = _vm->_vdbFP.pos();

_ctx->voice->SetLoop(false);
g_system->unlockMutex(GLOBALS.vdb);
}

if (GLOBALS.nTonyNextTalkType != GLOBALS.Tony->TALK_NORMAL) {
Expand Down Expand Up @@ -335,7 +333,6 @@ DECLARE_CUSTOM_FUNCTION(SendTonyMessage)(CORO_PARAM, uint32 dwMessage, uint32 nX
_ctx->voice->Play();
_ctx->text.SetCustomSkipHandle2(_ctx->voice->hEndOfBuffer);
} else {
g_system->lockMutex(GLOBALS.vdb);
_vm->_vdbFP.seek(_ctx->curOffset);
_vm->_theSound.CreateSfx(&_ctx->voice);
_ctx->voice->LoadVoiceFromVDB(_vm->_vdbFP);
Expand All @@ -344,7 +341,6 @@ DECLARE_CUSTOM_FUNCTION(SendTonyMessage)(CORO_PARAM, uint32 dwMessage, uint32 nX
_ctx->voice->SetLoop(false);
_ctx->voice->Play();
_ctx->text.SetCustomSkipHandle2(_ctx->voice->hEndOfBuffer);
g_system->unlockMutex(GLOBALS.vdb);
}
}

Expand Down Expand Up @@ -1486,10 +1482,8 @@ DECLARE_CUSTOM_FUNCTION(CharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMess
_ctx->voice = NULL;
if (_ctx->curVoc) {
// Position within the database of entries, beginning at the first
g_system->lockMutex(GLOBALS.vdb);
_vm->_vdbFP.seek(_ctx->curVoc->offset);
_ctx->curOffset = _ctx->curVoc->offset;
g_system->unlockMutex(GLOBALS.vdb);
}

for (_ctx->i = 0; _ctx->i < _ctx->msg->NumPeriods() && !GLOBALS.bSkipIdle; _ctx->i++) {
Expand Down Expand Up @@ -1527,7 +1521,6 @@ DECLARE_CUSTOM_FUNCTION(CharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMess
GLOBALS.LinkGraphicTask(_ctx->text);

if (_ctx->curVoc) {
g_system->lockMutex(GLOBALS.vdb);
_vm->_theSound.CreateSfx(&_ctx->voice);
_vm->_vdbFP.seek(_ctx->curOffset);
_ctx->voice->LoadVoiceFromVDB(_vm->_vdbFP);
Expand All @@ -1536,7 +1529,6 @@ DECLARE_CUSTOM_FUNCTION(CharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMess
_ctx->voice->Play();
_ctx->text->SetCustomSkipHandle2(_ctx->voice->hEndOfBuffer);
_ctx->curOffset = _vm->_vdbFP.pos();
g_system->unlockMutex(GLOBALS.vdb);
}

// Wait for the end of display
Expand Down Expand Up @@ -1701,11 +1693,9 @@ DECLARE_CUSTOM_FUNCTION(MCharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMes
_ctx->voice = NULL;
if (_ctx->curVoc) {
// Position within the database of entries, beginning at the first
g_system->lockMutex(GLOBALS.vdb);
// fseek(_vm->m_vdbFP, curVoc->offset, SEEK_SET);
_vm->_vdbFP.seek(_ctx->curVoc->offset);
_ctx->curOffset = _ctx->curVoc->offset;
g_system->unlockMutex(GLOBALS.vdb);
}

for (_ctx->i = 0; _ctx->i < _ctx->msg->NumPeriods() && !GLOBALS.bSkipIdle; _ctx->i++) {
Expand Down Expand Up @@ -1744,7 +1734,6 @@ DECLARE_CUSTOM_FUNCTION(MCharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMes
GLOBALS.LinkGraphicTask(_ctx->text);

if (_ctx->curVoc) {
g_system->lockMutex(GLOBALS.vdb);
_vm->_theSound.CreateSfx(&_ctx->voice);
_vm->_vdbFP.seek(_ctx->curOffset);
_ctx->voice->LoadVoiceFromVDB(_vm->_vdbFP);
Expand All @@ -1753,7 +1742,6 @@ DECLARE_CUSTOM_FUNCTION(MCharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMes
_ctx->voice->Play();
_ctx->text->SetCustomSkipHandle2(_ctx->voice->hEndOfBuffer);
_ctx->curOffset = _vm->_vdbFP.pos();
g_system->unlockMutex(GLOBALS.vdb);
}

// Wait for the end of display
Expand Down Expand Up @@ -1818,13 +1806,11 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg

if (_ctx->curVoc) {
// Position within the database of entries, beginning at the first
g_system->lockMutex(GLOBALS.vdb);
_vm->_vdbFP.seek(_ctx->curVoc->offset);
_vm->_theSound.CreateSfx(&_ctx->voice);
_ctx->voice->LoadVoiceFromVDB(_vm->_vdbFP);
_ctx->voice->SetLoop(false);
if (_ctx->bIsBack) _ctx->voice->SetVolume(55);
g_system->unlockMutex(GLOBALS.vdb);
}

_ctx->string = mpalQueryDialogPeriod(nMsg);
Expand Down Expand Up @@ -2559,8 +2545,6 @@ void SetupGlobalVars(RMTony *tony, RMPointer *ptr, RMGameBoxes *box, RMLocation
GLOBALS.EnableGUI = MainEnableGUI;
GLOBALS.SetPalesati = MainSetPalesati;

GLOBALS.vdb = g_system->createMutex();

GLOBALS.bAlwaysDisplay = false;
int i;

Expand Down
1 change: 0 additions & 1 deletion engines/tony/globals.cpp
Expand Up @@ -91,7 +91,6 @@ Globals::Globals() {
lastTappeto = 0;
Common::fill(&tappeti[0], &tappeti[200], 0);
SFM_nLoc = 0;
vdb = NULL;

// MPAL global variables
mpalError = 0;
Expand Down
1 change: 0 additions & 1 deletion engines/tony/globals.h
Expand Up @@ -241,7 +241,6 @@ class Globals {

RMPoint StartLocPos[256];
OSystem::MutexRef cs[10];
OSystem::MutexRef vdb;
uint32 mut[10];

bool bSkipIdle;
Expand Down

0 comments on commit 6ecd712

Please sign in to comment.