Skip to content

Commit

Permalink
TONY: Rename sound functions and class names
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Jun 16, 2012
1 parent 638b066 commit ddd1414
Show file tree
Hide file tree
Showing 7 changed files with 239 additions and 232 deletions.
72 changes: 37 additions & 35 deletions engines/tony/custom.cpp
Expand Up @@ -253,7 +253,7 @@ DECLARE_CUSTOM_FUNCTION(SendTonyMessage)(CORO_PARAM, uint32 dwMessage, uint32 nX
int i;
int curOffset;
VoiceHeader *curVoc;
FPSFX *voice;
FPSfx *voice;
RMTextDialog text;
CORO_END_CONTEXT(_ctx);

Expand All @@ -276,12 +276,12 @@ DECLARE_CUSTOM_FUNCTION(SendTonyMessage)(CORO_PARAM, uint32 dwMessage, uint32 nX

// First time allocation
_vm->_vdbFP.seek(_ctx->curOffset);
_vm->_theSound.CreateSfx(&_ctx->voice);
_vm->_theSound.createSfx(&_ctx->voice);

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

_ctx->voice->SetLoop(false);
_ctx->voice->setLoop(false);
}

if (GLOBALS._nTonyNextTalkType != GLOBALS._tony->TALK_NORMAL) {
Expand Down Expand Up @@ -330,16 +330,16 @@ DECLARE_CUSTOM_FUNCTION(SendTonyMessage)(CORO_PARAM, uint32 dwMessage, uint32 nX

if (_ctx->curVoc) {
if (_ctx->i == 0) {
_ctx->voice->Play();
_ctx->voice->play();
_ctx->text.setCustomSkipHandle2(_ctx->voice->hEndOfBuffer);
} else {
_vm->_vdbFP.seek(_ctx->curOffset);
_vm->_theSound.CreateSfx(&_ctx->voice);
_ctx->voice->LoadVoiceFromVDB(_vm->_vdbFP);
_vm->_theSound.createSfx(&_ctx->voice);
_ctx->voice->loadVoiceFromVDB(_vm->_vdbFP);

_ctx->curOffset = _vm->_vdbFP.pos();
_ctx->voice->SetLoop(false);
_ctx->voice->Play();
_ctx->voice->setLoop(false);
_ctx->voice->play();
_ctx->text.setCustomSkipHandle2(_ctx->voice->hEndOfBuffer);
}
}
Expand All @@ -349,8 +349,8 @@ DECLARE_CUSTOM_FUNCTION(SendTonyMessage)(CORO_PARAM, uint32 dwMessage, uint32 nX
CORO_INVOKE_0(_ctx->text.waitForEndDisplay);

if (_ctx->curVoc) {
_ctx->voice->Stop();
_ctx->voice->Release();
_ctx->voice->stop();
_ctx->voice->release();
_ctx->voice = NULL;
}
}
Expand Down Expand Up @@ -1458,7 +1458,7 @@ DECLARE_CUSTOM_FUNCTION(CharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMess
RMTextDialog *text;
int curOffset;
VoiceHeader *curVoc;
FPSFX *voice;
FPSfx *voice;
CORO_END_CONTEXT(_ctx);

CORO_BEGIN_CODE(_ctx);
Expand Down Expand Up @@ -1524,12 +1524,12 @@ DECLARE_CUSTOM_FUNCTION(CharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMess
GLOBALS.LinkGraphicTask(_ctx->text);

if (_ctx->curVoc) {
_vm->_theSound.CreateSfx(&_ctx->voice);
_vm->_theSound.createSfx(&_ctx->voice);
_vm->_vdbFP.seek(_ctx->curOffset);
_ctx->voice->LoadVoiceFromVDB(_vm->_vdbFP);
_ctx->voice->SetLoop(false);
if (bIsBack) _ctx->voice->SetVolume(55);
_ctx->voice->Play();
_ctx->voice->loadVoiceFromVDB(_vm->_vdbFP);
_ctx->voice->setLoop(false);
if (bIsBack) _ctx->voice->setVolume(55);
_ctx->voice->play();
_ctx->text->setCustomSkipHandle2(_ctx->voice->hEndOfBuffer);
_ctx->curOffset = _vm->_vdbFP.pos();
}
Expand All @@ -1539,8 +1539,8 @@ DECLARE_CUSTOM_FUNCTION(CharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMess
CORO_INVOKE_0(_ctx->text->waitForEndDisplay);

if (_ctx->curVoc) {
_ctx->voice->Stop();
_ctx->voice->Release();
_ctx->voice->stop();
_ctx->voice->release();
_ctx->voice = NULL;
}

Expand Down Expand Up @@ -1662,7 +1662,7 @@ DECLARE_CUSTOM_FUNCTION(MCharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMes
RMTextDialog *text;
int curOffset;
VoiceHeader *curVoc;
FPSFX *voice;
FPSfx *voice;
CORO_END_CONTEXT(_ctx);

CORO_BEGIN_CODE(_ctx);
Expand Down Expand Up @@ -1737,12 +1737,13 @@ DECLARE_CUSTOM_FUNCTION(MCharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMes
GLOBALS.LinkGraphicTask(_ctx->text);

if (_ctx->curVoc) {
_vm->_theSound.CreateSfx(&_ctx->voice);
_vm->_theSound.createSfx(&_ctx->voice);
_vm->_vdbFP.seek(_ctx->curOffset);
_ctx->voice->LoadVoiceFromVDB(_vm->_vdbFP);
_ctx->voice->SetLoop(false);
if (bIsBack) _ctx->voice->SetVolume(55);
_ctx->voice->Play();
_ctx->voice->loadVoiceFromVDB(_vm->_vdbFP);
_ctx->voice->setLoop(false);
if (bIsBack)
_ctx->voice->setVolume(55);
_ctx->voice->play();
_ctx->text->setCustomSkipHandle2(_ctx->voice->hEndOfBuffer);
_ctx->curOffset = _vm->_vdbFP.pos();
}
Expand All @@ -1752,8 +1753,8 @@ DECLARE_CUSTOM_FUNCTION(MCharSendMessage)(CORO_PARAM, uint32 nChar, uint32 dwMes
CORO_INVOKE_0(_ctx->text->waitForEndDisplay);

if (_ctx->curVoc) {
_ctx->voice->Stop();
_ctx->voice->Release();
_ctx->voice->stop();
_ctx->voice->release();
_ctx->voice = NULL;
}

Expand Down Expand Up @@ -1787,7 +1788,7 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg
uint32 h;
bool bIsBack;
VoiceHeader *curVoc;
FPSFX *voice;
FPSfx *voice;
RMPoint pt;
CORO_END_CONTEXT(_ctx);

Expand All @@ -1805,10 +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
_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);
_vm->_theSound.createSfx(&_ctx->voice);
_ctx->voice->loadVoiceFromVDB(_vm->_vdbFP);
_ctx->voice->setLoop(false);
if (_ctx->bIsBack)
_ctx->voice->setVolume(55);
}

_ctx->string = mpalQueryDialogPeriod(nMsg);
Expand Down Expand Up @@ -1904,7 +1906,7 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg
GLOBALS.LinkGraphicTask(_ctx->text);

if (_ctx->curVoc) {
_ctx->voice->Play();
_ctx->voice->play();
_ctx->text->setCustomSkipHandle2(_ctx->voice->hEndOfBuffer);
}

Expand All @@ -1914,8 +1916,8 @@ DECLARE_CUSTOM_FUNCTION(SendDialogMessage)(CORO_PARAM, uint32 nPers, uint32 nMsg
}

if (_ctx->curVoc) {
_ctx->voice->Stop();
_ctx->voice->Release();
_ctx->voice->stop();
_ctx->voice->release();
_ctx->voice = NULL;
}

Expand Down
14 changes: 7 additions & 7 deletions engines/tony/loc.cpp
Expand Up @@ -409,7 +409,7 @@ void RMSfx::readFromStream(RMDataStream &ds, bool bLOX) {

// Create the sound effect
_fx = _vm->createSFX(stream);
_fx->SetLoop(false);
_fx->setLoop(false);
}

RMSfx::RMSfx() {
Expand All @@ -419,15 +419,15 @@ RMSfx::RMSfx() {

RMSfx::~RMSfx() {
if (_fx) {
_fx->Release();
_fx->release();
_fx = NULL;
}
}

void RMSfx::play(bool bLoop) {
if (_fx && !_bPlayingLoop) {
_fx->SetLoop(bLoop);
_fx->Play();
_fx->setLoop(bLoop);
_fx->play();

if (bLoop)
_bPlayingLoop = true;
Expand All @@ -436,19 +436,19 @@ void RMSfx::play(bool bLoop) {

void RMSfx::setVolume(int vol) {
if (_fx) {
_fx->SetVolume(vol);
_fx->setVolume(vol);
}
}

void RMSfx::pause(bool bPause) {
if (_fx) {
_fx->Pause(bPause);
_fx->pause(bPause);
}
}

void RMSfx::stop(void) {
if (_fx) {
_fx->Stop();
_fx->stop();
_bPlayingLoop = false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion engines/tony/loc.h
Expand Up @@ -72,7 +72,7 @@ class RMPalette {
class RMSfx {
public:
RMString _name;
FPSFX *_fx;
FPSfx *_fx;
bool _bPlayingLoop;

public:
Expand Down

0 comments on commit ddd1414

Please sign in to comment.