aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/Base/scriptables
diff options
context:
space:
mode:
Diffstat (limited to 'engines/wintermute/Base/scriptables')
-rw-r--r--engines/wintermute/Base/scriptables/SXArray.cpp22
-rw-r--r--engines/wintermute/Base/scriptables/SXArray.h6
-rw-r--r--engines/wintermute/Base/scriptables/SXDate.cpp42
-rw-r--r--engines/wintermute/Base/scriptables/SXDate.h4
-rw-r--r--engines/wintermute/Base/scriptables/SXFile.cpp96
-rw-r--r--engines/wintermute/Base/scriptables/SXFile.h4
-rw-r--r--engines/wintermute/Base/scriptables/SXMath.cpp55
-rw-r--r--engines/wintermute/Base/scriptables/SXMath.h2
-rw-r--r--engines/wintermute/Base/scriptables/SXMemBuffer.cpp56
-rw-r--r--engines/wintermute/Base/scriptables/SXMemBuffer.h6
-rw-r--r--engines/wintermute/Base/scriptables/SXStore.cpp30
-rw-r--r--engines/wintermute/Base/scriptables/SXStore.h6
-rw-r--r--engines/wintermute/Base/scriptables/SXString.cpp30
-rw-r--r--engines/wintermute/Base/scriptables/SXString.h4
-rw-r--r--engines/wintermute/Base/scriptables/ScEngine.cpp98
-rw-r--r--engines/wintermute/Base/scriptables/ScEngine.h36
-rw-r--r--engines/wintermute/Base/scriptables/ScScript.cpp124
-rw-r--r--engines/wintermute/Base/scriptables/ScScript.h36
-rw-r--r--engines/wintermute/Base/scriptables/ScStack.cpp4
-rw-r--r--engines/wintermute/Base/scriptables/ScValue.cpp34
-rw-r--r--engines/wintermute/Base/scriptables/ScValue.h8
-rw-r--r--engines/wintermute/Base/scriptables/SxObject.cpp4
22 files changed, 354 insertions, 353 deletions
diff --git a/engines/wintermute/Base/scriptables/SXArray.cpp b/engines/wintermute/Base/scriptables/SXArray.cpp
index 67466a2489..204a1170e2 100644
--- a/engines/wintermute/Base/scriptables/SXArray.cpp
+++ b/engines/wintermute/Base/scriptables/SXArray.cpp
@@ -93,7 +93,7 @@ const char *CSXArray::scToString() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CSXArray::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CSXArray::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// Push
//////////////////////////////////////////////////////////////////////////
@@ -108,7 +108,7 @@ HRESULT CSXArray::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
}
stack->pushInt(_length);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -126,10 +126,10 @@ HRESULT CSXArray::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
_length--;
} else stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
- else return E_FAIL;
+ else return STATUS_FAILED;
}
@@ -166,7 +166,7 @@ CScValue *CSXArray::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CSXArray::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CSXArray::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
// Length
//////////////////////////////////////////////////////////////////////////
@@ -181,7 +181,7 @@ HRESULT CSXArray::scSetProperty(const char *name, CScValue *value) {
_values->deleteProp(PropName);
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -193,19 +193,19 @@ HRESULT CSXArray::scSetProperty(const char *name, CScValue *value) {
int Index = atoi(paramName);
if (Index >= _length) _length = Index + 1;
return _values->setProp(paramName, value);
- } else return E_FAIL;
+ } else return STATUS_FAILED;
}
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CSXArray::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CSXArray::persist(CBPersistMgr *persistMgr) {
CBScriptable::persist(persistMgr);
persistMgr->transfer(TMEMBER(_length));
persistMgr->transfer(TMEMBER(_values));
- return S_OK;
+ return STATUS_OK;
}
@@ -227,12 +227,12 @@ bool CSXArray::validNumber(const char *origStr, char *outStr) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CSXArray::push(CScValue *val) {
+ERRORCODE CSXArray::push(CScValue *val) {
char paramName[20];
_length++;
sprintf(paramName, "%d", _length - 1);
_values->setProp(paramName, val, true);
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Base/scriptables/SXArray.h b/engines/wintermute/Base/scriptables/SXArray.h
index 81599892d9..040fbaf481 100644
--- a/engines/wintermute/Base/scriptables/SXArray.h
+++ b/engines/wintermute/Base/scriptables/SXArray.h
@@ -35,15 +35,15 @@ namespace WinterMute {
class CSXArray : public CBScriptable {
public:
- HRESULT push(CScValue *Val);
+ ERRORCODE push(CScValue *Val);
bool validNumber(const char *origStr, char *outStr);
DECLARE_PERSISTENT(CSXArray, CBScriptable)
CSXArray(CBGame *inGame, CScStack *stack);
CSXArray(CBGame *inGame);
virtual ~CSXArray();
CScValue *scGetProperty(const char *name);
- HRESULT scSetProperty(const char *name, CScValue *value);
- HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ ERRORCODE scSetProperty(const char *name, CScValue *value);
+ ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
const char *scToString();
int _length;
CScValue *_values;
diff --git a/engines/wintermute/Base/scriptables/SXDate.cpp b/engines/wintermute/Base/scriptables/SXDate.cpp
index e108c03a6e..a9ffaf5dd5 100644
--- a/engines/wintermute/Base/scriptables/SXDate.cpp
+++ b/engines/wintermute/Base/scriptables/SXDate.cpp
@@ -75,14 +75,14 @@ const char *CSXDate::scToString() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CSXDate::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CSXDate::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// GetYear
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "GetYear") == 0) {
stack->correctParams(0);
stack->pushInt(_tm.tm_year + 1900);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// GetMonth
@@ -90,7 +90,7 @@ HRESULT CSXDate::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
else if (strcmp(name, "GetMonth") == 0) {
stack->correctParams(0);
stack->pushInt(_tm.tm_mon + 1);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// GetDate
@@ -98,7 +98,7 @@ HRESULT CSXDate::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
else if (strcmp(name, "GetDate") == 0) {
stack->correctParams(0);
stack->pushInt(_tm.tm_mday);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// GetHours
@@ -106,7 +106,7 @@ HRESULT CSXDate::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
else if (strcmp(name, "GetHours") == 0) {
stack->correctParams(0);
stack->pushInt(_tm.tm_hour);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// GetMinutes
@@ -114,7 +114,7 @@ HRESULT CSXDate::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
else if (strcmp(name, "GetMinutes") == 0) {
stack->correctParams(0);
stack->pushInt(_tm.tm_min);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// GetSeconds
@@ -122,7 +122,7 @@ HRESULT CSXDate::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
else if (strcmp(name, "GetSeconds") == 0) {
stack->correctParams(0);
stack->pushInt(_tm.tm_sec);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// GetWeekday
@@ -131,7 +131,7 @@ HRESULT CSXDate::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
stack->correctParams(0);
warning("GetWeekday returns a wrong value on purpose");
stack->pushInt(_tm.tm_mday % 7);
- return S_OK;
+ return STATUS_OK;
}
@@ -142,7 +142,7 @@ HRESULT CSXDate::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
stack->correctParams(1);
_tm.tm_year = stack->pop()->getInt() - 1900;
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// SetMonth
@@ -151,7 +151,7 @@ HRESULT CSXDate::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
stack->correctParams(1);
_tm.tm_mon = stack->pop()->getInt() - 1;
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// SetDate
@@ -160,7 +160,7 @@ HRESULT CSXDate::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
stack->correctParams(1);
_tm.tm_mday = stack->pop()->getInt();
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// SetHours
@@ -169,7 +169,7 @@ HRESULT CSXDate::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
stack->correctParams(1);
_tm.tm_hour = stack->pop()->getInt();
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// SetMinutes
@@ -178,7 +178,7 @@ HRESULT CSXDate::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
stack->correctParams(1);
_tm.tm_min = stack->pop()->getInt();
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// SetSeconds
@@ -187,7 +187,7 @@ HRESULT CSXDate::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
stack->correctParams(1);
_tm.tm_sec = stack->pop()->getInt();
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
@@ -198,11 +198,11 @@ HRESULT CSXDate::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
stack->correctParams(0);
g_system->getTimeAndDate(_tm);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
else
- return E_FAIL;
+ return STATUS_FAILED;
}
@@ -223,22 +223,22 @@ CScValue *CSXDate::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CSXDate::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CSXDate::scSetProperty(const char *name, CScValue *value) {
/*
//////////////////////////////////////////////////////////////////////////
// Name
//////////////////////////////////////////////////////////////////////////
if(strcmp(name, "Name")==0){
setName(value->getString());
- return S_OK;
+ return STATUS_OK;
}
- else*/ return E_FAIL;
+ else*/ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CSXDate::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CSXDate::persist(CBPersistMgr *persistMgr) {
CBScriptable::persist(persistMgr);
persistMgr->transfer(TMEMBER(_tm.tm_year));
@@ -247,7 +247,7 @@ HRESULT CSXDate::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(_tm.tm_hour));
persistMgr->transfer(TMEMBER(_tm.tm_min));
persistMgr->transfer(TMEMBER(_tm.tm_sec));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/wintermute/Base/scriptables/SXDate.h b/engines/wintermute/Base/scriptables/SXDate.h
index 72e91e6136..324e711e82 100644
--- a/engines/wintermute/Base/scriptables/SXDate.h
+++ b/engines/wintermute/Base/scriptables/SXDate.h
@@ -41,8 +41,8 @@ public:
CSXDate(CBGame *inGame, CScStack *Stack);
virtual ~CSXDate();
CScValue *scGetProperty(const char *name);
- HRESULT scSetProperty(const char *name, CScValue *value);
- HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ ERRORCODE scSetProperty(const char *name, CScValue *value);
+ ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
const char *scToString();
char *_string;
TimeDate _tm;
diff --git a/engines/wintermute/Base/scriptables/SXFile.cpp b/engines/wintermute/Base/scriptables/SXFile.cpp
index 58768db80f..329c595b5d 100644
--- a/engines/wintermute/Base/scriptables/SXFile.cpp
+++ b/engines/wintermute/Base/scriptables/SXFile.cpp
@@ -105,7 +105,7 @@ const char *CSXFile::scToString() {
#define FILE_BUFFER_SIZE 32768
//////////////////////////////////////////////////////////////////////////
-HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// SetFilename
//////////////////////////////////////////////////////////////////////////
@@ -115,7 +115,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
cleanup();
CBUtils::setString(&_filename, filename);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -153,7 +153,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
if (_readFile || _writeFile) stack->pushBool(true);
else stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -163,7 +163,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
stack->correctParams(0);
close();
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -178,7 +178,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
int Pos = stack->pop()->getInt();
stack->pushBool(setPos(Pos));
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -188,7 +188,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
stack->correctParams(0);
close();
stack->pushBool(CBPlatform::deleteFile(_filename) != false);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -201,7 +201,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
close();
stack->pushBool(CBPlatform::copyFile(_filename, Dest, !Overwrite) != false);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -212,14 +212,14 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
if (!_textMode || !_readFile) {
script->runtimeError("File.%s: File must be open in text mode.", name);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
uint32 bufSize = FILE_BUFFER_SIZE;
byte *buf = (byte *)malloc(bufSize);
uint32 counter = 0;
byte b;
bool foundNewLine = false;
- HRESULT ret = E_FAIL;
+ ERRORCODE ret = STATUS_FAILED;
do {
ret = _readFile->read(&b, 1);
if (ret != 1) break;
@@ -237,7 +237,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
buf[counter] = b;
counter++;
}
- } while (SUCCEEDED(ret));
+ } while (DID_SUCCEED(ret));
if (counter > bufSize) {
buf = (byte *)realloc(buf, bufSize + FILE_BUFFER_SIZE);
@@ -250,7 +250,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
free(buf);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -263,14 +263,14 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
if (!_textMode || !_readFile) {
script->runtimeError("File.%s: File must be open in text mode.", name);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
uint32 bufSize = FILE_BUFFER_SIZE;
byte *buf = (byte *)malloc(bufSize);
uint32 counter = 0;
byte b;
- HRESULT ret = E_FAIL;
+ ERRORCODE ret = STATUS_FAILED;
while (counter < (uint32)textLen) {
ret = _readFile->read(&b, 1);
if (ret != 1) break;
@@ -297,7 +297,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
free(buf);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -309,7 +309,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
if (!_textMode || !_writeFile) {
script->runtimeError("File.%s: File must be open for writing in text mode.", name);
stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
if (strcmp(name, "WriteLine") == 0)
fprintf((FILE *)_writeFile, "%s\n", line);
@@ -318,7 +318,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -330,13 +330,13 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
if (_textMode || !_readFile) {
script->runtimeError("File.%s: File must be open for reading in binary mode.", name);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
bool val;
if (_readFile->read(&val, sizeof(bool)) == sizeof(bool)) stack->pushBool(val);
else stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -347,13 +347,13 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
if (_textMode || !_readFile) {
script->runtimeError("File.%s: File must be open for reading in binary mode.", name);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
byte val;
if (_readFile->read(&val, sizeof(byte)) == sizeof(byte)) stack->pushInt(val);
else stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -364,13 +364,13 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
if (_textMode || !_readFile) {
script->runtimeError("File.%s: File must be open for reading in binary mode.", name);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
short val;
if (_readFile->read(&val, sizeof(short)) == sizeof(short)) stack->pushInt(65536 + val);
else stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -381,13 +381,13 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
if (_textMode || !_readFile) {
script->runtimeError("File.%s: File must be open for reading in binary mode.", name);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
int val;
if (_readFile->read(&val, sizeof(int)) == sizeof(int)) stack->pushInt(val);
else stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -398,13 +398,13 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
if (_textMode || !_readFile) {
script->runtimeError("File.%s: File must be open for reading in binary mode.", name);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
float val;
if (_readFile->read(&val, sizeof(float)) == sizeof(float)) stack->pushFloat(val);
else stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -415,13 +415,13 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
if (_textMode || !_readFile) {
script->runtimeError("File.%s: File must be open for reading in binary mode.", name);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
double val;
if (_readFile->read(&val, sizeof(double)) == sizeof(double)) stack->pushFloat(val);
else stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -432,7 +432,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
if (_textMode || !_readFile) {
script->runtimeError("File.%s: File must be open for reading in binary mode.", name);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
uint32 size;
if (_readFile->read(&size, sizeof(uint32)) == sizeof(uint32)) {
@@ -446,7 +446,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
} else stack->pushNULL();
} else stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -459,12 +459,12 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
if (_textMode || !_writeFile) {
script->runtimeError("File.%s: File must be open for writing in binary mode.", name);
stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
fwrite(&val, sizeof(val), 1, (FILE *)_writeFile);
stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -477,12 +477,12 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
if (_textMode || !_writeFile) {
script->runtimeError("File.%s: File must be open for writing in binary mode.", name);
stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
fwrite(&val, sizeof(val), 1, (FILE *)_writeFile);
stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -495,12 +495,12 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
if (_textMode || !_writeFile) {
script->runtimeError("File.%s: File must be open for writing in binary mode.", name);
stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
fwrite(&val, sizeof(val), 1, (FILE *)_writeFile);
stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -513,12 +513,12 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
if (_textMode || !_writeFile) {
script->runtimeError("File.%s: File must be open for writing in binary mode.", name);
stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
fwrite(&val, sizeof(val), 1, (FILE *)_writeFile);
stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -531,12 +531,12 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
if (_textMode || !_writeFile) {
script->runtimeError("File.%s: File must be open for writing in binary mode.", name);
stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
fwrite(&val, sizeof(val), 1, (FILE *)_writeFile);
stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -549,12 +549,12 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
if (_textMode || !_writeFile) {
script->runtimeError("File.%s: File must be open for writing in binary mode.", name);
stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
fwrite(&val, sizeof(val), 1, (FILE *)_writeFile);
stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -567,7 +567,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
if (_textMode || !_writeFile) {
script->runtimeError("File.%s: File must be open for writing in binary mode.", name);
stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
uint32 size = strlen(val);
@@ -576,7 +576,7 @@ HRESULT CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
@@ -641,7 +641,7 @@ CScValue *CSXFile::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CSXFile::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CSXFile::scSetProperty(const char *name, CScValue *value) {
/*
//////////////////////////////////////////////////////////////////////////
// Length
@@ -657,7 +657,7 @@ HRESULT CSXFile::scSetProperty(const char *name, CScValue *value) {
_values->DeleteProp(PropName);
}
}
- return S_OK;
+ return STATUS_OK;
}
else*/ return CBScriptable::scSetProperty(name, value);
}
@@ -692,7 +692,7 @@ uint32 CSXFile::getLength() {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CSXFile::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CSXFile::persist(CBPersistMgr *persistMgr) {
CBScriptable::persist(persistMgr);
@@ -738,7 +738,7 @@ HRESULT CSXFile::persist(CBPersistMgr *persistMgr) {
}
}
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Base/scriptables/SXFile.h b/engines/wintermute/Base/scriptables/SXFile.h
index efa06b7023..12e0eb74b0 100644
--- a/engines/wintermute/Base/scriptables/SXFile.h
+++ b/engines/wintermute/Base/scriptables/SXFile.h
@@ -41,8 +41,8 @@ class CSXFile : public CBScriptable {
public:
DECLARE_PERSISTENT(CSXFile, CBScriptable)
CScValue *scGetProperty(const char *name);
- HRESULT scSetProperty(const char *name, CScValue *value);
- HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ ERRORCODE scSetProperty(const char *name, CScValue *value);
+ ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
const char *scToString();
CSXFile(CBGame *inGame, CScStack *Stack);
virtual ~CSXFile();
diff --git a/engines/wintermute/Base/scriptables/SXMath.cpp b/engines/wintermute/Base/scriptables/SXMath.cpp
index b5a696ece2..aba58e2aa7 100644
--- a/engines/wintermute/Base/scriptables/SXMath.cpp
+++ b/engines/wintermute/Base/scriptables/SXMath.cpp
@@ -30,6 +30,7 @@
#include "engines/wintermute/Base/scriptables/ScStack.h"
#include "engines/wintermute/Base/scriptables/ScValue.h"
#include "engines/wintermute/persistent.h"
+#include "common/math.h"
#include <cmath>
namespace WinterMute {
@@ -58,14 +59,14 @@ CSXMath::~CSXMath() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// Abs
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "Abs") == 0) {
stack->correctParams(1);
stack->pushFloat(fabs(stack->pop()->getFloat()));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -74,7 +75,7 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
else if (strcmp(name, "Acos") == 0) {
stack->correctParams(1);
stack->pushFloat(acos(stack->pop()->getFloat()));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -83,7 +84,7 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
else if (strcmp(name, "Asin") == 0) {
stack->correctParams(1);
stack->pushFloat(asin(stack->pop()->getFloat()));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -92,7 +93,7 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
else if (strcmp(name, "Atan") == 0) {
stack->correctParams(1);
stack->pushFloat(atan(stack->pop()->getFloat()));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -103,7 +104,7 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
double y = stack->pop()->getFloat();
double x = stack->pop()->getFloat();
stack->pushFloat(atan2(y, x));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -112,7 +113,7 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
else if (strcmp(name, "Ceil") == 0) {
stack->correctParams(1);
stack->pushFloat(ceil(stack->pop()->getFloat()));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -121,7 +122,7 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
else if (strcmp(name, "Cos") == 0) {
stack->correctParams(1);
stack->pushFloat(cos(degreeToRadian(stack->pop()->getFloat())));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -130,7 +131,7 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
else if (strcmp(name, "Cosh") == 0) {
stack->correctParams(1);
stack->pushFloat(cosh(degreeToRadian(stack->pop()->getFloat())));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -139,7 +140,7 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
else if (strcmp(name, "Exp") == 0) {
stack->correctParams(1);
stack->pushFloat(exp(stack->pop()->getFloat()));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -148,7 +149,7 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
else if (strcmp(name, "Floor") == 0) {
stack->correctParams(1);
stack->pushFloat(floor(stack->pop()->getFloat()));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -157,7 +158,7 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
else if (strcmp(name, "Log") == 0) {
stack->correctParams(1);
stack->pushFloat(log(stack->pop()->getFloat()));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -166,7 +167,7 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
else if (strcmp(name, "Log10") == 0) {
stack->correctParams(1);
stack->pushFloat(log10(stack->pop()->getFloat()));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -178,7 +179,7 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
double y = stack->pop()->getFloat();
stack->pushFloat(pow(x, y));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -187,7 +188,7 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
else if (strcmp(name, "Sin") == 0) {
stack->correctParams(1);
stack->pushFloat(sin(degreeToRadian(stack->pop()->getFloat())));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -196,7 +197,7 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
else if (strcmp(name, "Sinh") == 0) {
stack->correctParams(1);
stack->pushFloat(sinh(degreeToRadian(stack->pop()->getFloat())));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -205,7 +206,7 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
else if (strcmp(name, "Tan") == 0) {
stack->correctParams(1);
stack->pushFloat(tan(degreeToRadian(stack->pop()->getFloat())));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -214,7 +215,7 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
else if (strcmp(name, "Tanh") == 0) {
stack->correctParams(1);
stack->pushFloat(tanh(degreeToRadian(stack->pop()->getFloat())));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -223,7 +224,7 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
else if (strcmp(name, "Sqrt") == 0) {
stack->correctParams(1);
stack->pushFloat(sqrt(stack->pop()->getFloat()));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -232,7 +233,7 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
else if (strcmp(name, "DegToRad") == 0) {
stack->correctParams(1);
stack->pushFloat(degreeToRadian(stack->pop()->getFloat()));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -241,10 +242,10 @@ HRESULT CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
else if (strcmp(name, "RadToDeg") == 0) {
stack->correctParams(1);
stack->pushFloat(radianToDegree(stack->pop()->getFloat()));
- return S_OK;
+ return STATUS_OK;
}
- else return E_FAIL;
+ else return STATUS_FAILED;
}
@@ -264,7 +265,7 @@ CScValue *CSXMath::scGetProperty(const char *name) {
// PI
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "PI") == 0) {
- _scValue->setFloat(PI);
+ _scValue->setFloat(M_PI);
return _scValue;
}
@@ -274,21 +275,21 @@ CScValue *CSXMath::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
double CSXMath::degreeToRadian(double value) {
- return value * (PI / 180.0f);
+ return value * (M_PI / 180.0f);
}
//////////////////////////////////////////////////////////////////////////
double CSXMath::radianToDegree(double value) {
- return value * (180.0f / PI);
+ return value * (180.0f / M_PI);
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CSXMath::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CSXMath::persist(CBPersistMgr *persistMgr) {
CBScriptable::persist(persistMgr);
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Base/scriptables/SXMath.h b/engines/wintermute/Base/scriptables/SXMath.h
index 477e8aca4f..aceca5ea08 100644
--- a/engines/wintermute/Base/scriptables/SXMath.h
+++ b/engines/wintermute/Base/scriptables/SXMath.h
@@ -40,7 +40,7 @@ public:
CSXMath(CBGame *inGame);
virtual ~CSXMath();
virtual CScValue *scGetProperty(const char *name);
- virtual HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
private:
double degreeToRadian(double value);
diff --git a/engines/wintermute/Base/scriptables/SXMemBuffer.cpp b/engines/wintermute/Base/scriptables/SXMemBuffer.cpp
index f719ee5a47..0854cfb505 100644
--- a/engines/wintermute/Base/scriptables/SXMemBuffer.cpp
+++ b/engines/wintermute/Base/scriptables/SXMemBuffer.cpp
@@ -76,7 +76,7 @@ void CSXMemBuffer::cleanup() {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CSXMemBuffer::resize(int newSize) {
+ERRORCODE CSXMemBuffer::resize(int newSize) {
int oldSize = _size;
if (_size == 0) {
@@ -88,7 +88,7 @@ HRESULT CSXMemBuffer::resize(int newSize) {
if (newSize == 0) {
_buffer = newBuf;
_size = newSize;
- } else return E_FAIL;
+ } else return STATUS_FAILED;
} else {
_buffer = newBuf;
_size = newSize;
@@ -98,7 +98,7 @@ HRESULT CSXMemBuffer::resize(int newSize) {
if (_buffer && _size > oldSize) {
memset((byte *)_buffer + oldSize, 0, _size - oldSize);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -124,7 +124,7 @@ const char *CSXMemBuffer::scToString() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// SetSize
//////////////////////////////////////////////////////////////////////////
@@ -132,12 +132,12 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack
stack->correctParams(1);
int newSize = stack->pop()->getInt();
newSize = MAX(0, newSize);
- if (SUCCEEDED(resize(newSize)))
+ if (DID_SUCCEED(resize(newSize)))
stack->pushBool(true);
else
stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -151,7 +151,7 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack
else
stack->pushBool(*(bool *)((byte *)_buffer + start));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -165,7 +165,7 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack
else
stack->pushInt(*(byte *)((byte *)_buffer + start));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -179,7 +179,7 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack
else
stack->pushInt(65536 + * (short *)((byte *)_buffer + Start));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -193,7 +193,7 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack
else
stack->pushInt(*(int *)((byte *)_buffer + start));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -207,7 +207,7 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack
else
stack->pushFloat(*(float *)((byte *)_buffer + start));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -221,7 +221,7 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack
else
stack->pushFloat(*(double *)((byte *)_buffer + start));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -251,7 +251,7 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack
stack->pushString(str);
delete [] str;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -267,7 +267,7 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack
CSXMemBuffer *buf = new CSXMemBuffer(Game, pointer);
stack->pushNative(buf, false);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -284,7 +284,7 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack
*(bool *)((byte *)_buffer + start) = val;
stack->pushBool(true);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -301,7 +301,7 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack
*(byte *)((byte *)_buffer + start) = val;
stack->pushBool(true);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -318,7 +318,7 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack
*(short *)((byte *)_buffer + start) = val;
stack->pushBool(true);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -335,7 +335,7 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack
*(int *)((byte *)_buffer + start) = val;
stack->pushBool(true);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -352,7 +352,7 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack
*(float *)((byte *)_buffer + start) = val;
stack->pushBool(true);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -369,7 +369,7 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack
*(double *)((byte *)_buffer + start) = val;
stack->pushBool(true);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -386,7 +386,7 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack
memcpy((byte *)_buffer + start, val, strlen(val) + 1);
stack->pushBool(true);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -409,7 +409,7 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack
stack->pushBool(false);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -425,10 +425,10 @@ HRESULT CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack
f.close();
}
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
- else return E_FAIL;
+ else return STATUS_FAILED;
}
@@ -457,7 +457,7 @@ CScValue *CSXMemBuffer::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CSXMemBuffer::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CSXMemBuffer::scSetProperty(const char *name, CScValue *value) {
/*
//////////////////////////////////////////////////////////////////////////
// Length
@@ -473,14 +473,14 @@ HRESULT CSXMemBuffer::scSetProperty(const char *name, CScValue *value) {
_values->DeleteProp(PropName);
}
}
- return S_OK;
+ return STATUS_OK;
}
else*/ return CBScriptable::scSetProperty(name, value);
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CSXMemBuffer::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CSXMemBuffer::persist(CBPersistMgr *persistMgr) {
CBScriptable::persist(persistMgr);
@@ -495,7 +495,7 @@ HRESULT CSXMemBuffer::persist(CBPersistMgr *persistMgr) {
} else _buffer = NULL;
}
- return S_OK;
+ return STATUS_OK;
}
diff --git a/engines/wintermute/Base/scriptables/SXMemBuffer.h b/engines/wintermute/Base/scriptables/SXMemBuffer.h
index d76257fca7..775f8247b2 100644
--- a/engines/wintermute/Base/scriptables/SXMemBuffer.h
+++ b/engines/wintermute/Base/scriptables/SXMemBuffer.h
@@ -39,8 +39,8 @@ public:
virtual int scCompare(CBScriptable *Val);
DECLARE_PERSISTENT(CSXMemBuffer, CBScriptable)
CScValue *scGetProperty(const char *name);
- HRESULT scSetProperty(const char *name, CScValue *value);
- HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ ERRORCODE scSetProperty(const char *name, CScValue *value);
+ ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
const char *scToString();
CSXMemBuffer(CBGame *inGame, CScStack *stack);
CSXMemBuffer(CBGame *inGame, void *buffer);
@@ -48,7 +48,7 @@ public:
virtual void *scToMemBuffer();
int _size;
private:
- HRESULT resize(int newSize);
+ ERRORCODE resize(int newSize);
void *_buffer;
void cleanup();
bool checkBounds(CScScript *script, int start, int length);
diff --git a/engines/wintermute/Base/scriptables/SXStore.cpp b/engines/wintermute/Base/scriptables/SXStore.cpp
index f987e950d8..4658f48216 100644
--- a/engines/wintermute/Base/scriptables/SXStore.cpp
+++ b/engines/wintermute/Base/scriptables/SXStore.cpp
@@ -84,7 +84,7 @@ void CSXStore::cleanup() {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CSXStore::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CSXStore::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// EnableEvents
//////////////////////////////////////////////////////////////////////////
@@ -92,7 +92,7 @@ HRESULT CSXStore::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
stack->correctParams(0);
setEventsEnabled(script, true);
stack->pushBool(getEventsEnabled() == true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// DisableEvents
@@ -101,7 +101,7 @@ HRESULT CSXStore::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
stack->correctParams(0);
setEventsEnabled(script, false);
stack->pushBool(getEventsEnabled() == false);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// ValidateProducts
@@ -112,7 +112,7 @@ HRESULT CSXStore::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
_lastProductRequestOwner = script->_owner;
validateProducts(prodIdList);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// GetValidProduct
@@ -131,7 +131,7 @@ HRESULT CSXStore::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
} else
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// GetInvalidProduct
@@ -144,7 +144,7 @@ HRESULT CSXStore::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
else
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// GetTransaction
@@ -162,7 +162,7 @@ HRESULT CSXStore::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
} else
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// Purchase
@@ -172,7 +172,7 @@ HRESULT CSXStore::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
const char *prodId = stack->pop()->getString();
stack->pushBool(purchase(script, prodId));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// FinishTransaction
@@ -182,7 +182,7 @@ HRESULT CSXStore::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
const char *transId = stack->pop()->getString();
stack->pushBool(finishTransaction(script, transId));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// RestoreTransactions
@@ -192,7 +192,7 @@ HRESULT CSXStore::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
restoreTransactions(script);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -207,7 +207,7 @@ HRESULT CSXStore::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -219,10 +219,10 @@ HRESULT CSXStore::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
stack->pushBool(Game->_registry->readBool("Purchases", prodId, false));
- return S_OK;
+ return STATUS_OK;
}
- else return E_FAIL;
+ else return STATUS_FAILED;
}
@@ -278,7 +278,7 @@ CScValue *CSXStore::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CSXStore::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CSXStore::persist(CBPersistMgr *persistMgr) {
if (!persistMgr->_saving)
cleanup();
@@ -306,7 +306,7 @@ HRESULT CSXStore::persist(CBPersistMgr *persistMgr) {
}
}
- return S_OK;
+ return STATUS_OK;
}
diff --git a/engines/wintermute/Base/scriptables/SXStore.h b/engines/wintermute/Base/scriptables/SXStore.h
index fafd007003..a6268689c6 100644
--- a/engines/wintermute/Base/scriptables/SXStore.h
+++ b/engines/wintermute/Base/scriptables/SXStore.h
@@ -60,12 +60,12 @@ public:
delete [] _price;
}
- HRESULT persist(CBPersistMgr *persistMgr) {
+ ERRORCODE persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(_id));
persistMgr->transfer(TMEMBER(_name));
persistMgr->transfer(TMEMBER(_desc));
persistMgr->transfer(TMEMBER(_price));
- return S_OK;
+ return STATUS_OK;
}
const char *getId() {
@@ -130,7 +130,7 @@ public:
CSXStore(CBGame *inGame);
virtual ~CSXStore();
virtual CScValue *scGetProperty(const char *name);
- virtual HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
void afterLoad();
void OnObjectDestroyed(CBScriptHolder *obj);
diff --git a/engines/wintermute/Base/scriptables/SXString.cpp b/engines/wintermute/Base/scriptables/SXString.cpp
index 172ae32ad1..f4bb610c64 100644
--- a/engines/wintermute/Base/scriptables/SXString.cpp
+++ b/engines/wintermute/Base/scriptables/SXString.cpp
@@ -99,7 +99,7 @@ void CSXString::scSetString(const char *val) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// Substring
//////////////////////////////////////////////////////////////////////////
@@ -128,7 +128,7 @@ HRESULT CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
// stack->pushNULL();
// }
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -143,7 +143,7 @@ HRESULT CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
if (!val->isNULL() && len <= 0) {
stack->pushString("");
- return S_OK;
+ return STATUS_OK;
}
if (val->isNULL()) len = strlen(_string) - start;
@@ -166,7 +166,7 @@ HRESULT CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
// stack->pushNULL();
// }
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -188,7 +188,7 @@ HRESULT CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
else
stack->pushString(StringUtil::wideToAnsi(str).c_str());
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -210,7 +210,7 @@ HRESULT CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
else
stack->pushString(StringUtil::wideToAnsi(str).c_str());
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -237,7 +237,7 @@ HRESULT CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
int indexOf = StringUtil::indexOf(str, toFind, index);
stack->pushInt(indexOf);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -252,7 +252,7 @@ HRESULT CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
CSXArray *array = new CSXArray(Game);
if (!array) {
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
@@ -309,10 +309,10 @@ HRESULT CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
}
stack->pushNative(array, false);
- return S_OK;
+ return STATUS_OK;
}
- else return E_FAIL;
+ else return STATUS_FAILED;
}
@@ -352,7 +352,7 @@ CScValue *CSXString::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CSXString::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CSXString::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
// Capacity
//////////////////////////////////////////////////////////////////////////
@@ -369,15 +369,15 @@ HRESULT CSXString::scSetProperty(const char *name, CScValue *value) {
_capacity = newCap;
}
}
- return S_OK;
+ return STATUS_OK;
}
- else return E_FAIL;
+ else return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CSXString::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CSXString::persist(CBPersistMgr *persistMgr) {
CBScriptable::persist(persistMgr);
@@ -392,7 +392,7 @@ HRESULT CSXString::persist(CBPersistMgr *persistMgr) {
} else _string = NULL;
}
- return S_OK;
+ return STATUS_OK;
}
diff --git a/engines/wintermute/Base/scriptables/SXString.h b/engines/wintermute/Base/scriptables/SXString.h
index d7279d17cf..c9fcad6463 100644
--- a/engines/wintermute/Base/scriptables/SXString.h
+++ b/engines/wintermute/Base/scriptables/SXString.h
@@ -39,8 +39,8 @@ public:
virtual int scCompare(CBScriptable *Val);
DECLARE_PERSISTENT(CSXString, CBScriptable)
CScValue *scGetProperty(const char *name);
- HRESULT scSetProperty(const char *name, CScValue *value);
- HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ ERRORCODE scSetProperty(const char *name, CScValue *value);
+ ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
void scSetString(const char *val);
const char *scToString();
void setStringVal(const char *val);
diff --git a/engines/wintermute/Base/scriptables/ScEngine.cpp b/engines/wintermute/Base/scriptables/ScEngine.cpp
index 58ecc20a0e..639fd0d6cd 100644
--- a/engines/wintermute/Base/scriptables/ScEngine.cpp
+++ b/engines/wintermute/Base/scriptables/ScEngine.cpp
@@ -98,7 +98,7 @@ CScEngine::~CScEngine() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::cleanup() {
+ERRORCODE CScEngine::cleanup() {
for (int i = 0; i < _scripts.GetSize(); i++) {
if (!_scripts[i]->_thread && _scripts[i]->_owner) _scripts[i]->_owner->removeScript(_scripts[i]);
delete _scripts[i];
@@ -115,7 +115,7 @@ HRESULT CScEngine::cleanup() {
_currentScript = NULL; // ref only
- return S_OK;
+ return STATUS_OK;
}
@@ -148,8 +148,8 @@ 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);
- if (FAILED(ret)) {
+ ERRORCODE ret = script->create(filename, compBuffer, compSize, owner);
+ if (DID_FAIL(ret)) {
Game->LOG(ret, "Error running script '%s'...", filename);
delete script;
return NULL;
@@ -244,9 +244,9 @@ byte *CScEngine::getCompiledScript(const char *filename, uint32 *outSize, bool i
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::tick() {
+ERRORCODE CScEngine::tick() {
if (_scripts.GetSize() == 0)
- return S_OK;
+ return STATUS_OK;
// resolve waiting scripts
@@ -339,12 +339,12 @@ HRESULT CScEngine::tick() {
removeFinishedScripts();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::tickUnbreakable() {
+ERRORCODE CScEngine::tickUnbreakable() {
// execute unbreakable scripts
for (int i = 0; i < _scripts.GetSize(); i++) {
if (!_scripts[i]->_unbreakable) continue;
@@ -358,12 +358,12 @@ HRESULT CScEngine::tickUnbreakable() {
}
removeFinishedScripts();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::removeFinishedScripts() {
+ERRORCODE CScEngine::removeFinishedScripts() {
// remove finished scripts
for (int i = 0; i < _scripts.GetSize(); i++) {
if (_scripts[i]->_state == SCRIPT_FINISHED || _scripts[i]->_state == SCRIPT_ERROR) {
@@ -374,7 +374,7 @@ HRESULT CScEngine::removeFinishedScripts() {
i--;
}
}
- return S_OK;
+ return STATUS_OK;
}
@@ -411,19 +411,19 @@ int CScEngine::getNumScripts(int *running, int *waiting, int *persistent) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::emptyScriptCache() {
+ERRORCODE CScEngine::emptyScriptCache() {
for (int i = 0; i < MAX_CACHED_SCRIPTS; i++) {
if (_cachedScripts[i]) {
delete _cachedScripts[i];
_cachedScripts[i] = NULL;
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::resetObject(CBObject *Object) {
+ERRORCODE 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) {
@@ -433,22 +433,22 @@ HRESULT CScEngine::resetObject(CBObject *Object) {
_scripts[i]->finish(!IsThread); // 1.9b1 - top-level script kills its threads as well
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::resetScript(CScScript *script) {
+ERRORCODE 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) {
_scripts[i]->finish();
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CScEngine::persist(CBPersistMgr *persistMgr) {
if (!persistMgr->_saving) cleanup();
persistMgr->transfer(TMEMBER(Game));
@@ -456,7 +456,7 @@ HRESULT CScEngine::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(_globals));
_scripts.persist(persistMgr);
- return S_OK;
+ return STATUS_OK;
}
@@ -473,21 +473,21 @@ void CScEngine::editorCleanup() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::pauseAll() {
+ERRORCODE CScEngine::pauseAll() {
for (int i = 0; i < _scripts.GetSize(); i++) {
if (_scripts[i] != _currentScript) _scripts[i]->pause();
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::resumeAll() {
+ERRORCODE CScEngine::resumeAll() {
for (int i = 0; i < _scripts.GetSize(); i++)
_scripts[i]->resume();
- return S_OK;
+ return STATUS_OK;
}
@@ -500,13 +500,13 @@ bool CScEngine::isValidScript(CScScript *script) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::clearGlobals(bool includingNatives) {
+ERRORCODE CScEngine::clearGlobals(bool includingNatives) {
_globals->CleanProps(includingNatives);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::dbgSendScripts(IWmeDebugClient *client) {
+ERRORCODE CScEngine::dbgSendScripts(IWmeDebugClient *client) {
// send global variables
_globals->dbgSendVariables(client, WME_DBGVAR_GLOBAL, NULL, 0);
@@ -522,12 +522,12 @@ HRESULT CScEngine::dbgSendScripts(IWmeDebugClient *client) {
_scripts[i]->dbgSendScript(client);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::addBreakpoint(const char *scriptFilename, int line) {
- if (!Game->getDebugMgr()->_enabled) return S_OK;
+ERRORCODE CScEngine::addBreakpoint(const char *scriptFilename, int line) {
+ if (!Game->getDebugMgr()->_enabled) return STATUS_OK;
CScBreakpoint *bp = NULL;
for (int i = 0; i < _breakpoints.GetSize(); i++) {
@@ -542,19 +542,19 @@ HRESULT CScEngine::addBreakpoint(const char *scriptFilename, int line) {
}
for (int i = 0; i < bp->_lines.GetSize(); i++) {
- if (bp->_lines[i] == line) return S_OK;
+ if (bp->_lines[i] == line) return STATUS_OK;
}
bp->_lines.Add(line);
// refresh changes
refreshScriptBreakpoints();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::removeBreakpoint(const char *scriptFilename, int line) {
- if (!Game->getDebugMgr()->_enabled) return S_OK;
+ERRORCODE CScEngine::removeBreakpoint(const char *scriptFilename, int line) {
+ if (!Game->getDebugMgr()->_enabled) return STATUS_OK;
for (int i = 0; i < _breakpoints.GetSize(); i++) {
if (scumm_stricmp(_breakpoints[i]->_filename.c_str(), scriptFilename) == 0) {
@@ -568,45 +568,45 @@ HRESULT CScEngine::removeBreakpoint(const char *scriptFilename, int line) {
// refresh changes
refreshScriptBreakpoints();
- return S_OK;
+ return STATUS_OK;
}
}
break;
}
}
- return E_FAIL;
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::refreshScriptBreakpoints() {
- if (!Game->getDebugMgr()->_enabled) return S_OK;
+ERRORCODE CScEngine::refreshScriptBreakpoints() {
+ if (!Game->getDebugMgr()->_enabled) return STATUS_OK;
for (int i = 0; i < _scripts.GetSize(); i++) {
refreshScriptBreakpoints(_scripts[i]);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::refreshScriptBreakpoints(CScScript *script) {
- if (!Game->getDebugMgr()->_enabled) return S_OK;
+ERRORCODE CScEngine::refreshScriptBreakpoints(CScScript *script) {
+ if (!Game->getDebugMgr()->_enabled) return STATUS_OK;
- if (!script || !script->_filename) return E_FAIL;
+ if (!script || !script->_filename) return STATUS_FAILED;
for (int i = 0; i < _breakpoints.GetSize(); i++) {
if (scumm_stricmp(_breakpoints[i]->_filename.c_str(), script->_filename) == 0) {
script->_breakpoints.Copy(_breakpoints[i]->_lines);
- return S_OK;
+ return STATUS_OK;
}
}
if (script->_breakpoints.GetSize() > 0) script->_breakpoints.RemoveAll();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::saveBreakpoints() {
- if (!Game->getDebugMgr()->_enabled) return S_OK;
+ERRORCODE CScEngine::saveBreakpoints() {
+ if (!Game->getDebugMgr()->_enabled) return STATUS_OK;
char text[512];
@@ -624,12 +624,12 @@ HRESULT CScEngine::saveBreakpoints() {
}
Game->_registry->writeInt("Debug", "NumBreakpoints", count);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScEngine::loadBreakpoints() {
- if (!Game->getDebugMgr()->_enabled) return S_OK;
+ERRORCODE CScEngine::loadBreakpoints() {
+ if (!Game->getDebugMgr()->_enabled) return STATUS_OK;
char key[100];
@@ -649,7 +649,7 @@ HRESULT CScEngine::loadBreakpoints() {
line = NULL;
}
- return S_OK;
+ return STATUS_OK;
}
diff --git a/engines/wintermute/Base/scriptables/ScEngine.h b/engines/wintermute/Base/scriptables/ScEngine.h
index 454e3cce62..d4112be47b 100644
--- a/engines/wintermute/Base/scriptables/ScEngine.h
+++ b/engines/wintermute/Base/scriptables/ScEngine.h
@@ -83,33 +83,33 @@ public:
public:
- HRESULT dbgSendScripts(IWmeDebugClient *client);
+ ERRORCODE 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();
+ ERRORCODE addBreakpoint(const char *scriptFilename, int line);
+ ERRORCODE removeBreakpoint(const char *scriptFilename, int line);
+ ERRORCODE refreshScriptBreakpoints();
+ ERRORCODE refreshScriptBreakpoints(CScScript *script);
+ ERRORCODE saveBreakpoints();
+ ERRORCODE loadBreakpoints();
+
+ ERRORCODE clearGlobals(bool includingNatives = false);
+ ERRORCODE tickUnbreakable();
+ ERRORCODE removeFinishedScripts();
bool isValidScript(CScScript *script);
CScScript *_currentScript;
- HRESULT resumeAll();
- HRESULT pauseAll();
+ ERRORCODE resumeAll();
+ ERRORCODE pauseAll();
void editorCleanup();
- HRESULT resetObject(CBObject *Object);
- HRESULT resetScript(CScScript *script);
- HRESULT emptyScriptCache();
+ ERRORCODE resetObject(CBObject *Object);
+ ERRORCODE resetScript(CScScript *script);
+ ERRORCODE emptyScriptCache();
byte *getCompiledScript(const char *filename, uint32 *outSize, bool ignoreCache = false);
DECLARE_PERSISTENT(CScEngine, CBBase)
- HRESULT cleanup();
+ ERRORCODE cleanup();
int getNumScripts(int *running = NULL, int *waiting = NULL, int *persistent = NULL);
- HRESULT tick();
+ ERRORCODE tick();
CScValue *_globals;
CScScript *runScript(const char *filename, CBScriptHolder *owner = NULL);
static const bool _compilerAvailable = false;
diff --git a/engines/wintermute/Base/scriptables/ScScript.cpp b/engines/wintermute/Base/scriptables/ScScript.cpp
index 58e61ca3f0..19f1fb29a1 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() {
+ERRORCODE CScScript::initScript() {
if (!_scriptStream) {
_scriptStream = new Common::MemoryReadStream(_buffer, _bufferSize);
}
@@ -127,13 +127,13 @@ HRESULT CScScript::initScript() {
if (_header.magic != SCRIPT_MAGIC) {
Game->LOG(0, "File '%s' is not a valid compiled script", _filename);
cleanup();
- return E_FAIL;
+ return STATUS_FAILED;
}
if (_header.version > SCRIPT_VERSION) {
Game->LOG(0, "Script '%s' has a wrong version %d.%d (expected %d.%d)", _filename, _header.version / 256, _header.version % 256, SCRIPT_VERSION / 256, SCRIPT_VERSION % 256);
cleanup();
- return E_FAIL;
+ return STATUS_FAILED;
}
initTables();
@@ -160,12 +160,12 @@ HRESULT CScScript::initScript() {
// ready to rumble...
_state = SCRIPT_RUNNING;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScScript::initTables() {
+ERRORCODE CScScript::initTables() {
uint32 OrigIP = _iP;
readHeader();
@@ -235,12 +235,12 @@ HRESULT CScScript::initTables() {
_iP = OrigIP;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScScript::create(const char *filename, byte *buffer, uint32 size, CBScriptHolder *owner) {
+ERRORCODE CScScript::create(const char *filename, byte *buffer, uint32 size, CBScriptHolder *owner) {
cleanup();
_thread = false;
@@ -253,26 +253,26 @@ HRESULT CScScript::create(const char *filename, byte *buffer, uint32 size, CBScr
if (_filename) strcpy(_filename, filename);
_buffer = new byte [size];
- if (!_buffer) return E_FAIL;
+ if (!_buffer) return STATUS_FAILED;
memcpy(_buffer, buffer, size);
_bufferSize = size;
- HRESULT res = initScript();
- if (FAILED(res)) return res;
+ ERRORCODE res = initScript();
+ if (DID_FAIL(res)) return res;
// establish global variables table
_globals = new CScValue(Game);
_owner = owner;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScScript::createThread(CScScript *original, uint32 initIP, const char *eventName) {
+ERRORCODE CScScript::createThread(CScScript *original, uint32 initIP, const char *eventName) {
cleanup();
_thread = true;
@@ -286,14 +286,14 @@ HRESULT CScScript::createThread(CScScript *original, uint32 initIP, const char *
// copy buffer
_buffer = new byte [original->_bufferSize];
- if (!_buffer) return E_FAIL;
+ if (!_buffer) return STATUS_FAILED;
memcpy(_buffer, original->_buffer, original->_bufferSize);
_bufferSize = original->_bufferSize;
// initialize
- HRESULT res = initScript();
- if (FAILED(res)) return res;
+ ERRORCODE res = initScript();
+ if (DID_FAIL(res)) return res;
// copy globals
_globals = original->_globals;
@@ -309,16 +309,16 @@ HRESULT CScScript::createThread(CScScript *original, uint32 initIP, const char *
_engine = original->_engine;
_parentScript = original;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScScript::createMethodThread(CScScript *original, const char *methodName) {
+ERRORCODE CScScript::createMethodThread(CScScript *original, const char *methodName) {
uint32 ip = original->getMethodPos(methodName);
- if (ip == 0) return E_FAIL;
+ if (ip == 0) return STATUS_FAILED;
cleanup();
@@ -333,14 +333,14 @@ HRESULT CScScript::createMethodThread(CScScript *original, const char *methodNam
// copy buffer
_buffer = new byte [original->_bufferSize];
- if (!_buffer) return E_FAIL;
+ if (!_buffer) return STATUS_FAILED;
memcpy(_buffer, original->_buffer, original->_bufferSize);
_bufferSize = original->_bufferSize;
// initialize
- HRESULT res = initScript();
- if (FAILED(res)) return res;
+ ERRORCODE res = initScript();
+ if (DID_FAIL(res)) return res;
// copy globals
_globals = original->_globals;
@@ -355,7 +355,7 @@ HRESULT CScScript::createMethodThread(CScScript *original, const char *methodNam
_engine = original->_engine;
_parentScript = original;
- return S_OK;
+ return STATUS_OK;
}
@@ -470,8 +470,8 @@ char *CScScript::getString() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CScScript::executeInstruction() {
- HRESULT ret = S_OK;
+ERRORCODE CScScript::executeInstruction() {
+ ERRORCODE ret = STATUS_OK;
uint32 dw;
const char *str = NULL;
@@ -560,7 +560,7 @@ HRESULT CScScript::executeInstruction() {
CScValue *var = _stack->pop();
if (var->_type == VAL_VARIABLE_REF) var = var->_valRef;
- HRESULT res = E_FAIL;
+ ERRORCODE res = STATUS_FAILED;
bool TriedNative = false;
// we are already calling this method, try native
@@ -569,7 +569,7 @@ HRESULT CScScript::executeInstruction() {
res = var->_valNative->scCallMethod(this, _stack, _thisStack, MethodName);
}
- if (FAILED(res)) {
+ if (DID_FAIL(res)) {
if (var->isNative() && var->getNative()->canHandleMethod(MethodName)) {
if (!_unbreakable) {
_waitScript = var->getNative()->invokeMethodThread(MethodName);
@@ -612,10 +612,10 @@ HRESULT CScScript::executeInstruction() {
}
*/
else {
- res = E_FAIL;
+ res = STATUS_FAILED;
if (var->_type == VAL_NATIVE && !TriedNative) res = var->_valNative->scCallMethod(this, _stack, _thisStack, MethodName);
- if (FAILED(res)) {
+ if (DID_FAIL(res)) {
_stack->correctParams(0);
runtimeError("Call to undefined method '%s'. Ignored.", MethodName);
_stack->pushNULL();
@@ -1049,7 +1049,7 @@ HRESULT CScScript::executeInstruction() {
default:
Game->LOG(0, "Fatal: Invalid instruction %d ('%s', line %d, IP:0x%x)\n", inst, _filename, _currentLine, _iP - sizeof(uint32));
_state = SCRIPT_FINISHED;
- ret = E_FAIL;
+ ret = STATUS_FAILED;
} // switch(instruction)
//delete op;
@@ -1120,30 +1120,30 @@ CScValue *CScScript::getVar(char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CScScript::waitFor(CBObject *object) {
+ERRORCODE CScScript::waitFor(CBObject *object) {
if (_unbreakable) {
runtimeError("Script cannot be interrupted.");
- return S_OK;
+ return STATUS_OK;
}
_state = SCRIPT_WAITING;
_waitObject = object;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScScript::waitForExclusive(CBObject *object) {
+ERRORCODE CScScript::waitForExclusive(CBObject *object) {
_engine->resetObject(object);
return waitFor(object);
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScScript::sleep(uint32 duration) {
+ERRORCODE CScScript::sleep(uint32 duration) {
if (_unbreakable) {
runtimeError("Script cannot be interrupted.");
- return S_OK;
+ return STATUS_OK;
}
_state = SCRIPT_SLEEPING;
@@ -1154,26 +1154,26 @@ HRESULT CScScript::sleep(uint32 duration) {
_waitTime = Game->_timer + duration;
_waitFrozen = false;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScScript::finish(bool includingThreads) {
+ERRORCODE CScScript::finish(bool includingThreads) {
if (_state != SCRIPT_FINISHED && includingThreads) {
_state = SCRIPT_FINISHED;
finishThreads();
} else _state = SCRIPT_FINISHED;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScScript::run() {
+ERRORCODE CScScript::run() {
_state = SCRIPT_RUNNING;
- return S_OK;
+ return STATUS_OK;
}
@@ -1195,7 +1195,7 @@ void CScScript::runtimeError(LPCSTR fmt, ...) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CScScript::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CScScript::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(Game));
@@ -1252,7 +1252,7 @@ HRESULT CScScript::persist(CBPersistMgr *persistMgr) {
if (!persistMgr->_saving) _tracingMode = false;
- return S_OK;
+ return STATUS_OK;
}
@@ -1265,8 +1265,8 @@ CScScript *CScScript::invokeEventHandler(const char *eventName, bool unbreakable
CScScript *thread = new CScScript(Game, _engine);
if (thread) {
- HRESULT ret = thread->createThread(this, pos, eventName);
- if (SUCCEEDED(ret)) {
+ ERRORCODE ret = thread->createThread(this, pos, eventName);
+ if (DID_SUCCEED(ret)) {
thread->_unbreakable = unbreakable;
_engine->_scripts.Add(thread);
Game->getDebugMgr()->onScriptEventThreadInit(thread, this, eventName);
@@ -1302,27 +1302,27 @@ bool CScScript::canHandleMethod(const char *methodName) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CScScript::pause() {
+ERRORCODE CScScript::pause() {
if (_state == SCRIPT_PAUSED) {
Game->LOG(0, "Attempting to pause a paused script ('%s', line %d)", _filename, _currentLine);
- return E_FAIL;
+ return STATUS_FAILED;
}
- if (!_freezable || _state == SCRIPT_PERSISTENT) return S_OK;
+ if (!_freezable || _state == SCRIPT_PERSISTENT) return STATUS_OK;
_origState = _state;
_state = SCRIPT_PAUSED;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScScript::resume() {
- if (_state != SCRIPT_PAUSED) return S_OK;
+ERRORCODE CScScript::resume() {
+ if (_state != SCRIPT_PAUSED) return STATUS_OK;
_state = _origState;
- return S_OK;
+ return STATUS_OK;
}
@@ -1337,14 +1337,14 @@ CScScript::TExternalFunction *CScScript::getExternal(char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CScScript::externalCall(CScStack *stack, CScStack *thisStack, CScScript::TExternalFunction *function) {
+ERRORCODE CScScript::externalCall(CScStack *stack, CScStack *thisStack, CScScript::TExternalFunction *function) {
#ifndef __WIN32__
Game->LOG(0, "External functions are not supported on this platform.");
stack->correctParams(0);
stack->pushNULL();
- return E_FAIL;
+ return STATUS_FAILED;
#else
@@ -1451,7 +1451,7 @@ HRESULT CScScript::externalCall(CScStack *stack, CScStack *thisStack, CScScript:
if (hDll) FreeLibrary(hDll);
- return Success ? S_OK : E_FAIL;
+ return Success ? STATUS_OK : STATUS_FAILED;
#endif
}
@@ -1536,7 +1536,7 @@ double CScScript::GetST0Double(void) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CScScript::copyParameters(CScStack *stack) {
+ERRORCODE CScScript::copyParameters(CScStack *stack) {
int i;
int NumParams = stack->pop()->getInt();
for (i = NumParams - 1; i >= 0; i--) {
@@ -1546,18 +1546,18 @@ HRESULT CScScript::copyParameters(CScStack *stack) {
for (i = 0; i < NumParams; i++) stack->pop();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScScript::finishThreads() {
+ERRORCODE 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);
}
- return S_OK;
+ return STATUS_OK;
}
@@ -1574,17 +1574,17 @@ const char *CScScript::dbgGetFilename() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CScScript::dbgSendScript(IWmeDebugClient *client) {
+ERRORCODE 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 S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScScript::dbgSendVariables(IWmeDebugClient *client) {
+ERRORCODE CScScript::dbgSendVariables(IWmeDebugClient *client) {
// send script globals
_globals->dbgSendVariables(client, WME_DBGVAR_SCRIPT, this, 0);
@@ -1595,7 +1595,7 @@ HRESULT CScScript::dbgSendVariables(IWmeDebugClient *client) {
//Scope->DbgSendVariables(Client, WME_DBGVAR_SCOPE, this, (unsigned int)Scope);
}
}
- return S_OK;
+ return STATUS_OK;
}
diff --git a/engines/wintermute/Base/scriptables/ScScript.h b/engines/wintermute/Base/scriptables/ScScript.h
index 8fd3383ee1..6bd1d26142 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);
+ ERRORCODE dbgSendScript(IWmeDebugClient *client);
+ ERRORCODE dbgSendVariables(IWmeDebugClient *client);
CBArray<int, int> _breakpoints;
bool _tracingMode;
CScScript *_parentScript;
bool _unbreakable;
- HRESULT finishThreads();
- HRESULT copyParameters(CScStack *stack);
+ ERRORCODE finishThreads();
+ ERRORCODE copyParameters(CScStack *stack);
void afterLoad();
@@ -66,21 +66,21 @@ public:
CScValue *_operand;
CScValue *_reg1;
bool _freezable;
- HRESULT resume();
- HRESULT pause();
+ ERRORCODE resume();
+ ERRORCODE 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);
+ ERRORCODE createThread(CScScript *original, uint32 initIP, const char *eventName);
+ ERRORCODE 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);
+ ERRORCODE run();
+ ERRORCODE finish(bool includingThreads = false);
+ ERRORCODE sleep(uint32 duration);
+ ERRORCODE waitForExclusive(CBObject *object);
+ ERRORCODE waitFor(CBObject *object);
uint32 _waitTime;
bool _waitFrozen;
CBObject *_waitObject;
@@ -136,12 +136,12 @@ public:
CScValue *_globals;
CScEngine *_engine;
int _currentLine;
- HRESULT executeInstruction();
+ ERRORCODE executeInstruction();
char *getString();
uint32 getDWORD();
double getFloat();
void cleanup();
- HRESULT create(const char *filename, byte *buffer, uint32 size, CBScriptHolder *owner);
+ ERRORCODE create(const char *filename, byte *buffer, uint32 size, CBScriptHolder *owner);
uint32 _iP;
private:
void readHeader();
@@ -167,10 +167,10 @@ public:
char *_threadEvent;
CBScriptHolder *_owner;
CScScript::TExternalFunction *getExternal(char *name);
- HRESULT externalCall(CScStack *stack, CScStack *thisStack, CScScript::TExternalFunction *function);
+ ERRORCODE externalCall(CScStack *stack, CScStack *thisStack, CScScript::TExternalFunction *function);
private:
- HRESULT initScript();
- HRESULT initTables();
+ ERRORCODE initScript();
+ ERRORCODE initTables();
// IWmeDebugScript interface implementation
diff --git a/engines/wintermute/Base/scriptables/ScStack.cpp b/engines/wintermute/Base/scriptables/ScStack.cpp
index 38efd393ad..7bc44838f3 100644
--- a/engines/wintermute/Base/scriptables/ScStack.cpp
+++ b/engines/wintermute/Base/scriptables/ScStack.cpp
@@ -213,14 +213,14 @@ void CScStack::pushNative(CBScriptable *val, bool persistent) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CScStack::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CScStack::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(Game));
persistMgr->transfer(TMEMBER(_sP));
_values.persist(persistMgr);
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Base/scriptables/ScValue.cpp b/engines/wintermute/Base/scriptables/ScValue.cpp
index d88e0dd694..ba698fdd8d 100644
--- a/engines/wintermute/Base/scriptables/ScValue.cpp
+++ b/engines/wintermute/Base/scriptables/ScValue.cpp
@@ -188,7 +188,7 @@ CScValue *CScValue::getProp(const char *name) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScValue::deleteProp(const char *name) {
+ERRORCODE CScValue::deleteProp(const char *name) {
if (_type == VAL_VARIABLE_REF) return _valRef->deleteProp(name);
_valIter = _valObject.find(name);
@@ -197,22 +197,22 @@ HRESULT CScValue::deleteProp(const char *name) {
_valIter->_value = NULL;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScValue::setProp(const char *name, CScValue *val, bool copyWhole, bool setAsConst) {
+ERRORCODE CScValue::setProp(const char *name, CScValue *val, bool copyWhole, bool setAsConst) {
if (_type == VAL_VARIABLE_REF)
return _valRef->setProp(name, val);
- HRESULT ret = E_FAIL;
+ ERRORCODE ret = STATUS_FAILED;
if (_type == VAL_NATIVE && _valNative) {
ret = _valNative->scSetProperty(name, val);
}
- if (FAILED(ret)) {
+ if (DID_FAIL(ret)) {
CScValue *newVal = NULL;
_valIter = _valObject.find(name);
@@ -244,7 +244,7 @@ HRESULT CScValue::setProp(const char *name, CScValue *val, bool copyWhole, bool
*/
}
- return S_OK;
+ return STATUS_OK;
}
@@ -735,7 +735,7 @@ void CScValue::setValue(CScValue *val) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CScValue::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CScValue::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(Game));
persistMgr->transfer(TMEMBER(_persistent));
@@ -814,12 +814,12 @@ HRESULT CScValue::persist(CBPersistMgr *persistMgr) {
fclose(f);
*/
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CScValue::saveAsText(CBDynBuffer *buffer, int indent) {
+ERRORCODE CScValue::saveAsText(CBDynBuffer *buffer, int indent) {
_valIter = _valObject.begin();
while (_valIter != _valObject.end()) {
buffer->putTextIndent(indent, "PROPERTY {\n");
@@ -829,7 +829,7 @@ HRESULT CScValue::saveAsText(CBDynBuffer *buffer, int indent) {
_valIter++;
}
- return S_OK;
+ return STATUS_OK;
}
@@ -878,20 +878,20 @@ int CScValue::compareStrict(CScValue *val1, CScValue *val2) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CScValue::dbgSendVariables(IWmeDebugClient *client, EWmeDebuggerVariableType type, CScScript *script, unsigned int scopeID) {
+ERRORCODE CScValue::dbgSendVariables(IWmeDebugClient *client, EWmeDebuggerVariableType type, CScScript *script, unsigned int scopeID) {
_valIter = _valObject.begin();
while (_valIter != _valObject.end()) {
client->onVariableInit(type, script, scopeID, _valIter->_value, _valIter->_key.c_str());
_valIter++;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
bool CScValue::setProperty(const char *propName, int value) {
CScValue *val = new CScValue(Game, value);
- bool ret = SUCCEEDED(setProp(propName, val));
+ bool ret = DID_SUCCEED(setProp(propName, val));
delete val;
return ret;
}
@@ -899,7 +899,7 @@ bool CScValue::setProperty(const char *propName, int value) {
//////////////////////////////////////////////////////////////////////////
bool CScValue::setProperty(const char *propName, const char *value) {
CScValue *val = new CScValue(Game, value);
- bool ret = SUCCEEDED(setProp(propName, val));
+ bool ret = DID_SUCCEED(setProp(propName, val));
delete val;
return ret;
}
@@ -907,7 +907,7 @@ bool CScValue::setProperty(const char *propName, const char *value) {
//////////////////////////////////////////////////////////////////////////
bool CScValue::setProperty(const char *propName, double value) {
CScValue *val = new CScValue(Game, value);
- bool ret = SUCCEEDED(setProp(propName, val));
+ bool ret = DID_SUCCEED(setProp(propName, val));
delete val;
return ret;
}
@@ -916,7 +916,7 @@ bool CScValue::setProperty(const char *propName, double value) {
//////////////////////////////////////////////////////////////////////////
bool CScValue::setProperty(const char *propName, bool value) {
CScValue *val = new CScValue(Game, value);
- bool ret = SUCCEEDED(setProp(propName, val));
+ bool ret = DID_SUCCEED(setProp(propName, val));
delete val;
return ret;
}
@@ -925,7 +925,7 @@ bool CScValue::setProperty(const char *propName, bool value) {
//////////////////////////////////////////////////////////////////////////
bool CScValue::setProperty(const char *propName) {
CScValue *val = new CScValue(Game);
- bool ret = SUCCEEDED(setProp(propName, val));
+ bool ret = DID_SUCCEED(setProp(propName, val));
delete val;
return ret;
}
diff --git a/engines/wintermute/Base/scriptables/ScValue.h b/engines/wintermute/Base/scriptables/ScValue.h
index 0ff2a79ce6..2f946dffc5 100644
--- a/engines/wintermute/Base/scriptables/ScValue.h
+++ b/engines/wintermute/Base/scriptables/ScValue.h
@@ -43,7 +43,7 @@ class CBScriptable;
class CScValue : public CBBase, public IWmeDebugProp {
public:
- HRESULT dbgSendVariables(IWmeDebugClient *client, EWmeDebuggerVariableType type, CScScript *script, unsigned int scopeID);
+ ERRORCODE dbgSendVariables(IWmeDebugClient *client, EWmeDebuggerVariableType type, CScScript *script, unsigned int scopeID);
static int compare(CScValue *val1, CScValue *val2);
static int compareStrict(CScValue *val1, CScValue *val2);
@@ -52,7 +52,7 @@ public:
DECLARE_PERSISTENT(CScValue, CBBase)
bool _isConstVar;
- HRESULT saveAsText(CBDynBuffer *buffer, int indent);
+ ERRORCODE saveAsText(CBDynBuffer *buffer, int indent);
void setValue(CScValue *val);
bool _persistent;
bool propExists(const char *name);
@@ -65,7 +65,7 @@ public:
const char *getString();
void *getMemBuffer();
CBScriptable *getNative();
- HRESULT deleteProp(const char *name);
+ ERRORCODE deleteProp(const char *name);
void deleteProps();
void CleanProps(bool includingNatives);
void setBool(bool val);
@@ -84,7 +84,7 @@ public:
bool isFloat();
bool isInt();
bool isObject();
- HRESULT setProp(const char *name, CScValue *val, bool copyWhole = false, bool setAsConst = false);
+ ERRORCODE setProp(const char *name, CScValue *val, bool copyWhole = false, bool setAsConst = false);
CScValue *getProp(const char *name);
CBScriptable *_valNative;
CScValue *_valRef;
diff --git a/engines/wintermute/Base/scriptables/SxObject.cpp b/engines/wintermute/Base/scriptables/SxObject.cpp
index 7382c5c949..966eb0da09 100644
--- a/engines/wintermute/Base/scriptables/SxObject.cpp
+++ b/engines/wintermute/Base/scriptables/SxObject.cpp
@@ -58,10 +58,10 @@ CSXObject::~CSXObject() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CSXObject::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CSXObject::persist(CBPersistMgr *persistMgr) {
CBObject::persist(persistMgr);
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute