aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-07-08 23:51:47 +0200
committerEinar Johan Trøan Sømåen2012-07-08 23:51:47 +0200
commitcb06b9feecc2aa591a9a107061f97ee74168f12e (patch)
tree64ddf59280a4d3c9df803f5dbd0a35ef674aadc3 /engines/wintermute
parentf29bc84bdb7d58d376655720436d53c2560c77f2 (diff)
downloadscummvm-rg350-cb06b9feecc2aa591a9a107061f97ee74168f12e.tar.gz
scummvm-rg350-cb06b9feecc2aa591a9a107061f97ee74168f12e.tar.bz2
scummvm-rg350-cb06b9feecc2aa591a9a107061f97ee74168f12e.zip
WINTERMUTE: Rename FuncName/VarName->funcName/varName in ScEngine
Diffstat (limited to 'engines/wintermute')
-rw-r--r--engines/wintermute/Ad/AdGame.cpp2
-rw-r--r--engines/wintermute/Ad/AdObject.cpp2
-rw-r--r--engines/wintermute/Base/BGame.cpp16
-rw-r--r--engines/wintermute/Base/BScriptHolder.cpp4
-rw-r--r--engines/wintermute/Base/scriptables/ScEngine.cpp266
-rw-r--r--engines/wintermute/Base/scriptables/ScEngine.h84
-rw-r--r--engines/wintermute/Base/scriptables/ScScript.cpp6
-rw-r--r--engines/wintermute/wintermute.cpp2
8 files changed, 190 insertions, 192 deletions
diff --git a/engines/wintermute/Ad/AdGame.cpp b/engines/wintermute/Ad/AdGame.cpp
index 66dd247a76..62c2def022 100644
--- a/engines/wintermute/Ad/AdGame.cpp
+++ b/engines/wintermute/Ad/AdGame.cpp
@@ -1707,7 +1707,7 @@ HRESULT CAdGame::displayContent(bool update, bool displayAll) {
} else {
// process scripts
- if (update) _scEngine->Tick();
+ if (update) _scEngine->tick();
POINT p;
getMousePos(&p);
diff --git a/engines/wintermute/Ad/AdObject.cpp b/engines/wintermute/Ad/AdObject.cpp
index 978c4d2c04..2fa7df10a2 100644
--- a/engines/wintermute/Ad/AdObject.cpp
+++ b/engines/wintermute/Ad/AdObject.cpp
@@ -946,7 +946,7 @@ HRESULT CAdObject::reset() {
_state = _nextState = STATE_READY;
- Game->_scEngine->ResetObject(this);
+ Game->_scEngine->resetObject(this);
return S_OK;
}
diff --git a/engines/wintermute/Base/BGame.cpp b/engines/wintermute/Base/BGame.cpp
index 7f24352b5e..d34c526a23 100644
--- a/engines/wintermute/Base/BGame.cpp
+++ b/engines/wintermute/Base/BGame.cpp
@@ -1990,7 +1990,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ClearScriptCache") == 0) {
stack->correctParams(0);
- stack->pushBool(SUCCEEDED(_scEngine->EmptyScriptCache()));
+ stack->pushBool(SUCCEEDED(_scEngine->emptyScriptCache()));
return S_OK;
}
@@ -2130,7 +2130,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "EnableScriptProfiling") == 0) {
stack->correctParams(0);
- _scEngine->EnableProfiling();
+ _scEngine->enableProfiling();
stack->pushNULL();
return S_OK;
@@ -2141,7 +2141,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "DisableScriptProfiling") == 0) {
stack->correctParams(0);
- _scEngine->DisableProfiling();
+ _scEngine->disableProfiling();
stack->pushNULL();
return S_OK;
@@ -3358,7 +3358,7 @@ HRESULT CBGame::initAfterLoad() {
CSysClassRegistry::getInstance()->enumInstances(afterLoadFont, "CBFontTT", NULL);
CSysClassRegistry::getInstance()->enumInstances(afterLoadScript, "CScScript", NULL);
- _scEngine->RefreshScriptBreakpoints();
+ _scEngine->refreshScriptBreakpoints();
if (_store) _store->afterLoad();
return S_OK;
@@ -3745,7 +3745,7 @@ HRESULT CBGame::focusWindow(CUIWindow *Window) {
//////////////////////////////////////////////////////////////////////////
HRESULT CBGame::freeze(bool includingMusic) {
if (_freezeLevel == 0) {
- _scEngine->PauseAll();
+ _scEngine->pauseAll();
_soundMgr->pauseAll(includingMusic);
_origState = _state;
_origInteractive = _interactive;
@@ -3766,7 +3766,7 @@ HRESULT CBGame::unfreeze() {
if (_freezeLevel == 0) {
_state = _origState;
_interactive = _origInteractive;
- _scEngine->ResumeAll();
+ _scEngine->resumeAll();
_soundMgr->resumeAll();
}
@@ -4171,7 +4171,7 @@ HRESULT CBGame::updateMusicCrossfade() {
//////////////////////////////////////////////////////////////////////////
HRESULT CBGame::resetContent() {
- _scEngine->ClearGlobals();
+ _scEngine->clearGlobals();
//_timer = 0;
//_liveTimer = 0;
@@ -4432,7 +4432,7 @@ HRESULT CBGame::displayDebugInfo() {
_renderer->displayDebugInfo();
int scrTotal, scrRunning, scrWaiting, scrPersistent;
- scrTotal = _scEngine->GetNumScripts(&scrRunning, &scrWaiting, &scrPersistent);
+ scrTotal = _scEngine->getNumScripts(&scrRunning, &scrWaiting, &scrPersistent);
sprintf(str, "Running scripts: %d (r:%d w:%d p:%d)", scrTotal, scrRunning, scrWaiting, scrPersistent);
_systemFont->drawText((byte *)str, 0, 70, _renderer->_width, TAL_RIGHT);
diff --git a/engines/wintermute/Base/BScriptHolder.cpp b/engines/wintermute/Base/BScriptHolder.cpp
index f44cfde02c..f07e2575dd 100644
--- a/engines/wintermute/Base/BScriptHolder.cpp
+++ b/engines/wintermute/Base/BScriptHolder.cpp
@@ -94,7 +94,7 @@ HRESULT CBScriptHolder::applyEvent(const char *eventName, bool unbreakable) {
}
}
}
- if (numHandlers > 0 && unbreakable) Game->_scEngine->TickUnbreakable();
+ if (numHandlers > 0 && unbreakable) Game->_scEngine->tickUnbreakable();
return ret;
}
@@ -286,7 +286,7 @@ HRESULT CBScriptHolder::addScript(const char *filename) {
}
}
- CScScript *scr = Game->_scEngine->RunScript(filename, this);
+ CScScript *scr = Game->_scEngine->runScript(filename, this);
if (!scr) {
if (Game->_editorForceScripts) {
// editor hack
diff --git a/engines/wintermute/Base/scriptables/ScEngine.cpp b/engines/wintermute/Base/scriptables/ScEngine.cpp
index 51098f0ef2..8cae017381 100644
--- a/engines/wintermute/Base/scriptables/ScEngine.cpp
+++ b/engines/wintermute/Base/scriptables/ScEngine.cpp
@@ -141,9 +141,9 @@ CScEngine::CScEngine(CBGame *inGame): CBBase(inGame) {
//////////////////////////////////////////////////////////////////////////
CScEngine::~CScEngine() {
Game->LOG(0, "Shutting down scripting engine");
- SaveBreakpoints();
+ saveBreakpoints();
- DisableProfiling();
+ disableProfiling();
#ifdef __WIN32__
if (_compilerAvailable && _compilerDLL) ::FreeLibrary(_compilerDLL);
#endif
@@ -171,7 +171,7 @@ HRESULT CScEngine::cleanup() {
delete _globals;
_globals = NULL;
- EmptyScriptCache();
+ emptyScriptCache();
_currentScript = NULL; // ref only
@@ -189,55 +189,55 @@ HRESULT CScEngine::cleanup() {
//////////////////////////////////////////////////////////////////////////
-byte *WINAPI CScEngine::loadFile(void *data, char *filename, uint32 *size) {
+byte *CScEngine::loadFile(void *data, char *filename, uint32 *size) {
CBGame *Game = (CBGame *)data;
return Game->_fileManager->readWholeFile(filename, size);
}
//////////////////////////////////////////////////////////////////////////
-void WINAPI CScEngine::CloseFile(void *Data, byte *Buffer) {
- delete [] Buffer;
+void CScEngine::closeFile(void *data, byte *buffer) {
+ delete [] buffer;
}
//////////////////////////////////////////////////////////////////////////
-void WINAPI CScEngine::AddError(void *Data, int Line, char *Text) {
- CBGame *Game = (CBGame *)Data;
+void CScEngine::addError(void *data, int line, char *text) {
+ CBGame *Game = (CBGame *)data;
if (Game) {
if (Game->_scEngine && Game->_scEngine->_fileToCompile)
Game->LOG(0, "Compiling script '%s'...", Game->_scEngine->_fileToCompile);
- Game->LOG(0, " Error@line %d: %s", Line, Text);
+ Game->LOG(0, " Error@line %d: %s", line, text);
// redirect to an engine's own callback
if (Game->_scEngine && Game->_scEngine->_compileErrorCallback) {
- Game->_scEngine->_compileErrorCallback(Line, Text, Game->_scEngine->_compileErrorCallbackData);
+ Game->_scEngine->_compileErrorCallback(line, text, Game->_scEngine->_compileErrorCallbackData);
}
}
}
//////////////////////////////////////////////////////////////////////////
-void WINAPI CScEngine::ParseElement(void *Data, int Line, int Type, void *ElementData) {
- CBGame *Game = (CBGame *)Data;
+void WINAPI CScEngine::parseElement(void *data, int line, int type, void *elementData) {
+ CBGame *Game = (CBGame *)data;
if (Game) {
// redirect to an engine's own callback
if (Game->_scEngine && Game->_scEngine->_parseElementCallback) {
- Game->_scEngine->_parseElementCallback(Line, Type, ElementData, Game->_scEngine->_compileErrorCallbackData);
+ Game->_scEngine->_parseElementCallback(line, type, elementData, Game->_scEngine->_compileErrorCallbackData);
}
}
}
//////////////////////////////////////////////////////////////////////////
-CScScript *CScEngine::RunScript(const char *filename, CBScriptHolder *owner) {
+CScScript *CScEngine::runScript(const char *filename, CBScriptHolder *owner) {
byte *compBuffer;
uint32 compSize;
// get script from cache
- compBuffer = GetCompiledScript(filename, &compSize);
+ compBuffer = getCompiledScript(filename, &compSize);
if (!compBuffer) return NULL;
// add new script
@@ -265,52 +265,50 @@ CScScript *CScEngine::RunScript(const char *filename, CBScriptHolder *owner) {
//////////////////////////////////////////////////////////////////////////
-byte *CScEngine::GetCompiledScript(const char *filename, uint32 *OutSize, bool IgnoreCache) {
- int i;
-
+byte *CScEngine::getCompiledScript(const char *filename, uint32 *outSize, bool ignoreCache) {
// is script in cache?
- if (!IgnoreCache) {
- for (i = 0; i < MAX_CACHED_SCRIPTS; i++) {
+ if (!ignoreCache) {
+ for (int i = 0; i < MAX_CACHED_SCRIPTS; i++) {
if (_cachedScripts[i] && scumm_stricmp(_cachedScripts[i]->_filename.c_str(), filename) == 0) {
_cachedScripts[i]->_timestamp = CBPlatform::GetTime();
- *OutSize = _cachedScripts[i]->_size;
+ *outSize = _cachedScripts[i]->_size;
return _cachedScripts[i]->_buffer;
}
}
}
// nope, load it
- byte *CompBuffer;
- uint32 CompSize;
- bool CompiledNow = false;
+ byte *compBuffer;
+ uint32 compSize;
+ bool compiledNow = false;
- uint32 Size;
+ uint32 size;
- byte *Buffer = Game->_fileManager->readWholeFile(filename, &Size);
- if (!Buffer) {
+ byte *buffer = Game->_fileManager->readWholeFile(filename, &size);
+ if (!buffer) {
Game->LOG(0, "CScEngine::GetCompiledScript - error opening script '%s'", filename);
return NULL;
}
// needs to be compiled?
- if (FROM_LE_32(*(uint32 *)Buffer) == SCRIPT_MAGIC) {
- CompBuffer = Buffer;
- CompSize = Size;
+ if (FROM_LE_32(*(uint32 *)buffer) == SCRIPT_MAGIC) {
+ compBuffer = buffer;
+ compSize = size;
} else {
if (!_compilerAvailable) {
Game->LOG(0, "CScEngine::GetCompiledScript - script '%s' needs to be compiled but compiler is not available", filename);
- delete [] Buffer;
+ delete [] buffer;
return NULL;
}
- CompiledNow = true;
+ compiledNow = true;
// publish external methods to the compiler
CALLBACKS c;
- c.Dll_AddError = AddError;
- c.Dll_CloseFile = CloseFile;
+ c.Dll_AddError = addError;
+ c.Dll_CloseFile = closeFile;
c.Dll_LoadFile = loadFile;
- c.Dll_ParseElement = ParseElement;
+ c.Dll_ParseElement = parseElement;
ExtSetCallbacks(&c, Game);
// publish native interfaces
@@ -320,12 +318,12 @@ byte *CScEngine::GetCompiledScript(const char *filename, uint32 *OutSize, bool I
char *tempFileName = new char[strlen(filename) + 1];
memcpy(tempFileName, filename, strlen(filename) + 1);
- SetFileToCompile(filename);
- CompBuffer = ExtCompileFile(tempFileName, &CompSize);
+ setFileToCompile(filename);
+ compBuffer = ExtCompileFile(tempFileName, &compSize);
delete[] tempFileName;
- if (!CompBuffer) {
+ if (!compBuffer) {
Game->quickMessage("Script compiler error. View log for details.");
- delete [] Buffer;
+ delete [] buffer;
return NULL;
}
}
@@ -333,11 +331,11 @@ byte *CScEngine::GetCompiledScript(const char *filename, uint32 *OutSize, bool I
byte *ret = NULL;
// add script to cache
- CScCachedScript *CachedScript = new CScCachedScript(filename, CompBuffer, CompSize);
- if (CachedScript) {
+ CScCachedScript *cachedScript = new CScCachedScript(filename, compBuffer, compSize);
+ if (cachedScript) {
int index = 0;
uint32 MinTime = CBPlatform::GetTime();
- for (i = 0; i < MAX_CACHED_SCRIPTS; i++) {
+ for (int i = 0; i < MAX_CACHED_SCRIPTS; i++) {
if (_cachedScripts[i] == NULL) {
index = i;
break;
@@ -348,16 +346,16 @@ byte *CScEngine::GetCompiledScript(const char *filename, uint32 *OutSize, bool I
}
if (_cachedScripts[index] != NULL) delete _cachedScripts[index];
- _cachedScripts[index] = CachedScript;
+ _cachedScripts[index] = cachedScript;
- ret = CachedScript->_buffer;
- *OutSize = CachedScript->_size;
+ ret = cachedScript->_buffer;
+ *outSize = cachedScript->_size;
}
// cleanup
- delete [] Buffer;
- if (CompiledNow) ExtReleaseBuffer(CompBuffer);
+ delete [] buffer;
+ if (compiledNow) ExtReleaseBuffer(compBuffer);
return ret;
}
@@ -365,14 +363,14 @@ byte *CScEngine::GetCompiledScript(const char *filename, uint32 *OutSize, bool I
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::Tick() {
- int i;
+HRESULT CScEngine::tick() {
+
if (_scripts.GetSize() == 0) return S_OK;
// resolve waiting scripts
- for (i = 0; i < _scripts.GetSize(); i++) {
+ for (int i = 0; i < _scripts.GetSize(); i++) {
switch (_scripts[i]->_state) {
case SCRIPT_WAITING: {
@@ -405,7 +403,7 @@ HRESULT CScEngine::Tick() {
}
case SCRIPT_WAITING_SCRIPT: {
- if (!IsValidScript(_scripts[i]->_waitScript) || _scripts[i]->_waitScript->_state == SCRIPT_ERROR) {
+ if (!isValidScript(_scripts[i]->_waitScript) || _scripts[i]->_waitScript->_state == SCRIPT_ERROR) {
// fake return value
_scripts[i]->_stack->pushNULL();
_scripts[i]->_waitScript = NULL;
@@ -429,7 +427,7 @@ HRESULT CScEngine::Tick() {
// execute scripts
- for (i = 0; i < _scripts.GetSize(); i++) {
+ for (int i = 0; i < _scripts.GetSize(); i++) {
// skip paused scripts
if (_scripts[i]->_state == SCRIPT_PAUSED) continue;
@@ -441,7 +439,7 @@ HRESULT CScEngine::Tick() {
_currentScript = _scripts[i];
_scripts[i]->ExecuteInstruction();
}
- if (_isProfiling && _scripts[i]->_filename) AddScriptTime(_scripts[i]->_filename, CBPlatform::GetTime() - StartTime);
+ if (_isProfiling && _scripts[i]->_filename) addScriptTime(_scripts[i]->_filename, CBPlatform::GetTime() - StartTime);
}
// normal script
@@ -454,19 +452,19 @@ HRESULT CScEngine::Tick() {
_currentScript = _scripts[i];
_scripts[i]->ExecuteInstruction();
}
- if (isProfiling && _scripts[i]->_filename) AddScriptTime(_scripts[i]->_filename, CBPlatform::GetTime() - StartTime);
+ if (isProfiling && _scripts[i]->_filename) addScriptTime(_scripts[i]->_filename, CBPlatform::GetTime() - StartTime);
}
_currentScript = NULL;
}
- RemoveFinishedScripts();
+ removeFinishedScripts();
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::TickUnbreakable() {
+HRESULT CScEngine::tickUnbreakable() {
// execute unbreakable scripts
for (int i = 0; i < _scripts.GetSize(); i++) {
if (!_scripts[i]->_unbreakable) continue;
@@ -478,14 +476,14 @@ HRESULT CScEngine::TickUnbreakable() {
_scripts[i]->finish();
_currentScript = NULL;
}
- RemoveFinishedScripts();
+ removeFinishedScripts();
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::RemoveFinishedScripts() {
+HRESULT CScEngine::removeFinishedScripts() {
// remove finished scripts
for (int i = 0; i < _scripts.GetSize(); i++) {
if (_scripts[i]->_state == SCRIPT_FINISHED || _scripts[i]->_state == SCRIPT_ERROR) {
@@ -501,8 +499,8 @@ HRESULT CScEngine::RemoveFinishedScripts() {
//////////////////////////////////////////////////////////////////////////
-int CScEngine::GetNumScripts(int *Running, int *Waiting, int *Persistent) {
- int running = 0, waiting = 0, persistent = 0, total = 0;
+int CScEngine::getNumScripts(int *running, int *waiting, int *persistent) {
+ int numRunning = 0, numWaiting = 0, numPersistent = 0, numTotal = 0;
for (int i = 0; i < _scripts.GetSize(); i++) {
if (_scripts[i]->_state == SCRIPT_FINISHED) continue;
@@ -510,30 +508,30 @@ int CScEngine::GetNumScripts(int *Running, int *Waiting, int *Persistent) {
case SCRIPT_RUNNING:
case SCRIPT_SLEEPING:
case SCRIPT_PAUSED:
- running++;
+ numRunning++;
break;
case SCRIPT_WAITING:
- waiting++;
+ numWaiting++;
break;
case SCRIPT_PERSISTENT:
- persistent++;
+ numPersistent++;
break;
default:
warning("CScEngine::GetNumScripts - unhandled enum");
break;
}
- total++;
+ numTotal++;
}
- if (Running) *Running = running;
- if (Waiting) *Waiting = waiting;
- if (Persistent) *Persistent = persistent;
+ if (running) *running = numRunning;
+ if (waiting) *waiting = numWaiting;
+ if (persistent) *persistent = numPersistent;
- return total;
+ return numTotal;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::EmptyScriptCache() {
+HRESULT CScEngine::emptyScriptCache() {
for (int i = 0; i < MAX_CACHED_SCRIPTS; i++) {
if (_cachedScripts[i]) {
delete _cachedScripts[i];
@@ -545,11 +543,11 @@ HRESULT CScEngine::EmptyScriptCache() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::ResetObject(CBObject *Object) {
+HRESULT CScEngine::resetObject(CBObject *Object) {
// terminate all scripts waiting for this object
for (int i = 0; i < _scripts.GetSize(); i++) {
if (_scripts[i]->_state == SCRIPT_WAITING && _scripts[i]->_waitObject == Object) {
- if (!Game->_compatKillMethodThreads) ResetScript(_scripts[i]);
+ if (!Game->_compatKillMethodThreads) resetScript(_scripts[i]);
bool IsThread = _scripts[i]->_methodThread || _scripts[i]->_thread;
_scripts[i]->finish(!IsThread); // 1.9b1 - top-level script kills its threads as well
@@ -559,7 +557,7 @@ HRESULT CScEngine::ResetObject(CBObject *Object) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::ResetScript(CScScript *script) {
+HRESULT CScEngine::resetScript(CScScript *script) {
// terminate all scripts waiting for this script
for (int i = 0; i < _scripts.GetSize(); i++) {
if (_scripts[i]->_state == SCRIPT_WAITING_SCRIPT && _scripts[i]->_waitScript == script) {
@@ -596,7 +594,7 @@ void CScEngine::editorCleanup() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::PauseAll() {
+HRESULT CScEngine::pauseAll() {
for (int i = 0; i < _scripts.GetSize(); i++) {
if (_scripts[i] != _currentScript) _scripts[i]->Pause();
}
@@ -606,7 +604,7 @@ HRESULT CScEngine::PauseAll() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::ResumeAll() {
+HRESULT CScEngine::resumeAll() {
for (int i = 0; i < _scripts.GetSize(); i++)
_scripts[i]->Resume();
@@ -615,7 +613,7 @@ HRESULT CScEngine::ResumeAll() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::SetFileToCompile(const char *filename) {
+HRESULT CScEngine::setFileToCompile(const char *filename) {
delete[] _fileToCompile;
_fileToCompile = new char[strlen(filename) + 1];
if (_fileToCompile) {
@@ -626,20 +624,20 @@ HRESULT CScEngine::SetFileToCompile(const char *filename) {
//////////////////////////////////////////////////////////////////////////
-void CScEngine::SetCompileErrorCallback(COMPILE_ERROR_CALLBACK Callback, void *Data) {
- _compileErrorCallback = Callback;
- _compileErrorCallbackData = Data;
+void CScEngine::setCompileErrorCallback(COMPILE_ERROR_CALLBACK callback, void *data) {
+ _compileErrorCallback = callback;
+ _compileErrorCallbackData = data;
}
//////////////////////////////////////////////////////////////////////////
-void CScEngine::SetParseElementCallback(PARSE_ELEMENT_CALLBACK Callback, void *Data) {
- _parseElementCallback = Callback;
- _parseElementCallbackData = Data;
+void CScEngine::setParseElementCallback(PARSE_ELEMENT_CALLBACK callback, void *data) {
+ _parseElementCallback = callback;
+ _parseElementCallbackData = data;
}
//////////////////////////////////////////////////////////////////////////
-bool CScEngine::IsValidScript(CScScript *script) {
+bool CScEngine::isValidScript(CScScript *script) {
for (int i = 0; i < _scripts.GetSize(); i++) {
if (_scripts[i] == script) return true;
}
@@ -647,73 +645,73 @@ bool CScEngine::IsValidScript(CScScript *script) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::ClearGlobals(bool IncludingNatives) {
- _globals->CleanProps(IncludingNatives);
+HRESULT CScEngine::clearGlobals(bool includingNatives) {
+ _globals->CleanProps(includingNatives);
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::DbgSendScripts(IWmeDebugClient *Client) {
+HRESULT CScEngine::dbgSendScripts(IWmeDebugClient *client) {
// send global variables
- _globals->DbgSendVariables(Client, WME_DBGVAR_GLOBAL, NULL, 0);
+ _globals->DbgSendVariables(client, WME_DBGVAR_GLOBAL, NULL, 0);
// 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;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::addBreakpoint(const char *ScriptFilename, int Line) {
+HRESULT CScEngine::addBreakpoint(const char *scriptFilename, int line) {
if (!Game->getDebugMgr()->_enabled) return S_OK;
- CScBreakpoint *Bp = NULL;
+ CScBreakpoint *bp = NULL;
for (int i = 0; i < _breakpoints.GetSize(); i++) {
- if (scumm_stricmp(_breakpoints[i]->_filename.c_str(), ScriptFilename) == 0) {
- Bp = _breakpoints[i];
+ if (scumm_stricmp(_breakpoints[i]->_filename.c_str(), scriptFilename) == 0) {
+ bp = _breakpoints[i];
break;
}
}
- if (Bp == NULL) {
- Bp = new CScBreakpoint(ScriptFilename);
- _breakpoints.Add(Bp);
+ if (bp == NULL) {
+ bp = new CScBreakpoint(scriptFilename);
+ _breakpoints.Add(bp);
}
- for (int i = 0; i < Bp->_lines.GetSize(); i++) {
- if (Bp->_lines[i] == Line) return S_OK;
+ for (int i = 0; i < bp->_lines.GetSize(); i++) {
+ if (bp->_lines[i] == line) return S_OK;
}
- Bp->_lines.Add(Line);
+ bp->_lines.Add(line);
// refresh changes
- RefreshScriptBreakpoints();
+ refreshScriptBreakpoints();
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::removeBreakpoint(const char *ScriptFilename, int Line) {
+HRESULT CScEngine::removeBreakpoint(const char *scriptFilename, int line) {
if (!Game->getDebugMgr()->_enabled) return S_OK;
for (int i = 0; i < _breakpoints.GetSize(); i++) {
- if (scumm_stricmp(_breakpoints[i]->_filename.c_str(), ScriptFilename) == 0) {
+ if (scumm_stricmp(_breakpoints[i]->_filename.c_str(), scriptFilename) == 0) {
for (int j = 0; j < _breakpoints[i]->_lines.GetSize(); j++) {
- if (_breakpoints[i]->_lines[j] == Line) {
+ if (_breakpoints[i]->_lines[j] == line) {
_breakpoints[i]->_lines.RemoveAt(j);
if (_breakpoints[i]->_lines.GetSize() == 0) {
delete _breakpoints[i];
_breakpoints.RemoveAt(i);
}
// refresh changes
- RefreshScriptBreakpoints();
+ refreshScriptBreakpoints();
return S_OK;
}
@@ -725,17 +723,17 @@ HRESULT CScEngine::removeBreakpoint(const char *ScriptFilename, int Line) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::RefreshScriptBreakpoints() {
+HRESULT CScEngine::refreshScriptBreakpoints() {
if (!Game->getDebugMgr()->_enabled) return S_OK;
for (int i = 0; i < _scripts.GetSize(); i++) {
- RefreshScriptBreakpoints(_scripts[i]);
+ refreshScriptBreakpoints(_scripts[i]);
}
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::RefreshScriptBreakpoints(CScScript *script) {
+HRESULT CScEngine::refreshScriptBreakpoints(CScScript *script) {
if (!Game->getDebugMgr()->_enabled) return S_OK;
if (!script || !script->_filename) return E_FAIL;
@@ -752,48 +750,48 @@ HRESULT CScEngine::RefreshScriptBreakpoints(CScScript *script) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::SaveBreakpoints() {
+HRESULT CScEngine::saveBreakpoints() {
if (!Game->getDebugMgr()->_enabled) return S_OK;
- char Text[512];
- char Key[100];
+ char text[512];
+ char key[100];
- int Count = 0;
+ int count = 0;
for (int i = 0; i < _breakpoints.GetSize(); i++) {
for (int j = 0; j < _breakpoints[i]->_lines.GetSize(); j++) {
- Count++;
- sprintf(Key, "Breakpoint%d", Count);
- sprintf(Text, "%s:%d", _breakpoints[i]->_filename.c_str(), _breakpoints[i]->_lines[j]);
+ count++;
+ sprintf(key, "Breakpoint%d", count);
+ sprintf(text, "%s:%d", _breakpoints[i]->_filename.c_str(), _breakpoints[i]->_lines[j]);
- Game->_registry->writeString("Debug", Key, Text);
+ Game->_registry->writeString("Debug", key, text);
}
}
- Game->_registry->writeInt("Debug", "NumBreakpoints", Count);
+ Game->_registry->writeInt("Debug", "NumBreakpoints", count);
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::LoadBreakpoints() {
+HRESULT CScEngine::loadBreakpoints() {
if (!Game->getDebugMgr()->_enabled) return S_OK;
- char Key[100];
+ char key[100];
- int Count = Game->_registry->readInt("Debug", "NumBreakpoints", 0);
- for (int i = 1; i <= Count; i++) {
+ int count = Game->_registry->readInt("Debug", "NumBreakpoints", 0);
+ for (int i = 1; i <= count; i++) {
/* uint32 BufSize = 512; */
- sprintf(Key, "Breakpoint%d", i);
- AnsiString breakpoint = Game->_registry->readString("Debug", Key, "");
+ sprintf(key, "Breakpoint%d", i);
+ AnsiString breakpoint = Game->_registry->readString("Debug", key, "");
- char *Path = CBUtils::strEntry(0, breakpoint.c_str(), ':');
- char *Line = CBUtils::strEntry(1, breakpoint.c_str(), ':');
+ char *path = CBUtils::strEntry(0, breakpoint.c_str(), ':');
+ char *line = CBUtils::strEntry(1, breakpoint.c_str(), ':');
- if (Path != NULL && Line != NULL) addBreakpoint(Path, atoi(Line));
- delete[] Path;
- delete[] Line;
- Path = NULL;
- Line = NULL;
+ if (path != NULL && line != NULL) addBreakpoint(path, atoi(line));
+ delete[] path;
+ delete[] line;
+ path = NULL;
+ line = NULL;
}
return S_OK;
@@ -801,17 +799,17 @@ HRESULT CScEngine::LoadBreakpoints() {
//////////////////////////////////////////////////////////////////////////
-void CScEngine::AddScriptTime(const char *filename, uint32 Time) {
+void CScEngine::addScriptTime(const char *filename, uint32 time) {
if (!_isProfiling) return;
AnsiString fileName = filename;
StringUtil::toLowerCase(fileName);
- _scriptTimes[fileName] += Time;
+ _scriptTimes[fileName] += time;
}
//////////////////////////////////////////////////////////////////////////
-void CScEngine::EnableProfiling() {
+void CScEngine::enableProfiling() {
if (_isProfiling) return;
// destroy old data, if any
@@ -823,16 +821,16 @@ void CScEngine::EnableProfiling() {
//////////////////////////////////////////////////////////////////////////
-void CScEngine::DisableProfiling() {
+void CScEngine::disableProfiling() {
if (!_isProfiling) return;
- DumpStats();
+ dumpStats();
_isProfiling = false;
}
//////////////////////////////////////////////////////////////////////////
-void CScEngine::DumpStats() {
+void CScEngine::dumpStats() {
error("DumpStats not ported to ScummVM yet");
/* uint32 totalTime = CBPlatform::GetTime() - _profilingStartTime;
diff --git a/engines/wintermute/Base/scriptables/ScEngine.h b/engines/wintermute/Base/scriptables/ScEngine.h
index 91644052bb..d49e474ea8 100644
--- a/engines/wintermute/Base/scriptables/ScEngine.h
+++ b/engines/wintermute/Base/scriptables/ScEngine.h
@@ -38,15 +38,15 @@
namespace WinterMute {
-typedef byte *(*DLL_COMPILE_BUFFER)(byte *Buffer, char *Source, uint32 BufferSize, uint32 *CompiledSize);
-typedef byte *(*DLL_COMPILE_FILE)(char *Filename, uint32 *CompiledSize);
-typedef void (*DLL_RELEASE_BUFFER)(unsigned char *Buffer);
+typedef byte *(*DLL_COMPILE_BUFFER)(byte *buffer, char *source, uint32 bufferSize, uint32 *compiledSize);
+typedef byte *(*DLL_COMPILE_FILE)(char *filename, uint32 *compiledSize);
+typedef void (*DLL_RELEASE_BUFFER)(unsigned char *buffer);
typedef void (*DLL_SET_CALLBACKS)(CALLBACKS *callbacks, void *Data);
typedef int (*DLL_DEFINE_FUNCTION)(const char *name); /* Was non-const, changed to silence warnings */
typedef int (*DLL_DEFINE_VARIABLE)(const char *name); /* Was non-const, changed to silence warnings */
-typedef void (*COMPILE_ERROR_CALLBACK)(int Line, char *Text , void *Data);
-typedef void (*PARSE_ELEMENT_CALLBACK)(int Line, int Type, void *ElementData, void *Data);
+typedef void (*COMPILE_ERROR_CALLBACK)(int line, char *text , void *data);
+typedef void (*PARSE_ELEMENT_CALLBACK)(int line, int type, void *elementData, void *data);
#define MAX_CACHED_SCRIPTS 20
class CScScript;
@@ -57,11 +57,11 @@ class CScEngine : public CBBase {
public:
class CScCachedScript {
public:
- CScCachedScript(const char *filename, byte *Buffer, uint32 Size) {
+ CScCachedScript(const char *filename, byte *buffer, uint32 size) {
_timestamp = CBPlatform::GetTime();
- _buffer = new byte[Size];
- if (_buffer) memcpy(_buffer, Buffer, Size);
- _size = Size;
+ _buffer = new byte[size];
+ if (_buffer) memcpy(_buffer, buffer, size);
+ _size = size;
_filename = filename;
};
@@ -93,22 +93,22 @@ public:
public:
- HRESULT DbgSendScripts(IWmeDebugClient *Client);
+ HRESULT dbgSendScripts(IWmeDebugClient *client);
CBArray<CScBreakpoint *, CScBreakpoint *> _breakpoints;
- HRESULT addBreakpoint(const char *ScriptFilename, int Line);
- HRESULT removeBreakpoint(const char *ScriptFilename, int Line);
- HRESULT RefreshScriptBreakpoints();
- HRESULT RefreshScriptBreakpoints(CScScript *script);
- HRESULT SaveBreakpoints();
- HRESULT LoadBreakpoints();
-
- HRESULT ClearGlobals(bool IncludingNatives = false);
- HRESULT TickUnbreakable();
- HRESULT RemoveFinishedScripts();
- bool IsValidScript(CScScript *script);
- void SetCompileErrorCallback(COMPILE_ERROR_CALLBACK Callback, void *Data);
- void SetParseElementCallback(PARSE_ELEMENT_CALLBACK Callback, void *Data);
+ HRESULT addBreakpoint(const char *scriptFilename, int line);
+ HRESULT removeBreakpoint(const char *scriptFilename, int line);
+ HRESULT refreshScriptBreakpoints();
+ HRESULT refreshScriptBreakpoints(CScScript *script);
+ HRESULT saveBreakpoints();
+ HRESULT loadBreakpoints();
+
+ HRESULT clearGlobals(bool includingNatives = false);
+ HRESULT tickUnbreakable();
+ HRESULT removeFinishedScripts();
+ bool isValidScript(CScScript *script);
+ void setCompileErrorCallback(COMPILE_ERROR_CALLBACK callback, void *data);
+ void setParseElementCallback(PARSE_ELEMENT_CALLBACK callback, void *data);
COMPILE_ERROR_CALLBACK _compileErrorCallback;
void *_compileErrorCallbackData;
@@ -116,30 +116,30 @@ public:
PARSE_ELEMENT_CALLBACK _parseElementCallback;
void *_parseElementCallbackData;
- HRESULT SetFileToCompile(const char *filename);
+ HRESULT setFileToCompile(const char *filename);
char *_fileToCompile;
CScScript *_currentScript;
- HRESULT ResumeAll();
- HRESULT PauseAll();
+ HRESULT resumeAll();
+ HRESULT pauseAll();
void editorCleanup();
- HRESULT ResetObject(CBObject *Object);
- HRESULT ResetScript(CScScript *script);
- HRESULT EmptyScriptCache();
- byte *GetCompiledScript(const char *filename, uint32 *OutSize, bool IgnoreCache = false);
+ HRESULT resetObject(CBObject *Object);
+ HRESULT resetScript(CScScript *script);
+ HRESULT emptyScriptCache();
+ byte *getCompiledScript(const char *filename, uint32 *outSize, bool ignoreCache = false);
DECLARE_PERSISTENT(CScEngine, CBBase)
HRESULT cleanup();
- int GetNumScripts(int *Running = NULL, int *Waiting = NULL, int *Persistent = NULL);
- HRESULT Tick();
+ int getNumScripts(int *running = NULL, int *waiting = NULL, int *persistent = NULL);
+ HRESULT tick();
CScValue *_globals;
- CScScript *RunScript(const char *filename, CBScriptHolder *Owner = NULL);
+ CScScript *runScript(const char *filename, CBScriptHolder *owner = NULL);
bool _compilerAvailable;
HINSTANCE _compilerDLL;
CScEngine(CBGame *inGame);
virtual ~CScEngine();
- static void WINAPI AddError(void *Data, int Line, char *Text);
- static byte *WINAPI loadFile(void *Data, char *Filename, uint32 *Size);
- static void WINAPI CloseFile(void *Data, byte *Buffer);
- static void WINAPI ParseElement(void *Data, int Line, int Type, void *ElementData);
+ static void addError(void *data, int line, char *text);
+ static byte *loadFile(void *data, char *filename, uint32 *size);
+ static void closeFile(void *data, byte *buffer);
+ static void parseElement(void *data, int line, int type, void *elementData);
DLL_COMPILE_BUFFER ExtCompileBuffer;
DLL_COMPILE_FILE ExtCompileFile;
DLL_RELEASE_BUFFER ExtReleaseBuffer;
@@ -149,14 +149,14 @@ public:
CBArray<CScScript *, CScScript *> _scripts;
- void EnableProfiling();
- void DisableProfiling();
- bool IsProfiling() {
+ void enableProfiling();
+ void disableProfiling();
+ bool isProfiling() {
return _isProfiling;
}
- void AddScriptTime(const char *filename, uint32 Time);
- void DumpStats();
+ void addScriptTime(const char *filename, uint32 Time);
+ void dumpStats();
private:
diff --git a/engines/wintermute/Base/scriptables/ScScript.cpp b/engines/wintermute/Base/scriptables/ScScript.cpp
index 397ebe4c24..58b590744a 100644
--- a/engines/wintermute/Base/scriptables/ScScript.cpp
+++ b/engines/wintermute/Base/scriptables/ScScript.cpp
@@ -154,7 +154,7 @@ HRESULT CScScript::InitScript() {
_currentLine = 0;
// init breakpoints
- _engine->RefreshScriptBreakpoints(this);
+ _engine->refreshScriptBreakpoints(this);
// ready to rumble...
@@ -1124,7 +1124,7 @@ HRESULT CScScript::WaitFor(CBObject *Object) {
//////////////////////////////////////////////////////////////////////////
HRESULT CScScript::WaitForExclusive(CBObject *Object) {
- _engine->ResetObject(Object);
+ _engine->resetObject(Object);
return WaitFor(Object);
}
@@ -1619,7 +1619,7 @@ bool CScScript::dbgGetTracingMode() {
//////////////////////////////////////////////////////////////////////////
void CScScript::afterLoad() {
if (_buffer == NULL) {
- byte *buffer = _engine->GetCompiledScript(_filename, &_bufferSize);
+ byte *buffer = _engine->getCompiledScript(_filename, &_bufferSize);
if (!buffer) {
Game->LOG(0, "Error reinitializing script '%s' after load. Script will be terminated.", _filename);
_state = SCRIPT_ERROR;
diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp
index 65e997f0bb..4d56b3c69e 100644
--- a/engines/wintermute/wintermute.cpp
+++ b/engines/wintermute/wintermute.cpp
@@ -201,7 +201,7 @@ int WinterMuteEngine::init() {
_game->initialize2();
_game->getDebugMgr()->onGameInit();
- _game->_scEngine->LoadBreakpoints();
+ _game->_scEngine->loadBreakpoints();