From fa3868518d1769353ccf335b7435a9c7a90154f4 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Mon, 9 Jul 2012 00:11:20 +0200 Subject: WINTERMUTE: Rename FuncName/VarName->funcName/varName in ScScript --- engines/wintermute/Ad/AdActor.cpp | 10 +- engines/wintermute/Ad/AdEntity.cpp | 2 +- engines/wintermute/Ad/AdGame.cpp | 10 +- engines/wintermute/Ad/AdItem.cpp | 6 +- engines/wintermute/Ad/AdObject.cpp | 16 +- engines/wintermute/Ad/AdScene.cpp | 8 +- engines/wintermute/Ad/AdTalkHolder.cpp | 6 +- engines/wintermute/Base/BFrame.cpp | 6 +- engines/wintermute/Base/BGame.cpp | 20 +- engines/wintermute/Base/BScriptHolder.cpp | 4 +- engines/wintermute/Base/BScriptable.cpp | 2 +- engines/wintermute/Base/BSprite.cpp | 4 +- engines/wintermute/Base/scriptables/SXFile.cpp | 42 +-- .../wintermute/Base/scriptables/SXMemBuffer.cpp | 4 +- engines/wintermute/Base/scriptables/SXStore.cpp | 4 +- engines/wintermute/Base/scriptables/ScEngine.cpp | 26 +- engines/wintermute/Base/scriptables/ScScript.cpp | 357 +++++++++++---------- engines/wintermute/Base/scriptables/ScScript.h | 60 ++-- engines/wintermute/UI/UIWindow.cpp | 4 +- 19 files changed, 301 insertions(+), 290 deletions(-) (limited to 'engines') diff --git a/engines/wintermute/Ad/AdActor.cpp b/engines/wintermute/Ad/AdActor.cpp index d4d41c0fa6..821c66f6fc 100644 --- a/engines/wintermute/Ad/AdActor.cpp +++ b/engines/wintermute/Ad/AdActor.cpp @@ -859,7 +859,7 @@ HRESULT CAdActor::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi int X = stack->pop()->getInt(); int Y = stack->pop()->getInt(); goTo(X, Y); - if (strcmp(name, "GoToAsync") != 0) script->WaitForExclusive(this); + if (strcmp(name, "GoToAsync") != 0) script->waitForExclusive(this); stack->pushNULL(); return S_OK; } @@ -871,20 +871,20 @@ HRESULT CAdActor::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi stack->correctParams(1); CScValue *Val = stack->pop(); if (!Val->isNative()) { - script->RuntimeError("actor.%s method accepts an entity refrence only", name); + script->runtimeError("actor.%s method accepts an entity refrence only", name); stack->pushNULL(); return S_OK; } CAdObject *Obj = (CAdObject *)Val->getNative(); if (!Obj || Obj->_type != OBJECT_ENTITY) { - script->RuntimeError("actor.%s method accepts an entity refrence only", name); + script->runtimeError("actor.%s method accepts an entity refrence only", name); stack->pushNULL(); return S_OK; } CAdEntity *Ent = (CAdEntity *)Obj; if (Ent->_walkToX == 0 && Ent->_walkToY == 0) goTo(Ent->_posX, Ent->_posY); else goTo(Ent->_walkToX, Ent->_walkToY, Ent->_walkToDir); - if (strcmp(name, "GoToObjectAsync") != 0) script->WaitForExclusive(this); + if (strcmp(name, "GoToObjectAsync") != 0) script->waitForExclusive(this); stack->pushNULL(); return S_OK; } @@ -908,7 +908,7 @@ HRESULT CAdActor::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi if (dir >= 0 && dir < NUM_DIRECTIONS) { turnTo((TDirection)dir); - if (strcmp(name, "TurnToAsync") != 0) script->WaitForExclusive(this); + if (strcmp(name, "TurnToAsync") != 0) script->waitForExclusive(this); } stack->pushNULL(); return S_OK; diff --git a/engines/wintermute/Ad/AdEntity.cpp b/engines/wintermute/Ad/AdEntity.cpp index 4686e655ce..d839dfec3b 100644 --- a/engines/wintermute/Ad/AdEntity.cpp +++ b/engines/wintermute/Ad/AdEntity.cpp @@ -655,7 +655,7 @@ HRESULT CAdEntity::scCallMethod(CScScript *script, CScStack *stack, CScStack *th //if(m_Scale>=0) m_Theora->m_PlayZoom = m_Scale; stack->pushBool(true); } else { - script->RuntimeError("Entity.PlayTheora - error playing video '%s'", filename); + script->runtimeError("Entity.PlayTheora - error playing video '%s'", filename); stack->pushBool(false); } diff --git a/engines/wintermute/Ad/AdGame.cpp b/engines/wintermute/Ad/AdGame.cpp index 62c2def022..d6485f5cd4 100644 --- a/engines/wintermute/Ad/AdGame.cpp +++ b/engines/wintermute/Ad/AdGame.cpp @@ -487,7 +487,7 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this _responseBox->_responses.Add(res); } } else { - script->RuntimeError("Game.AddResponse: response box is not defined"); + script->runtimeError("Game.AddResponse: response box is not defined"); } stack->pushNULL(); @@ -541,11 +541,11 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this _responseBox->createButtons(); _responseBox->_waitingScript = script; - script->WaitForExclusive(_responseBox); + script->waitForExclusive(_responseBox); _state = GAME_SEMI_FROZEN; _stateEx = GAME_WAITING_RESPONSE; } else { - script->RuntimeError("Game.GetResponse: response box is not defined"); + script->runtimeError("Game.GetResponse: response box is not defined"); stack->pushNULL(); } return S_OK; @@ -561,7 +561,7 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this _responseBox->weedResponses(); stack->pushInt(_responseBox->_responses.GetSize()); } else { - script->RuntimeError("Game.GetNumResponses: response box is not defined"); + script->runtimeError("Game.GetNumResponses: response box is not defined"); stack->pushNULL(); } return S_OK; @@ -663,7 +663,7 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this } } } - } else script->RuntimeError("Game.IsItemTaken: item name expected"); + } else script->runtimeError("Game.IsItemTaken: item name expected"); stack->pushBool(false); return S_OK; diff --git a/engines/wintermute/Ad/AdItem.cpp b/engines/wintermute/Ad/AdItem.cpp index 36daeefd91..c05e18daf1 100644 --- a/engines/wintermute/Ad/AdItem.cpp +++ b/engines/wintermute/Ad/AdItem.cpp @@ -447,7 +447,7 @@ HRESULT CAdItem::scCallMethod(CScScript *script, CScStack *stack, CScStack *this CBSprite *spr = new CBSprite(Game, this); if (!spr || FAILED(spr->loadFile(filename))) { stack->pushBool(false); - script->RuntimeError("Item.SetHoverSprite failed for file '%s'", filename); + script->runtimeError("Item.SetHoverSprite failed for file '%s'", filename); } else { _spriteHover = spr; if (setCurrent) _currentSprite = _spriteHover; @@ -490,7 +490,7 @@ HRESULT CAdItem::scCallMethod(CScScript *script, CScStack *stack, CScStack *this CBSprite *spr = new CBSprite(Game); if (!spr || FAILED(spr->loadFile(filename))) { stack->pushBool(false); - script->RuntimeError("Item.SetNormalCursor failed for file '%s'", filename); + script->runtimeError("Item.SetNormalCursor failed for file '%s'", filename); } else { _cursorNormal = spr; stack->pushBool(true); @@ -533,7 +533,7 @@ HRESULT CAdItem::scCallMethod(CScScript *script, CScStack *stack, CScStack *this CBSprite *spr = new CBSprite(Game); if (!spr || FAILED(spr->loadFile(filename))) { stack->pushBool(false); - script->RuntimeError("Item.SetHoverCursor failed for file '%s'", filename); + script->runtimeError("Item.SetHoverCursor failed for file '%s'", filename); } else { _cursorHover = spr; stack->pushBool(true); diff --git a/engines/wintermute/Ad/AdObject.cpp b/engines/wintermute/Ad/AdObject.cpp index 2fa7df10a2..cdb84a35da 100644 --- a/engines/wintermute/Ad/AdObject.cpp +++ b/engines/wintermute/Ad/AdObject.cpp @@ -196,7 +196,7 @@ HRESULT CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th stack->correctParams(1); if (FAILED(playAnim(stack->pop()->getString()))) stack->pushBool(false); else { - if (strcmp(name, "PlayAnimAsync") != 0) script->WaitFor(this); + if (strcmp(name, "PlayAnimAsync") != 0) script->waitFor(this); stack->pushBool(true); } return S_OK; @@ -273,7 +273,7 @@ HRESULT CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th const char *sound = soundVal->isNULL() ? NULL : soundVal->getString(); talk(text, sound, duration, stances, (TTextAlign)align); - if (strcmp(name, "TalkAsync") != 0) script->WaitForExclusive(this); + if (strcmp(name, "TalkAsync") != 0) script->waitForExclusive(this); stack->pushNULL(); return S_OK; @@ -360,13 +360,13 @@ HRESULT CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th const char *itemName = val->getString(); val = stack->pop(); const char *insertAfter = val->isNULL() ? NULL : val->getString(); - if (FAILED(_inventory->insertItem(itemName, insertAfter))) script->RuntimeError("Cannot add item '%s' to inventory", itemName); + if (FAILED(_inventory->insertItem(itemName, insertAfter))) script->runtimeError("Cannot add item '%s' to inventory", itemName); else { // hide associated entities ((CAdGame *)Game)->_scene->handleItemAssociations(itemName, false); } - } else script->RuntimeError("TakeItem: item name expected"); + } else script->runtimeError("TakeItem: item name expected"); stack->pushNULL(); return S_OK; @@ -385,12 +385,12 @@ HRESULT CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th CScValue *val = stack->pop(); if (!val->isNULL()) { - if (FAILED(_inventory->removeItem(val->getString()))) script->RuntimeError("Cannot remove item '%s' from inventory", val->getString()); + if (FAILED(_inventory->removeItem(val->getString()))) script->runtimeError("Cannot remove item '%s' from inventory", val->getString()); else { // show associated entities ((CAdGame *)Game)->_scene->handleItemAssociations(val->getString(), true); } - } else script->RuntimeError("DropItem: item name expected"); + } else script->runtimeError("DropItem: item name expected"); stack->pushNULL(); return S_OK; @@ -442,7 +442,7 @@ HRESULT CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th return S_OK; } } - } else script->RuntimeError("HasItem: item name expected"); + } else script->runtimeError("HasItem: item name expected"); stack->pushBool(false); return S_OK; @@ -493,7 +493,7 @@ HRESULT CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th if (FAILED(res = ent->loadFile(filename))) { delete ent; ent = NULL; - script->RuntimeError("AddAttachment() failed loading entity '%s'", filename); + script->runtimeError("AddAttachment() failed loading entity '%s'", filename); stack->pushBool(false); } else { Game->registerObject(ent); diff --git a/engines/wintermute/Ad/AdScene.cpp b/engines/wintermute/Ad/AdScene.cpp index 7415de6add..2e99b93e88 100644 --- a/engines/wintermute/Ad/AdScene.cpp +++ b/engines/wintermute/Ad/AdScene.cpp @@ -1331,7 +1331,7 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi } else { scrollTo(val1->getInt(), val2->getInt()); } - if (strcmp(name, "ScrollTo") == 0) script->WaitForExclusive(this); + if (strcmp(name, "ScrollTo") == 0) script->waitForExclusive(this); stack->pushNULL(); return S_OK; } @@ -1513,7 +1513,7 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi byte alpha = stack->pop()->getInt(0xFF); _fader->fadeOut(DRGBA(red, green, blue, alpha), duration); - if (strcmp(name, "FadeOutAsync") != 0) script->WaitFor(_fader); + if (strcmp(name, "FadeOutAsync") != 0) script->waitFor(_fader); stack->pushNULL(); return S_OK; @@ -1531,7 +1531,7 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi byte alpha = stack->pop()->getInt(0xFF); _fader->fadeIn(DRGBA(red, green, blue, alpha), duration); - if (strcmp(name, "FadeInAsync") != 0) script->WaitFor(_fader); + if (strcmp(name, "FadeInAsync") != 0) script->waitFor(_fader); stack->pushNULL(); return S_OK; @@ -1650,7 +1650,7 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi } if (toDelete->_main) { - script->RuntimeError("Scene.DeleteLayer - cannot delete main scene layer"); + script->runtimeError("Scene.DeleteLayer - cannot delete main scene layer"); stack->pushBool(false); return S_OK; } diff --git a/engines/wintermute/Ad/AdTalkHolder.cpp b/engines/wintermute/Ad/AdTalkHolder.cpp index 9d4c4c8e8b..5516117004 100644 --- a/engines/wintermute/Ad/AdTalkHolder.cpp +++ b/engines/wintermute/Ad/AdTalkHolder.cpp @@ -142,7 +142,7 @@ HRESULT CAdTalkHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack const char *filename = val->getString(); CBSprite *spr = new CBSprite(Game, this); if (!spr || FAILED(spr->loadFile(filename))) { - script->RuntimeError("SetSprite method failed for file '%s'", filename); + script->runtimeError("SetSprite method failed for file '%s'", filename); stack->pushBool(false); } else { _sprite = spr; @@ -187,7 +187,7 @@ HRESULT CAdTalkHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack CBSprite *spr = new CBSprite(Game, this); if (!spr || FAILED(spr->loadFile(filename))) { stack->pushBool(false); - script->RuntimeError("AddTalkSprite method failed for file '%s'", filename); + script->runtimeError("AddTalkSprite method failed for file '%s'", filename); } else { if (Ex) _talkSpritesEx.Add(spr); else _talkSprites.Add(spr); @@ -258,7 +258,7 @@ HRESULT CAdTalkHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack CBSprite *spr = new CBSprite(Game, this); if (!spr || FAILED(spr->loadFile(filename))) { stack->pushBool(false); - script->RuntimeError("SetTalkSprite method failed for file '%s'", filename); + script->runtimeError("SetTalkSprite method failed for file '%s'", filename); } else { // delete current diff --git a/engines/wintermute/Base/BFrame.cpp b/engines/wintermute/Base/BFrame.cpp index 58b0b5384b..65d2d55f6a 100644 --- a/engines/wintermute/Base/BFrame.cpp +++ b/engines/wintermute/Base/BFrame.cpp @@ -439,7 +439,7 @@ HRESULT CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this stack->correctParams(1); int index = stack->pop()->getInt(-1); if (index < 0 || index >= _subframes.GetSize()) { - script->RuntimeError("Frame.GetSubframe: Subframe index %d is out of range.", index); + script->runtimeError("Frame.GetSubframe: Subframe index %d is out of range.", index); stack->pushNULL(); } else stack->pushNative(_subframes[index], true); @@ -455,7 +455,7 @@ HRESULT CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this if (val->isInt()) { int index = val->getInt(-1); if (index < 0 || index >= _subframes.GetSize()) { - script->RuntimeError("Frame.DeleteSubframe: Subframe index %d is out of range.", index); + script->runtimeError("Frame.DeleteSubframe: Subframe index %d is out of range.", index); } } else { CBSubFrame *sub = (CBSubFrame *)val->getNative(); @@ -522,7 +522,7 @@ HRESULT CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this stack->correctParams(1); int index = stack->pop()->getInt(-1); if (index < 0 || index >= _applyEvent.GetSize()) { - script->RuntimeError("Frame.GetEvent: Event index %d is out of range.", index); + script->runtimeError("Frame.GetEvent: Event index %d is out of range.", index); stack->pushNULL(); } else stack->pushString(_applyEvent[index]); return S_OK; diff --git a/engines/wintermute/Base/BGame.cpp b/engines/wintermute/Base/BGame.cpp index d34c526a23..2117e18f8b 100644 --- a/engines/wintermute/Base/BGame.cpp +++ b/engines/wintermute/Base/BGame.cpp @@ -1315,7 +1315,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS bool swap = stack->pop()->getBool(true); if (_musicCrossfadeRunning) { - script->RuntimeError("Game.MusicCrossfade: Music crossfade is already in progress."); + script->runtimeError("Game.MusicCrossfade: Music crossfade is already in progress."); stack->pushBool(false); return S_OK; } @@ -1425,7 +1425,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS if (SUCCEEDED(Game->_videoPlayer->initialize(filename, SubtitleFile))) { if (SUCCEEDED(Game->_videoPlayer->play((TVideoPlayback)Type, xVal, yVal, FreezeMusic))) { stack->pushBool(true); - script->Sleep(0); + script->sleep(0); } else stack->pushBool(false); } else stack->pushBool(false); @@ -1466,7 +1466,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS _theoraPlayer->_dontDropFrames = !dropFrames; if (SUCCEEDED(_theoraPlayer->play((TVideoPlayback)type, xVal, yVal, true, freezeMusic))) { stack->pushBool(true); - script->Sleep(0); + script->sleep(0); } else stack->pushBool(false); } else { stack->pushBool(false); @@ -1562,7 +1562,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS _scheduledLoadSlot = stack->pop()->getInt(); _loading = true; stack->pushBool(false); - script->Sleep(0); + script->sleep(0); return S_OK; } @@ -1764,7 +1764,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS bool system = (strcmp(name, "SystemFadeOut") == 0 || strcmp(name, "SystemFadeOutAsync") == 0); _fader->fadeOut(DRGBA(red, green, blue, alpha), duration, system); - if (strcmp(name, "FadeOutAsync") != 0 && strcmp(name, "SystemFadeOutAsync") != 0) script->WaitFor(_fader); + if (strcmp(name, "FadeOutAsync") != 0 && strcmp(name, "SystemFadeOutAsync") != 0) script->waitFor(_fader); stack->pushNULL(); return S_OK; @@ -1784,7 +1784,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS bool System = (strcmp(name, "SystemFadeIn") == 0 || strcmp(name, "SystemFadeInAsync") == 0); _fader->fadeIn(DRGBA(red, green, blue, alpha), duration, system); - if (strcmp(name, "FadeInAsync") != 0 && strcmp(name, "SystemFadeInAsync") != 0) script->WaitFor(_fader); + if (strcmp(name, "FadeInAsync") != 0 && strcmp(name, "SystemFadeInAsync") != 0) script->waitFor(_fader); stack->pushNULL(); return S_OK; @@ -3012,7 +3012,7 @@ HRESULT CBGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisS else if (strcmp(name, "Sleep") == 0) { stack->correctParams(1); - script->Sleep((uint32)stack->pop()->getInt()); + script->sleep((uint32)stack->pop()->getInt()); stack->pushNULL(); } @@ -3023,7 +3023,7 @@ HRESULT CBGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisS stack->correctParams(1); CBScriptable *obj = stack->pop()->getNative(); - if (validObject((CBObject *)obj)) script->WaitForExclusive((CBObject *)obj); + if (validObject((CBObject *)obj)) script->waitForExclusive((CBObject *)obj); stack->pushNULL(); } @@ -3161,7 +3161,7 @@ HRESULT CBGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisS if (Game->getDebugMgr()->_enabled) { Game->getDebugMgr()->onScriptHitBreakpoint(script); - script->Sleep(0); + script->sleep(0); } stack->pushNULL(); } @@ -3208,7 +3208,7 @@ HRESULT CBGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisS ////////////////////////////////////////////////////////////////////////// // failure else { - script->RuntimeError("Call to undefined function '%s'. Ignored.", name); + script->runtimeError("Call to undefined function '%s'. Ignored.", name); stack->correctParams(0); stack->pushNULL(); } diff --git a/engines/wintermute/Base/BScriptHolder.cpp b/engines/wintermute/Base/BScriptHolder.cpp index f07e2575dd..2049287be5 100644 --- a/engines/wintermute/Base/BScriptHolder.cpp +++ b/engines/wintermute/Base/BScriptHolder.cpp @@ -86,7 +86,7 @@ HRESULT CBScriptHolder::applyEvent(const char *eventName, bool unbreakable) { HRESULT ret = E_FAIL; for (int i = 0; i < _scripts.GetSize(); i++) { if (!_scripts[i]->_thread) { - CScScript *handler = _scripts[i]->InvokeEventHandler(eventName, unbreakable); + CScScript *handler = _scripts[i]->invokeEventHandler(eventName, unbreakable); if (handler) { //_scripts.Add(handler); numHandlers++; @@ -433,7 +433,7 @@ CScScript *CBScriptHolder::invokeMethodThread(const char *methodName) { CScScript *thread = new CScScript(Game, _scripts[i]->_engine); if (thread) { - HRESULT ret = thread->CreateMethodThread(_scripts[i], methodName); + HRESULT ret = thread->createMethodThread(_scripts[i], methodName); if (SUCCEEDED(ret)) { _scripts[i]->_engine->_scripts.Add(thread); Game->getDebugMgr()->onScriptMethodThreadInit(thread, _scripts[i], methodName); diff --git a/engines/wintermute/Base/BScriptable.cpp b/engines/wintermute/Base/BScriptable.cpp index 16470ebf3c..0e0ca7d45b 100644 --- a/engines/wintermute/Base/BScriptable.cpp +++ b/engines/wintermute/Base/BScriptable.cpp @@ -65,7 +65,7 @@ HRESULT CBScriptable::scCallMethod(CScScript *script, CScStack *stack, CScStack /* stack->correctParams(0); stack->pushNULL(); - script->RuntimeError("Call to undefined method '%s'.", name); + script->runtimeError("Call to undefined method '%s'.", name); return S_OK; */ diff --git a/engines/wintermute/Base/BSprite.cpp b/engines/wintermute/Base/BSprite.cpp index 79d35d948b..0b12e2cb5a 100644 --- a/engines/wintermute/Base/BSprite.cpp +++ b/engines/wintermute/Base/BSprite.cpp @@ -515,7 +515,7 @@ HRESULT CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi stack->correctParams(1); int Index = stack->pop()->getInt(-1); if (Index < 0 || Index >= _frames.GetSize()) { - script->RuntimeError("Sprite.GetFrame: Frame index %d is out of range.", Index); + script->runtimeError("Sprite.GetFrame: Frame index %d is out of range.", Index); stack->pushNULL(); } else stack->pushNative(_frames[Index], true); return S_OK; @@ -530,7 +530,7 @@ HRESULT CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi if (Val->isInt()) { int Index = Val->getInt(-1); if (Index < 0 || Index >= _frames.GetSize()) { - script->RuntimeError("Sprite.DeleteFrame: Frame index %d is out of range.", Index); + script->runtimeError("Sprite.DeleteFrame: Frame index %d is out of range.", Index); } } else { CBFrame *Frame = (CBFrame *)Val->getNative(); diff --git a/engines/wintermute/Base/scriptables/SXFile.cpp b/engines/wintermute/Base/scriptables/SXFile.cpp index dab7786e66..34d133e330 100644 --- a/engines/wintermute/Base/scriptables/SXFile.cpp +++ b/engines/wintermute/Base/scriptables/SXFile.cpp @@ -126,13 +126,13 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this Close(); _mode = stack->pop()->getInt(1); if (_mode < 1 || _mode > 3) { - script->RuntimeError("File.%s: invalid access mode. Setting read mode.", name); + script->runtimeError("File.%s: invalid access mode. Setting read mode.", name); _mode = 1; } if (_mode == 1) { _readFile = Game->_fileManager->openFile(_filename); if (!_readFile) { - //script->RuntimeError("File.%s: Error opening file '%s' for reading.", Name, _filename); + //script->runtimeError("File.%s: Error opening file '%s' for reading.", Name, _filename); Close(); } else _textMode = strcmp(name, "OpenAsText") == 0; } else { @@ -145,7 +145,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this } if (!_writeFile) { - //script->RuntimeError("File.%s: Error opening file '%s' for writing.", Name, _filename); + //script->runtimeError("File.%s: Error opening file '%s' for writing.", Name, _filename); Close(); } else _textMode = strcmp(name, "OpenAsText") == 0; } @@ -172,7 +172,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this else if (strcmp(name, "SetPosition") == 0) { stack->correctParams(1); if (_mode == 0) { - script->RuntimeError("File.%s: File is not open", name); + script->runtimeError("File.%s: File is not open", name); stack->pushBool(false); } else { int Pos = stack->pop()->getInt(); @@ -210,7 +210,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this else if (strcmp(name, "ReadLine") == 0) { stack->correctParams(0); if (!_textMode || !_readFile) { - script->RuntimeError("File.%s: File must be open in text mode.", name); + script->runtimeError("File.%s: File must be open in text mode.", name); stack->pushNULL(); return S_OK; } @@ -261,7 +261,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this int TextLen = stack->pop()->getInt(); if (!_textMode || !_readFile) { - script->RuntimeError("File.%s: File must be open in text mode.", name); + script->runtimeError("File.%s: File must be open in text mode.", name); stack->pushNULL(); return S_OK; } @@ -307,7 +307,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this stack->correctParams(1); const char *Line = stack->pop()->getString(); if (!_textMode || !_writeFile) { - script->RuntimeError("File.%s: File must be open for writing in text mode.", name); + script->runtimeError("File.%s: File must be open for writing in text mode.", name); stack->pushBool(false); return S_OK; } @@ -328,7 +328,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this else if (strcmp(name, "ReadBool") == 0) { stack->correctParams(0); if (_textMode || !_readFile) { - script->RuntimeError("File.%s: File must be open for reading in binary mode.", name); + script->runtimeError("File.%s: File must be open for reading in binary mode.", name); stack->pushNULL(); return S_OK; } @@ -345,7 +345,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this else if (strcmp(name, "ReadByte") == 0) { stack->correctParams(0); if (_textMode || !_readFile) { - script->RuntimeError("File.%s: File must be open for reading in binary mode.", name); + script->runtimeError("File.%s: File must be open for reading in binary mode.", name); stack->pushNULL(); return S_OK; } @@ -362,7 +362,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this else if (strcmp(name, "ReadShort") == 0) { stack->correctParams(0); if (_textMode || !_readFile) { - script->RuntimeError("File.%s: File must be open for reading in binary mode.", name); + script->runtimeError("File.%s: File must be open for reading in binary mode.", name); stack->pushNULL(); return S_OK; } @@ -379,7 +379,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this else if (strcmp(name, "ReadInt") == 0 || strcmp(name, "ReadLong") == 0) { stack->correctParams(0); if (_textMode || !_readFile) { - script->RuntimeError("File.%s: File must be open for reading in binary mode.", name); + script->runtimeError("File.%s: File must be open for reading in binary mode.", name); stack->pushNULL(); return S_OK; } @@ -396,7 +396,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this else if (strcmp(name, "ReadFloat") == 0) { stack->correctParams(0); if (_textMode || !_readFile) { - script->RuntimeError("File.%s: File must be open for reading in binary mode.", name); + script->runtimeError("File.%s: File must be open for reading in binary mode.", name); stack->pushNULL(); return S_OK; } @@ -413,7 +413,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this else if (strcmp(name, "ReadDouble") == 0) { stack->correctParams(0); if (_textMode || !_readFile) { - script->RuntimeError("File.%s: File must be open for reading in binary mode.", name); + script->runtimeError("File.%s: File must be open for reading in binary mode.", name); stack->pushNULL(); return S_OK; } @@ -430,7 +430,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this else if (strcmp(name, "ReadString") == 0) { stack->correctParams(0); if (_textMode || !_readFile) { - script->RuntimeError("File.%s: File must be open for reading in binary mode.", name); + script->runtimeError("File.%s: File must be open for reading in binary mode.", name); stack->pushNULL(); return S_OK; } @@ -457,7 +457,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this bool Val = stack->pop()->getBool(); if (_textMode || !_writeFile) { - script->RuntimeError("File.%s: File must be open for writing in binary mode.", name); + script->runtimeError("File.%s: File must be open for writing in binary mode.", name); stack->pushBool(false); return S_OK; } @@ -475,7 +475,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this byte Val = stack->pop()->getInt(); if (_textMode || !_writeFile) { - script->RuntimeError("File.%s: File must be open for writing in binary mode.", name); + script->runtimeError("File.%s: File must be open for writing in binary mode.", name); stack->pushBool(false); return S_OK; } @@ -493,7 +493,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this short Val = stack->pop()->getInt(); if (_textMode || !_writeFile) { - script->RuntimeError("File.%s: File must be open for writing in binary mode.", name); + script->runtimeError("File.%s: File must be open for writing in binary mode.", name); stack->pushBool(false); return S_OK; } @@ -511,7 +511,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this int Val = stack->pop()->getInt(); if (_textMode || !_writeFile) { - script->RuntimeError("File.%s: File must be open for writing in binary mode.", name); + script->runtimeError("File.%s: File must be open for writing in binary mode.", name); stack->pushBool(false); return S_OK; } @@ -529,7 +529,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this float Val = stack->pop()->getFloat(); if (_textMode || !_writeFile) { - script->RuntimeError("File.%s: File must be open for writing in binary mode.", name); + script->runtimeError("File.%s: File must be open for writing in binary mode.", name); stack->pushBool(false); return S_OK; } @@ -547,7 +547,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this double Val = stack->pop()->getFloat(); if (_textMode || !_writeFile) { - script->RuntimeError("File.%s: File must be open for writing in binary mode.", name); + script->runtimeError("File.%s: File must be open for writing in binary mode.", name); stack->pushBool(false); return S_OK; } @@ -565,7 +565,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this const char *Val = stack->pop()->getString(); if (_textMode || !_writeFile) { - script->RuntimeError("File.%s: File must be open for writing in binary mode.", name); + script->runtimeError("File.%s: File must be open for writing in binary mode.", name); stack->pushBool(false); return S_OK; } diff --git a/engines/wintermute/Base/scriptables/SXMemBuffer.cpp b/engines/wintermute/Base/scriptables/SXMemBuffer.cpp index 0afdf08450..8abf336f55 100644 --- a/engines/wintermute/Base/scriptables/SXMemBuffer.cpp +++ b/engines/wintermute/Base/scriptables/SXMemBuffer.cpp @@ -104,13 +104,13 @@ HRESULT CSXMemBuffer::Resize(int NewSize) { ////////////////////////////////////////////////////////////////////////// bool CSXMemBuffer::CheckBounds(CScScript *script, int start, int length) { if (_buffer == NULL) { - script->RuntimeError("Cannot use Set/Get methods on an uninitialized memory buffer"); + script->runtimeError("Cannot use Set/Get methods on an uninitialized memory buffer"); return false; } if (_size == 0) return true; if (start < 0 || length == 0 || start + length > _size) { - script->RuntimeError("Set/Get method call is out of bounds"); + script->runtimeError("Set/Get method call is out of bounds"); return false; } else return true; } diff --git a/engines/wintermute/Base/scriptables/SXStore.cpp b/engines/wintermute/Base/scriptables/SXStore.cpp index 2996da4b79..30ff22f6dc 100644 --- a/engines/wintermute/Base/scriptables/SXStore.cpp +++ b/engines/wintermute/Base/scriptables/SXStore.cpp @@ -419,7 +419,7 @@ bool CSXStore::Purchase(CScScript *script, const char *productId) { } } #endif - script->RuntimeError("Store.Purchase() - '%s' is not a valid product id", productId); + script->runtimeError("Store.Purchase() - '%s' is not a valid product id", productId); return false; } @@ -437,7 +437,7 @@ bool CSXStore::FinishTransaction(CScScript *script, const char *transId) { } } #endif - script->RuntimeError("Store.FinishTransaction() - '%s' is not a valid transaction id", transId); + script->runtimeError("Store.FinishTransaction() - '%s' is not a valid transaction id", transId); return false; } diff --git a/engines/wintermute/Base/scriptables/ScEngine.cpp b/engines/wintermute/Base/scriptables/ScEngine.cpp index 8cae017381..414b4a56c3 100644 --- a/engines/wintermute/Base/scriptables/ScEngine.cpp +++ b/engines/wintermute/Base/scriptables/ScEngine.cpp @@ -242,7 +242,7 @@ CScScript *CScEngine::runScript(const char *filename, CBScriptHolder *owner) { // add new script CScScript *script = new CScScript(Game, this); - HRESULT ret = script->Create(filename, compBuffer, compSize, owner); + HRESULT ret = script->create(filename, compBuffer, compSize, owner); if (FAILED(ret)) { Game->LOG(ret, "Error running script '%s'...", filename); delete script; @@ -388,16 +388,16 @@ HRESULT CScEngine::tick() { if(!obj_found) _scripts[i]->finish(); // _waitObject no longer exists */ if (Game->validObject(_scripts[i]->_waitObject)) { - if (_scripts[i]->_waitObject->isReady()) _scripts[i]->Run(); + if (_scripts[i]->_waitObject->isReady()) _scripts[i]->run(); } else _scripts[i]->finish(); break; } case SCRIPT_SLEEPING: { if (_scripts[i]->_waitFrozen) { - if (_scripts[i]->_waitTime <= CBPlatform::GetTime()) _scripts[i]->Run(); + if (_scripts[i]->_waitTime <= CBPlatform::GetTime()) _scripts[i]->run(); } else { - if (_scripts[i]->_waitTime <= Game->_timer) _scripts[i]->Run(); + if (_scripts[i]->_waitTime <= Game->_timer) _scripts[i]->run(); } break; } @@ -407,12 +407,12 @@ HRESULT CScEngine::tick() { // fake return value _scripts[i]->_stack->pushNULL(); _scripts[i]->_waitScript = NULL; - _scripts[i]->Run(); + _scripts[i]->run(); } else { if (_scripts[i]->_waitScript->_state == SCRIPT_THREAD_FINISHED) { // copy return value _scripts[i]->_stack->push(_scripts[i]->_waitScript->_stack->pop()); - _scripts[i]->Run(); + _scripts[i]->run(); _scripts[i]->_waitScript->finish(); _scripts[i]->_waitScript = NULL; } @@ -437,7 +437,7 @@ HRESULT CScEngine::tick() { uint32 StartTime = CBPlatform::GetTime(); while (_scripts[i]->_state == SCRIPT_RUNNING && CBPlatform::GetTime() - StartTime < _scripts[i]->_timeSlice) { _currentScript = _scripts[i]; - _scripts[i]->ExecuteInstruction(); + _scripts[i]->executeInstruction(); } if (_isProfiling && _scripts[i]->_filename) addScriptTime(_scripts[i]->_filename, CBPlatform::GetTime() - StartTime); } @@ -450,7 +450,7 @@ HRESULT CScEngine::tick() { while (_scripts[i]->_state == SCRIPT_RUNNING) { _currentScript = _scripts[i]; - _scripts[i]->ExecuteInstruction(); + _scripts[i]->executeInstruction(); } if (isProfiling && _scripts[i]->_filename) addScriptTime(_scripts[i]->_filename, CBPlatform::GetTime() - StartTime); } @@ -471,7 +471,7 @@ HRESULT CScEngine::tickUnbreakable() { while (_scripts[i]->_state == SCRIPT_RUNNING) { _currentScript = _scripts[i]; - _scripts[i]->ExecuteInstruction(); + _scripts[i]->executeInstruction(); } _scripts[i]->finish(); _currentScript = NULL; @@ -596,7 +596,7 @@ void CScEngine::editorCleanup() { ////////////////////////////////////////////////////////////////////////// HRESULT CScEngine::pauseAll() { for (int i = 0; i < _scripts.GetSize(); i++) { - if (_scripts[i] != _currentScript) _scripts[i]->Pause(); + if (_scripts[i] != _currentScript) _scripts[i]->pause(); } return S_OK; @@ -606,7 +606,7 @@ HRESULT CScEngine::pauseAll() { ////////////////////////////////////////////////////////////////////////// HRESULT CScEngine::resumeAll() { for (int i = 0; i < _scripts.GetSize(); i++) - _scripts[i]->Resume(); + _scripts[i]->resume(); return S_OK; } @@ -658,13 +658,13 @@ HRESULT CScEngine::dbgSendScripts(IWmeDebugClient *client) { // process normal scripts first for (int i = 0; i < _scripts.GetSize(); i++) { if (_scripts[i]->_thread || _scripts[i]->_methodThread) continue; - _scripts[i]->DbgSendScript(client); + _scripts[i]->dbgSendScript(client); } // and threads later for (int i = 0; i < _scripts.GetSize(); i++) { if (_scripts[i]->_thread || _scripts[i]->_methodThread) - _scripts[i]->DbgSendScript(client); + _scripts[i]->dbgSendScript(client); } return S_OK; diff --git a/engines/wintermute/Base/scriptables/ScScript.cpp b/engines/wintermute/Base/scriptables/ScScript.cpp index 58b590744a..42aacb87e4 100644 --- a/engines/wintermute/Base/scriptables/ScScript.cpp +++ b/engines/wintermute/Base/scriptables/ScScript.cpp @@ -118,7 +118,7 @@ void CScScript::readHeader() { ////////////////////////////////////////////////////////////////////////// -HRESULT CScScript::InitScript() { +HRESULT CScScript::initScript() { if (!_scriptStream) { _scriptStream = new Common::MemoryReadStream(_buffer, _bufferSize); } @@ -136,7 +136,7 @@ HRESULT CScScript::InitScript() { return E_FAIL; } - InitTables(); + initTables(); // init stacks _scopeStack = new CScStack(Game); @@ -165,39 +165,39 @@ HRESULT CScScript::InitScript() { ////////////////////////////////////////////////////////////////////////// -HRESULT CScScript::InitTables() { +HRESULT CScScript::initTables() { uint32 OrigIP = _iP; readHeader(); // load symbol table _iP = _header.symbol_table; - _numSymbols = GetDWORD(); + _numSymbols = getDWORD(); _symbols = new char*[_numSymbols]; for (uint32 i = 0; i < _numSymbols; i++) { - uint32 index = GetDWORD(); - _symbols[index] = GetString(); + uint32 index = getDWORD(); + _symbols[index] = getString(); } // load functions table _iP = _header.func_table; - _numFunctions = GetDWORD(); + _numFunctions = getDWORD(); _functions = new TFunctionPos[_numFunctions]; for (uint32 i = 0; i < _numFunctions; i++) { - _functions[i].pos = GetDWORD(); - _functions[i].name = GetString(); + _functions[i].pos = getDWORD(); + _functions[i].name = getString(); } // load events table _iP = _header.event_table; - _numEvents = GetDWORD(); + _numEvents = getDWORD(); _events = new TEventPos[_numEvents]; for (uint32 i = 0; i < _numEvents; i++) { - _events[i].pos = GetDWORD(); - _events[i].name = GetString(); + _events[i].pos = getDWORD(); + _events[i].name = getString(); } @@ -205,18 +205,18 @@ HRESULT CScScript::InitTables() { if (_header.version >= 0x0101) { _iP = _header.externals_table; - _numExternals = GetDWORD(); + _numExternals = getDWORD(); _externals = new TExternalFunction[_numExternals]; for (uint32 i = 0; i < _numExternals; i++) { - _externals[i].dll_name = GetString(); - _externals[i].name = GetString(); - _externals[i].call_type = (TCallType)GetDWORD(); - _externals[i].returns = (TExternalType)GetDWORD(); - _externals[i].nu_params = GetDWORD(); + _externals[i].dll_name = getString(); + _externals[i].name = getString(); + _externals[i].call_type = (TCallType)getDWORD(); + _externals[i].returns = (TExternalType)getDWORD(); + _externals[i].nu_params = getDWORD(); if (_externals[i].nu_params > 0) { _externals[i].params = new TExternalType[_externals[i].nu_params]; for (int j = 0; j < _externals[i].nu_params; j++) { - _externals[i].params[j] = (TExternalType)GetDWORD(); + _externals[i].params[j] = (TExternalType)getDWORD(); } } } @@ -225,11 +225,11 @@ HRESULT CScScript::InitTables() { // load method table _iP = _header.method_table; - _numMethods = GetDWORD(); + _numMethods = getDWORD(); _methods = new TMethodPos[_numMethods]; for (uint32 i = 0; i < _numMethods; i++) { - _methods[i].pos = GetDWORD(); - _methods[i].name = GetString(); + _methods[i].pos = getDWORD(); + _methods[i].name = getString(); } @@ -240,7 +240,7 @@ HRESULT CScScript::InitTables() { ////////////////////////////////////////////////////////////////////////// -HRESULT CScScript::Create(const char *filename, byte *Buffer, uint32 Size, CBScriptHolder *Owner) { +HRESULT CScScript::create(const char *filename, byte *buffer, uint32 size, CBScriptHolder *owner) { cleanup(); _thread = false; @@ -252,62 +252,62 @@ HRESULT CScScript::Create(const char *filename, byte *Buffer, uint32 Size, CBScr _filename = new char[strlen(filename) + 1]; if (_filename) strcpy(_filename, filename); - _buffer = new byte [Size]; + _buffer = new byte [size]; if (!_buffer) return E_FAIL; - memcpy(_buffer, Buffer, Size); + memcpy(_buffer, buffer, size); - _bufferSize = Size; + _bufferSize = size; - HRESULT res = InitScript(); + HRESULT res = initScript(); if (FAILED(res)) return res; // establish global variables table _globals = new CScValue(Game); - _owner = Owner; + _owner = owner; return S_OK; } ////////////////////////////////////////////////////////////////////////// -HRESULT CScScript::CreateThread(CScScript *Original, uint32 InitIP, const char *EventName) { +HRESULT CScScript::createThread(CScScript *original, uint32 initIP, const char *eventName) { cleanup(); _thread = true; _methodThread = false; - _threadEvent = new char[strlen(EventName) + 1]; - if (_threadEvent) strcpy(_threadEvent, EventName); + _threadEvent = new char[strlen(eventName) + 1]; + if (_threadEvent) strcpy(_threadEvent, eventName); // copy filename - _filename = new char[strlen(Original->_filename) + 1]; - if (_filename) strcpy(_filename, Original->_filename); + _filename = new char[strlen(original->_filename) + 1]; + if (_filename) strcpy(_filename, original->_filename); // copy buffer - _buffer = new byte [Original->_bufferSize]; + _buffer = new byte [original->_bufferSize]; if (!_buffer) return E_FAIL; - memcpy(_buffer, Original->_buffer, Original->_bufferSize); - _bufferSize = Original->_bufferSize; + memcpy(_buffer, original->_buffer, original->_bufferSize); + _bufferSize = original->_bufferSize; // initialize - HRESULT res = InitScript(); + HRESULT res = initScript(); if (FAILED(res)) return res; // copy globals - _globals = Original->_globals; + _globals = original->_globals; // skip to the beginning of the event - _iP = InitIP; + _iP = initIP; _scriptStream->seek(_iP); - _timeSlice = Original->_timeSlice; - _freezable = Original->_freezable; - _owner = Original->_owner; + _timeSlice = original->_timeSlice; + _freezable = original->_freezable; + _owner = original->_owner; - _engine = Original->_engine; - _parentScript = Original; + _engine = original->_engine; + _parentScript = original; return S_OK; } @@ -316,44 +316,44 @@ HRESULT CScScript::CreateThread(CScScript *Original, uint32 InitIP, const char * ////////////////////////////////////////////////////////////////////////// -HRESULT CScScript::CreateMethodThread(CScScript *Original, const char *MethodName) { - uint32 IP = Original->GetMethodPos(MethodName); - if (IP == 0) return E_FAIL; +HRESULT CScScript::createMethodThread(CScScript *original, const char *methodName) { + uint32 ip = original->getMethodPos(methodName); + if (ip == 0) return E_FAIL; cleanup(); _thread = true; _methodThread = true; - _threadEvent = new char[strlen(MethodName) + 1]; - if (_threadEvent) strcpy(_threadEvent, MethodName); + _threadEvent = new char[strlen(methodName) + 1]; + if (_threadEvent) strcpy(_threadEvent, methodName); // copy filename - _filename = new char[strlen(Original->_filename) + 1]; - if (_filename) strcpy(_filename, Original->_filename); + _filename = new char[strlen(original->_filename) + 1]; + if (_filename) strcpy(_filename, original->_filename); // copy buffer - _buffer = new byte [Original->_bufferSize]; + _buffer = new byte [original->_bufferSize]; if (!_buffer) return E_FAIL; - memcpy(_buffer, Original->_buffer, Original->_bufferSize); - _bufferSize = Original->_bufferSize; + memcpy(_buffer, original->_buffer, original->_bufferSize); + _bufferSize = original->_bufferSize; // initialize - HRESULT res = InitScript(); + HRESULT res = initScript(); if (FAILED(res)) return res; // copy globals - _globals = Original->_globals; + _globals = original->_globals; // skip to the beginning of the event - _iP = IP; + _iP = ip; - _timeSlice = Original->_timeSlice; - _freezable = Original->_freezable; - _owner = Original->_owner; + _timeSlice = original->_timeSlice; + _freezable = original->_freezable; + _owner = original->_owner; - _engine = Original->_engine; - _parentScript = Original; + _engine = original->_engine; + _parentScript = original; return S_OK; } @@ -374,16 +374,16 @@ void CScScript::cleanup() { if (_globals && !_thread) delete _globals; _globals = NULL; - if (_scopeStack) delete _scopeStack; + delete _scopeStack; _scopeStack = NULL; - if (_callStack) delete _callStack; + delete _callStack; _callStack = NULL; - if (_thisStack) delete _thisStack; + delete _thisStack; _thisStack = NULL; - if (_stack) delete _stack; + delete _stack; _stack = NULL; if (_functions) delete [] _functions; @@ -430,7 +430,7 @@ void CScScript::cleanup() { ////////////////////////////////////////////////////////////////////////// -uint32 CScScript::GetDWORD() { +uint32 CScScript::getDWORD() { _scriptStream->seek(_iP); uint32 ret = _scriptStream->readUint32LE(); _iP += sizeof(uint32); @@ -439,7 +439,7 @@ uint32 CScScript::GetDWORD() { } ////////////////////////////////////////////////////////////////////////// -double CScScript::GetFloat() { +double CScScript::getFloat() { _scriptStream->seek((int32)_iP); byte buffer[8]; _scriptStream->read(buffer, 8); @@ -459,7 +459,7 @@ double CScScript::GetFloat() { ////////////////////////////////////////////////////////////////////////// -char *CScScript::GetString() { +char *CScScript::getString() { char *ret = (char *)(_buffer + _iP); while (*(char *)(_buffer + _iP) != '\0') _iP++; _iP++; // string terminator @@ -470,7 +470,7 @@ char *CScScript::GetString() { ////////////////////////////////////////////////////////////////////////// -HRESULT CScScript::ExecuteInstruction() { +HRESULT CScScript::executeInstruction() { HRESULT ret = S_OK; uint32 dw; @@ -482,12 +482,12 @@ HRESULT CScScript::ExecuteInstruction() { CScValue *op1; CScValue *op2; - uint32 inst = GetDWORD(); + uint32 inst = getDWORD(); switch (inst) { case II_DEF_VAR: _operand->setNULL(); - dw = GetDWORD(); + dw = getDWORD(); if (_scopeStack->_sP < 0) { _globals->setProp(_symbols[dw], _operand); if (Game->getDebugMgr()->_enabled) @@ -502,7 +502,7 @@ HRESULT CScScript::ExecuteInstruction() { case II_DEF_GLOB_VAR: case II_DEF_CONST_VAR: { - dw = GetDWORD(); + dw = getDWORD(); /* char *Temp = _symbols[dw]; // TODO delete */ // only create global var if it doesn't exist if (!_engine->_globals->propExists(_symbols[dw])) { @@ -541,7 +541,7 @@ HRESULT CScScript::ExecuteInstruction() { case II_CALL: - dw = GetDWORD(); + dw = getDWORD(); _operand->setInt(_iP); _callStack->push(_operand); @@ -575,16 +575,16 @@ HRESULT CScScript::ExecuteInstruction() { _waitScript = var->getNative()->invokeMethodThread(MethodName); if (!_waitScript) { _stack->correctParams(0); - RuntimeError("Error invoking method '%s'.", MethodName); + runtimeError("Error invoking method '%s'.", MethodName); _stack->pushNULL(); } else { _state = SCRIPT_WAITING_SCRIPT; - _waitScript->CopyParameters(_stack); + _waitScript->copyParameters(_stack); } } else { // can call methods in unbreakable mode _stack->correctParams(0); - RuntimeError("Cannot call method '%s'. Ignored.", MethodName); + runtimeError("Cannot call method '%s'. Ignored.", MethodName); _stack->pushNULL(); } delete [] MethodName; @@ -617,7 +617,7 @@ HRESULT CScScript::ExecuteInstruction() { if (FAILED(res)) { _stack->correctParams(0); - RuntimeError("Call to undefined method '%s'. Ignored.", MethodName); + runtimeError("Call to undefined method '%s'. Ignored.", MethodName); _stack->pushNULL(); } } @@ -627,11 +627,11 @@ HRESULT CScScript::ExecuteInstruction() { break; case II_EXTERNAL_CALL: { - uint32 SymbolIndex = GetDWORD(); + uint32 SymbolIndex = getDWORD(); - TExternalFunction *f = GetExternal(_symbols[SymbolIndex]); + TExternalFunction *f = getExternal(_symbols[SymbolIndex]); if (f) { - ExternalCall(_stack, _thisStack, f); + externalCall(_stack, _thisStack, f); } else Game->ExternalCall(this, _stack, _thisStack, _symbols[SymbolIndex]); break; @@ -646,7 +646,7 @@ HRESULT CScScript::ExecuteInstruction() { break; case II_CORRECT_STACK: - dw = GetDWORD(); // params expected + dw = getDWORD(); // params expected _stack->correctParams(dw); break; @@ -660,7 +660,7 @@ HRESULT CScScript::ExecuteInstruction() { break; case II_PUSH_VAR: { - CScValue *var = GetVar(_symbols[GetDWORD()]); + CScValue *var = getVar(_symbols[getDWORD()]); if (false && /*var->_type==VAL_OBJECT ||*/ var->_type == VAL_NATIVE) { _operand->setReference(var); _stack->push(_operand); @@ -669,19 +669,19 @@ HRESULT CScScript::ExecuteInstruction() { } case II_PUSH_VAR_REF: { - CScValue *var = GetVar(_symbols[GetDWORD()]); + CScValue *var = getVar(_symbols[getDWORD()]); _operand->setReference(var); _stack->push(_operand); break; } case II_POP_VAR: { - char *VarName = _symbols[GetDWORD()]; - CScValue *var = GetVar(VarName); + char *VarName = _symbols[getDWORD()]; + CScValue *var = getVar(VarName); if (var) { CScValue *val = _stack->pop(); if (!val) { - RuntimeError("Script stack corruption detected. Please report this script at WME bug reports forum."); + runtimeError("Script stack corruption detected. Please report this script at WME bug reports forum."); var->setNULL(); } else { if (val->getType() == VAL_VARIABLE_REF) val = val->_valRef; @@ -703,21 +703,21 @@ HRESULT CScScript::ExecuteInstruction() { break; case II_PUSH_INT: - _stack->pushInt((int)GetDWORD()); + _stack->pushInt((int)getDWORD()); break; case II_PUSH_FLOAT: - _stack->pushFloat(GetFloat()); + _stack->pushFloat(getFloat()); break; case II_PUSH_BOOL: - _stack->pushBool(GetDWORD() != 0); + _stack->pushBool(getDWORD() != 0); break; case II_PUSH_STRING: - _stack->pushString(GetString()); + _stack->pushString(getString()); break; case II_PUSH_NULL: @@ -730,7 +730,7 @@ HRESULT CScScript::ExecuteInstruction() { break; case II_PUSH_THIS: - _operand->setReference(GetVar(_symbols[GetDWORD()])); + _operand->setReference(getVar(_symbols[getDWORD()])); _thisStack->push(_operand); break; @@ -753,7 +753,7 @@ HRESULT CScScript::ExecuteInstruction() { CScValue *val = _stack->pop(); if (val == NULL) { - RuntimeError("Script stack corruption detected. Please report this script at WME bug reports forum."); + runtimeError("Script stack corruption detected. Please report this script at WME bug reports forum."); var->setNULL(); } else var->setProp(str, val); @@ -772,17 +772,17 @@ HRESULT CScScript::ExecuteInstruction() { break; case II_JMP: - _iP = GetDWORD(); + _iP = getDWORD(); break; case II_JMP_FALSE: { - dw = GetDWORD(); + dw = getDWORD(); //if(!_stack->pop()->getBool()) _iP = dw; - CScValue *Val = _stack->pop(); - if (!Val) { - RuntimeError("Script corruption detected. Did you use '=' instead of '==' for comparison?"); + CScValue *val = _stack->pop(); + if (!val) { + runtimeError("Script corruption detected. Did you use '=' instead of '==' for comparison?"); } else { - if (!Val->getBool()) _iP = dw; + if (!val->getBool()) _iP = dw; } break; } @@ -791,7 +791,8 @@ HRESULT CScScript::ExecuteInstruction() { op2 = _stack->pop(); op1 = _stack->pop(); - if (op1->isNULL() || op2->isNULL()) _operand->setNULL(); + if (op1->isNULL() || op2->isNULL()) + _operand->setNULL(); else if (op1->getType() == VAL_STRING || op2->getType() == VAL_STRING) { char *tempStr = new char [strlen(op1->getString()) + strlen(op2->getString()) + 1]; strcpy(tempStr, op1->getString()); @@ -810,7 +811,8 @@ HRESULT CScScript::ExecuteInstruction() { op2 = _stack->pop(); op1 = _stack->pop(); - if (op1->isNULL() || op2->isNULL()) _operand->setNULL(); + if (op1->isNULL() || op2->isNULL()) + _operand->setNULL(); else if (op1->getType() == VAL_INT && op2->getType() == VAL_INT) _operand->setInt(op1->getInt() - op2->getInt()); else _operand->setFloat(op1->getFloat() - op2->getFloat()); @@ -836,7 +838,8 @@ HRESULT CScScript::ExecuteInstruction() { op2 = _stack->pop(); op1 = _stack->pop(); - if (op2->getFloat() == 0.0f) RuntimeError("Division by zero."); + if (op2->getFloat() == 0.0f) + runtimeError("Division by zero."); if (op1->isNULL() || op2->isNULL() || op2->getFloat() == 0.0f) _operand->setNULL(); else _operand->setFloat(op1->getFloat() / op2->getFloat()); @@ -849,9 +852,11 @@ HRESULT CScScript::ExecuteInstruction() { op2 = _stack->pop(); op1 = _stack->pop(); - if (op2->getInt() == 0) RuntimeError("Division by zero."); + if (op2->getInt() == 0) + runtimeError("Division by zero."); - if (op1->isNULL() || op2->isNULL() || op2->getInt() == 0) _operand->setNULL(); + if (op1->isNULL() || op2->isNULL() || op2->getInt() == 0) + _operand->setNULL(); else _operand->setInt(op1->getInt() % op2->getInt()); _stack->push(_operand); @@ -871,7 +876,7 @@ HRESULT CScScript::ExecuteInstruction() { op2 = _stack->pop(); op1 = _stack->pop(); if (op1 == NULL || op2 == NULL) { - RuntimeError("Script corruption detected. Did you use '=' instead of '==' for comparison?"); + runtimeError("Script corruption detected. Did you use '=' instead of '==' for comparison?"); _operand->setBool(false); } else { _operand->setBool(op1->getBool() && op2->getBool()); @@ -883,7 +888,7 @@ HRESULT CScScript::ExecuteInstruction() { op2 = _stack->pop(); op1 = _stack->pop(); if (op1 == NULL || op2 == NULL) { - RuntimeError("Script corruption detected. Did you use '=' instead of '==' for comparison?"); + runtimeError("Script corruption detected. Did you use '=' instead of '==' for comparison?"); _operand->setBool(false); } else { _operand->setBool(op1->getBool() || op2->getBool()); @@ -1019,21 +1024,21 @@ HRESULT CScScript::ExecuteInstruction() { break; case II_DBG_LINE: { - int NewLine = GetDWORD(); - if (NewLine != _currentLine) { - _currentLine = NewLine; + int newLine = getDWORD(); + if (newLine != _currentLine) { + _currentLine = newLine; if (Game->getDebugMgr()->_enabled) { Game->getDebugMgr()->onScriptChangeLine(this, _currentLine); for (int i = 0; i < _breakpoints.GetSize(); i++) { if (_breakpoints[i] == _currentLine) { Game->getDebugMgr()->onScriptHitBreakpoint(this); - Sleep(0); + sleep(0); break; } } if (_tracingMode) { Game->getDebugMgr()->onScriptHitBreakpoint(this); - Sleep(0); + sleep(0); break; } } @@ -1054,55 +1059,60 @@ HRESULT CScScript::ExecuteInstruction() { ////////////////////////////////////////////////////////////////////////// -uint32 CScScript::GetFuncPos(const char *name) { +uint32 CScScript::getFuncPos(const char *name) { for (int i = 0; i < _numFunctions; i++) { - if (strcmp(name, _functions[i].name) == 0) return _functions[i].pos; + if (strcmp(name, _functions[i].name) == 0) + return _functions[i].pos; } return 0; } ////////////////////////////////////////////////////////////////////////// -uint32 CScScript::GetMethodPos(const char *name) { +uint32 CScScript::getMethodPos(const char *name) { for (int i = 0; i < _numMethods; i++) { - if (strcmp(name, _methods[i].name) == 0) return _methods[i].pos; + if (strcmp(name, _methods[i].name) == 0) + return _methods[i].pos; } return 0; } ////////////////////////////////////////////////////////////////////////// -CScValue *CScScript::GetVar(char *name) { +CScValue *CScScript::getVar(char *name) { CScValue *ret = NULL; // scope locals if (_scopeStack->_sP >= 0) { - if (_scopeStack->getTop()->propExists(name)) ret = _scopeStack->getTop()->getProp(name); + if (_scopeStack->getTop()->propExists(name)) + ret = _scopeStack->getTop()->getProp(name); } // script globals if (ret == NULL) { - if (_globals->propExists(name)) ret = _globals->getProp(name); + if (_globals->propExists(name)) + ret = _globals->getProp(name); } // engine globals if (ret == NULL) { - if (_engine->_globals->propExists(name)) ret = _engine->_globals->getProp(name); + if (_engine->_globals->propExists(name)) + ret = _engine->_globals->getProp(name); } if (ret == NULL) { //RuntimeError("Variable '%s' is inaccessible in the current block. Consider changing the script.", name); Game->LOG(0, "Warning: variable '%s' is inaccessible in the current block. Consider changing the script (script:%s, line:%d)", name, _filename, _currentLine); - CScValue *Val = new CScValue(Game); - CScValue *Scope = _scopeStack->getTop(); - if (Scope) { - Scope->setProp(name, Val); + CScValue *val = new CScValue(Game); + CScValue *scope = _scopeStack->getTop(); + if (scope) { + scope->setProp(name, val); ret = _scopeStack->getTop()->getProp(name); } else { - _globals->setProp(name, Val); + _globals->setProp(name, val); ret = _globals->getProp(name); } - delete Val; + delete val; } return ret; @@ -1110,38 +1120,38 @@ CScValue *CScScript::GetVar(char *name) { ////////////////////////////////////////////////////////////////////////// -HRESULT CScScript::WaitFor(CBObject *Object) { +HRESULT CScScript::waitFor(CBObject *object) { if (_unbreakable) { - RuntimeError("Script cannot be interrupted."); + runtimeError("Script cannot be interrupted."); return S_OK; } _state = SCRIPT_WAITING; - _waitObject = Object; + _waitObject = object; return S_OK; } ////////////////////////////////////////////////////////////////////////// -HRESULT CScScript::WaitForExclusive(CBObject *Object) { - _engine->resetObject(Object); - return WaitFor(Object); +HRESULT CScScript::waitForExclusive(CBObject *object) { + _engine->resetObject(object); + return waitFor(object); } ////////////////////////////////////////////////////////////////////////// -HRESULT CScScript::Sleep(uint32 Duration) { +HRESULT CScScript::sleep(uint32 duration) { if (_unbreakable) { - RuntimeError("Script cannot be interrupted."); + runtimeError("Script cannot be interrupted."); return S_OK; } _state = SCRIPT_SLEEPING; if (Game->_state == GAME_FROZEN) { - _waitTime = CBPlatform::GetTime() + Duration; + _waitTime = CBPlatform::GetTime() + duration; _waitFrozen = true; } else { - _waitTime = Game->_timer + Duration; + _waitTime = Game->_timer + duration; _waitFrozen = false; } return S_OK; @@ -1149,10 +1159,10 @@ HRESULT CScScript::Sleep(uint32 Duration) { ////////////////////////////////////////////////////////////////////////// -HRESULT CScScript::finish(bool IncludingThreads) { - if (_state != SCRIPT_FINISHED && IncludingThreads) { +HRESULT CScScript::finish(bool includingThreads) { + if (_state != SCRIPT_FINISHED && includingThreads) { _state = SCRIPT_FINISHED; - FinishThreads(); + finishThreads(); } else _state = SCRIPT_FINISHED; @@ -1161,14 +1171,14 @@ HRESULT CScScript::finish(bool IncludingThreads) { ////////////////////////////////////////////////////////////////////////// -HRESULT CScScript::Run() { +HRESULT CScScript::run() { _state = SCRIPT_RUNNING; return S_OK; } ////////////////////////////////////////////////////////////////////// -void CScScript::RuntimeError(LPCSTR fmt, ...) { +void CScScript::runtimeError(LPCSTR fmt, ...) { char buff[256]; va_list va; @@ -1205,7 +1215,7 @@ HRESULT CScScript::persist(CBPersistMgr *persistMgr) { _buffer = new byte[_bufferSize]; persistMgr->getBytes(_buffer, _bufferSize); _scriptStream = new Common::MemoryReadStream(_buffer, _bufferSize); - InitTables(); + initTables(); } else { _buffer = NULL; _scriptStream = NULL; @@ -1247,19 +1257,19 @@ HRESULT CScScript::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -CScScript *CScScript::InvokeEventHandler(const char *EventName, bool Unbreakable) { +CScScript *CScScript::invokeEventHandler(const char *eventName, bool unbreakable) { //if(_state!=SCRIPT_PERSISTENT) return NULL; - uint32 pos = GetEventPos(EventName); + uint32 pos = getEventPos(eventName); if (!pos) return NULL; CScScript *thread = new CScScript(Game, _engine); if (thread) { - HRESULT ret = thread->CreateThread(this, pos, EventName); + HRESULT ret = thread->createThread(this, pos, eventName); if (SUCCEEDED(ret)) { - thread->_unbreakable = Unbreakable; + thread->_unbreakable = unbreakable; _engine->_scripts.Add(thread); - Game->getDebugMgr()->onScriptEventThreadInit(thread, this, EventName); + Game->getDebugMgr()->onScriptEventThreadInit(thread, this, eventName); return thread; } else { delete thread; @@ -1271,7 +1281,7 @@ CScScript *CScScript::InvokeEventHandler(const char *EventName, bool Unbreakable ////////////////////////////////////////////////////////////////////////// -uint32 CScScript::GetEventPos(const char *name) { +uint32 CScScript::getEventPos(const char *name) { for (int i = _numEvents - 1; i >= 0; i--) { if (scumm_stricmp(name, _events[i].name) == 0) return _events[i].pos; } @@ -1280,19 +1290,19 @@ uint32 CScScript::GetEventPos(const char *name) { ////////////////////////////////////////////////////////////////////////// -bool CScScript::canHandleEvent(const char *EventName) { - return GetEventPos(EventName) != 0; +bool CScScript::canHandleEvent(const char *eventName) { + return getEventPos(eventName) != 0; } ////////////////////////////////////////////////////////////////////////// -bool CScScript::canHandleMethod(const char *MethodName) { - return GetMethodPos(MethodName) != 0; +bool CScScript::canHandleMethod(const char *methodName) { + return getMethodPos(methodName) != 0; } ////////////////////////////////////////////////////////////////////////// -HRESULT CScScript::Pause() { +HRESULT CScScript::pause() { if (_state == SCRIPT_PAUSED) { Game->LOG(0, "Attempting to pause a paused script ('%s', line %d)", _filename, _currentLine); return E_FAIL; @@ -1308,7 +1318,7 @@ HRESULT CScScript::Pause() { ////////////////////////////////////////////////////////////////////////// -HRESULT CScScript::Resume() { +HRESULT CScScript::resume() { if (_state != SCRIPT_PAUSED) return S_OK; _state = _origState; @@ -1317,16 +1327,17 @@ HRESULT CScScript::Resume() { ////////////////////////////////////////////////////////////////////////// -CScScript::TExternalFunction *CScScript::GetExternal(char *name) { +CScScript::TExternalFunction *CScScript::getExternal(char *name) { for (int i = 0; i < _numExternals; i++) { - if (strcmp(name, _externals[i].name) == 0) return &_externals[i]; + if (strcmp(name, _externals[i].name) == 0) + return &_externals[i]; } return NULL; } ////////////////////////////////////////////////////////////////////////// -HRESULT CScScript::ExternalCall(CScStack *stack, CScStack *thisStack, CScScript::TExternalFunction *Function) { +HRESULT CScScript::externalCall(CScStack *stack, CScStack *thisStack, CScScript::TExternalFunction *function) { #ifndef __WIN32__ @@ -1525,7 +1536,7 @@ double CScScript::GetST0Double(void) { ////////////////////////////////////////////////////////////////////////// -HRESULT CScScript::CopyParameters(CScStack *stack) { +HRESULT CScScript::copyParameters(CScStack *stack) { int i; int NumParams = stack->pop()->getInt(); for (i = NumParams - 1; i >= 0; i--) { @@ -1540,11 +1551,11 @@ HRESULT CScScript::CopyParameters(CScStack *stack) { ////////////////////////////////////////////////////////////////////////// -HRESULT CScScript::FinishThreads() { +HRESULT CScScript::finishThreads() { for (int i = 0; i < _engine->_scripts.GetSize(); i++) { - CScScript *Scr = _engine->_scripts[i]; - if (Scr->_thread && Scr->_state != SCRIPT_FINISHED && Scr->_owner == _owner && scumm_stricmp(Scr->_filename, _filename) == 0) - Scr->finish(true); + CScScript *scr = _engine->_scripts[i]; + if (scr->_thread && scr->_state != SCRIPT_FINISHED && scr->_owner == _owner && scumm_stricmp(scr->_filename, _filename) == 0) + scr->finish(true); } return S_OK; } @@ -1563,19 +1574,19 @@ const char *CScScript::dbgGetFilename() { ////////////////////////////////////////////////////////////////////////// -HRESULT CScScript::DbgSendScript(IWmeDebugClient *Client) { - if (_methodThread) Client->onScriptMethodThreadInit(this, _parentScript, _threadEvent); - else if (_thread) Client->onScriptEventThreadInit(this, _parentScript, _threadEvent); - else Client->onScriptInit(this); +HRESULT CScScript::dbgSendScript(IWmeDebugClient *client) { + if (_methodThread) client->onScriptMethodThreadInit(this, _parentScript, _threadEvent); + else if (_thread) client->onScriptEventThreadInit(this, _parentScript, _threadEvent); + else client->onScriptInit(this); - return DbgSendVariables(Client); + return dbgSendVariables(client); return S_OK; } ////////////////////////////////////////////////////////////////////////// -HRESULT CScScript::DbgSendVariables(IWmeDebugClient *Client) { +HRESULT CScScript::dbgSendVariables(IWmeDebugClient *client) { // send script globals - _globals->DbgSendVariables(Client, WME_DBGVAR_SCRIPT, this, 0); + _globals->DbgSendVariables(client, WME_DBGVAR_SCRIPT, this, 0); // send scope variables if (_scopeStack->_sP >= 0) { @@ -1599,14 +1610,14 @@ int CScScript::dbgGetNumBreakpoints() { } ////////////////////////////////////////////////////////////////////////// -int CScScript::dbgGetBreakpoint(int Index) { - if (Index >= 0 && Index < _breakpoints.GetSize()) return _breakpoints[Index]; +int CScScript::dbgGetBreakpoint(int index) { + if (index >= 0 && index < _breakpoints.GetSize()) return _breakpoints[index]; else return -1; } ////////////////////////////////////////////////////////////////////////// -bool CScScript::dbgSetTracingMode(bool IsTracing) { - _tracingMode = IsTracing; +bool CScScript::dbgSetTracingMode(bool isTracing) { + _tracingMode = isTracing; return true; } @@ -1632,7 +1643,7 @@ void CScScript::afterLoad() { delete _scriptStream; _scriptStream = new Common::MemoryReadStream(_buffer, _bufferSize); - InitTables(); + initTables(); } } diff --git a/engines/wintermute/Base/scriptables/ScScript.h b/engines/wintermute/Base/scriptables/ScScript.h index 12f9ae518a..9dbc7d4522 100644 --- a/engines/wintermute/Base/scriptables/ScScript.h +++ b/engines/wintermute/Base/scriptables/ScScript.h @@ -43,16 +43,16 @@ class CScEngine; class CScStack; class CScScript : public CBBase, public IWmeDebugScript { public: - HRESULT DbgSendScript(IWmeDebugClient *Client); - HRESULT DbgSendVariables(IWmeDebugClient *Client); + HRESULT dbgSendScript(IWmeDebugClient *client); + HRESULT dbgSendVariables(IWmeDebugClient *client); CBArray _breakpoints; bool _tracingMode; CScScript *_parentScript; bool _unbreakable; - HRESULT FinishThreads(); - HRESULT CopyParameters(CScStack *stack); + HRESULT finishThreads(); + HRESULT copyParameters(CScStack *stack); void afterLoad(); @@ -66,31 +66,31 @@ public: CScValue *_operand; CScValue *_reg1; bool _freezable; - HRESULT Resume(); - HRESULT Pause(); - bool canHandleEvent(const char *EventName); - bool canHandleMethod(const char *MethodName); - HRESULT CreateThread(CScScript *Original, uint32 InitIP, const char *EventName); - HRESULT CreateMethodThread(CScScript *Original, const char *MethodName); - CScScript *InvokeEventHandler(const char *EventName, bool Unbreakable = false); + HRESULT resume(); + HRESULT pause(); + bool canHandleEvent(const char *eventName); + bool canHandleMethod(const char *methodName); + HRESULT createThread(CScScript *original, uint32 initIP, const char *eventName); + HRESULT createMethodThread(CScScript *original, const char *methodName); + CScScript *invokeEventHandler(const char *eventName, bool unbreakable = false); uint32 _timeSlice; DECLARE_PERSISTENT(CScScript, CBBase) - void RuntimeError(LPCSTR fmt, ...); - HRESULT Run(); - HRESULT finish(bool IncludingThreads = false); - HRESULT Sleep(uint32 Duration); - HRESULT WaitForExclusive(CBObject *Object); - HRESULT WaitFor(CBObject *Object); + void runtimeError(LPCSTR fmt, ...); + HRESULT run(); + HRESULT finish(bool includingThreads = false); + HRESULT sleep(uint32 duration); + HRESULT waitForExclusive(CBObject *object); + HRESULT waitFor(CBObject *object); uint32 _waitTime; bool _waitFrozen; CBObject *_waitObject; CScScript *_waitScript; TScriptState _state; TScriptState _origState; - CScValue *GetVar(char *name); - uint32 GetFuncPos(const char *name); - uint32 GetEventPos(const char *name); - uint32 GetMethodPos(const char *name); + CScValue *getVar(char *name); + uint32 getFuncPos(const char *name); + uint32 getEventPos(const char *name); + uint32 getMethodPos(const char *name); typedef struct { uint32 magic; uint32 version; @@ -136,12 +136,12 @@ public: CScValue *_globals; CScEngine *_engine; int _currentLine; - HRESULT ExecuteInstruction(); - char *GetString(); - uint32 GetDWORD(); - double GetFloat(); + HRESULT executeInstruction(); + char *getString(); + uint32 getDWORD(); + double getFloat(); void cleanup(); - HRESULT Create(const char *filename, byte *Buffer, uint32 Size, CBScriptHolder *Owner); + HRESULT create(const char *filename, byte *buffer, uint32 size, CBScriptHolder *owner); uint32 _iP; private: void readHeader(); @@ -166,11 +166,11 @@ public: bool _methodThread; char *_threadEvent; CBScriptHolder *_owner; - CScScript::TExternalFunction *GetExternal(char *name); - HRESULT ExternalCall(CScStack *Stack, CScStack *ThisStack, CScScript::TExternalFunction *Function); + CScScript::TExternalFunction *getExternal(char *name); + HRESULT externalCall(CScStack *stack, CScStack *thisStack, CScScript::TExternalFunction *function); private: - HRESULT InitScript(); - HRESULT InitTables(); + HRESULT initScript(); + HRESULT initTables(); // IWmeDebugScript interface implementation diff --git a/engines/wintermute/UI/UIWindow.cpp b/engines/wintermute/UI/UIWindow.cpp index 0c007f94fb..5d1bf05bfb 100644 --- a/engines/wintermute/UI/UIWindow.cpp +++ b/engines/wintermute/UI/UIWindow.cpp @@ -791,7 +791,7 @@ HRESULT CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *th else if (strcmp(name, "GoExclusive") == 0) { stack->correctParams(0); goExclusive(); - script->WaitFor(this); + script->waitFor(this); stack->pushNULL(); return S_OK; } @@ -802,7 +802,7 @@ HRESULT CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *th else if (strcmp(name, "GoSystemExclusive") == 0) { stack->correctParams(0); goSystemExclusive(); - script->WaitFor(this); + script->waitFor(this); stack->pushNULL(); return S_OK; } -- cgit v1.2.3