aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/wintermute/Ad/AdActor.cpp112
-rw-r--r--engines/wintermute/Ad/AdActor.h18
-rw-r--r--engines/wintermute/Ad/AdEntity.cpp104
-rw-r--r--engines/wintermute/Ad/AdEntity.h16
-rw-r--r--engines/wintermute/Ad/AdGame.cpp332
-rw-r--r--engines/wintermute/Ad/AdGame.h82
-rw-r--r--engines/wintermute/Ad/AdInventory.cpp28
-rw-r--r--engines/wintermute/Ad/AdInventory.h6
-rw-r--r--engines/wintermute/Ad/AdInventoryBox.cpp40
-rw-r--r--engines/wintermute/Ad/AdInventoryBox.h10
-rw-r--r--engines/wintermute/Ad/AdItem.cpp92
-rw-r--r--engines/wintermute/Ad/AdItem.h12
-rw-r--r--engines/wintermute/Ad/AdLayer.cpp54
-rw-r--r--engines/wintermute/Ad/AdLayer.h10
-rw-r--r--engines/wintermute/Ad/AdNodeState.cpp10
-rw-r--r--engines/wintermute/Ad/AdNodeState.h2
-rw-r--r--engines/wintermute/Ad/AdObject.cpp146
-rw-r--r--engines/wintermute/Ad/AdObject.h36
-rw-r--r--engines/wintermute/Ad/AdPath.cpp4
-rw-r--r--engines/wintermute/Ad/AdPathPoint.cpp4
-rw-r--r--engines/wintermute/Ad/AdRegion.cpp48
-rw-r--r--engines/wintermute/Ad/AdRegion.h10
-rw-r--r--engines/wintermute/Ad/AdResponse.cpp34
-rw-r--r--engines/wintermute/Ad/AdResponse.h8
-rw-r--r--engines/wintermute/Ad/AdResponseBox.cpp58
-rw-r--r--engines/wintermute/Ad/AdResponseBox.h20
-rw-r--r--engines/wintermute/Ad/AdResponseContext.cpp4
-rw-r--r--engines/wintermute/Ad/AdRotLevel.cpp26
-rw-r--r--engines/wintermute/Ad/AdRotLevel.h6
-rw-r--r--engines/wintermute/Ad/AdScaleLevel.cpp26
-rw-r--r--engines/wintermute/Ad/AdScaleLevel.h6
-rw-r--r--engines/wintermute/Ad/AdScene.cpp272
-rw-r--r--engines/wintermute/Ad/AdScene.h58
-rw-r--r--engines/wintermute/Ad/AdSceneNode.cpp8
-rw-r--r--engines/wintermute/Ad/AdSceneNode.h4
-rw-r--r--engines/wintermute/Ad/AdSceneState.cpp4
-rw-r--r--engines/wintermute/Ad/AdSentence.cpp32
-rw-r--r--engines/wintermute/Ad/AdSentence.h8
-rw-r--r--engines/wintermute/Ad/AdSpriteSet.cpp44
-rw-r--r--engines/wintermute/Ad/AdSpriteSet.h6
-rw-r--r--engines/wintermute/Ad/AdTalkDef.cpp52
-rw-r--r--engines/wintermute/Ad/AdTalkDef.h8
-rw-r--r--engines/wintermute/Ad/AdTalkHolder.cpp36
-rw-r--r--engines/wintermute/Ad/AdTalkHolder.h6
-rw-r--r--engines/wintermute/Ad/AdTalkNode.cpp44
-rw-r--r--engines/wintermute/Ad/AdTalkNode.h6
-rw-r--r--engines/wintermute/Ad/AdWaypointGroup.cpp36
-rw-r--r--engines/wintermute/Ad/AdWaypointGroup.h10
-rw-r--r--engines/wintermute/Base/BBase.cpp22
-rw-r--r--engines/wintermute/Base/BBase.h6
-rw-r--r--engines/wintermute/Base/BDebugger.cpp64
-rw-r--r--engines/wintermute/Base/BDebugger.h36
-rw-r--r--engines/wintermute/Base/BDynBuffer.cpp18
-rw-r--r--engines/wintermute/Base/BDynBuffer.h6
-rw-r--r--engines/wintermute/Base/BFader.cpp48
-rw-r--r--engines/wintermute/Base/BFader.h10
-rw-r--r--engines/wintermute/Base/BFileManager.cpp78
-rw-r--r--engines/wintermute/Base/BFileManager.h24
-rw-r--r--engines/wintermute/Base/BFont.cpp24
-rw-r--r--engines/wintermute/Base/BFont.h4
-rw-r--r--engines/wintermute/Base/BFontBitmap.cpp30
-rw-r--r--engines/wintermute/Base/BFontBitmap.h6
-rw-r--r--engines/wintermute/Base/BFontStorage.cpp20
-rw-r--r--engines/wintermute/Base/BFontStorage.h6
-rw-r--r--engines/wintermute/Base/BFontTT.cpp54
-rw-r--r--engines/wintermute/Base/BFontTT.h12
-rw-r--r--engines/wintermute/Base/BFrame.cpp74
-rw-r--r--engines/wintermute/Base/BFrame.h12
-rw-r--r--engines/wintermute/Base/BGame.cpp662
-rw-r--r--engines/wintermute/Base/BGame.h132
-rw-r--r--engines/wintermute/Base/BImage.cpp30
-rw-r--r--engines/wintermute/Base/BImage.h8
-rw-r--r--engines/wintermute/Base/BKeyboardState.cpp16
-rw-r--r--engines/wintermute/Base/BKeyboardState.h6
-rw-r--r--engines/wintermute/Base/BObject.cpp196
-rw-r--r--engines/wintermute/Base/BObject.h54
-rw-r--r--engines/wintermute/Base/BPackage.cpp22
-rw-r--r--engines/wintermute/Base/BPackage.h6
-rw-r--r--engines/wintermute/Base/BPersistMgr.cpp178
-rw-r--r--engines/wintermute/Base/BPersistMgr.h42
-rw-r--r--engines/wintermute/Base/BPoint.cpp4
-rw-r--r--engines/wintermute/Base/BRegion.cpp56
-rw-r--r--engines/wintermute/Base/BRegion.h14
-rw-r--r--engines/wintermute/Base/BRenderSDL.cpp64
-rw-r--r--engines/wintermute/Base/BRenderSDL.h16
-rw-r--r--engines/wintermute/Base/BRenderer.cpp60
-rw-r--r--engines/wintermute/Base/BRenderer.h52
-rw-r--r--engines/wintermute/Base/BSaveThumbHelper.cpp6
-rw-r--r--engines/wintermute/Base/BSaveThumbHelper.h2
-rw-r--r--engines/wintermute/Base/BScriptHolder.cpp76
-rw-r--r--engines/wintermute/Base/BScriptHolder.h18
-rw-r--r--engines/wintermute/Base/BScriptable.cpp14
-rw-r--r--engines/wintermute/Base/BScriptable.h4
-rw-r--r--engines/wintermute/Base/BSound.cpp64
-rw-r--r--engines/wintermute/Base/BSound.h24
-rw-r--r--engines/wintermute/Base/BSoundBuffer.cpp56
-rw-r--r--engines/wintermute/Base/BSoundBuffer.h22
-rw-r--r--engines/wintermute/Base/BSoundMgr.cpp54
-rw-r--r--engines/wintermute/Base/BSoundMgr.h20
-rw-r--r--engines/wintermute/Base/BSprite.cpp70
-rw-r--r--engines/wintermute/Base/BSprite.h18
-rw-r--r--engines/wintermute/Base/BStringTable.cpp14
-rw-r--r--engines/wintermute/Base/BStringTable.h4
-rw-r--r--engines/wintermute/Base/BSubFrame.cpp74
-rw-r--r--engines/wintermute/Base/BSubFrame.h16
-rw-r--r--engines/wintermute/Base/BSurface.cpp42
-rw-r--r--engines/wintermute/Base/BSurface.h36
-rw-r--r--engines/wintermute/Base/BSurfaceSDL.cpp50
-rw-r--r--engines/wintermute/Base/BSurfaceSDL.h26
-rw-r--r--engines/wintermute/Base/BSurfaceStorage.cpp30
-rw-r--r--engines/wintermute/Base/BSurfaceStorage.h10
-rw-r--r--engines/wintermute/Base/BTransitionMgr.cpp14
-rw-r--r--engines/wintermute/Base/BTransitionMgr.h4
-rw-r--r--engines/wintermute/Base/BViewport.cpp8
-rw-r--r--engines/wintermute/Base/BViewport.h2
-rw-r--r--engines/wintermute/Base/PartEmitter.cpp182
-rw-r--r--engines/wintermute/Base/PartEmitter.h30
-rw-r--r--engines/wintermute/Base/PartForce.cpp4
-rw-r--r--engines/wintermute/Base/PartForce.h2
-rw-r--r--engines/wintermute/Base/PartParticle.cpp42
-rw-r--r--engines/wintermute/Base/PartParticle.h12
-rw-r--r--engines/wintermute/Base/file/BFile.h8
-rw-r--r--engines/wintermute/Base/file/BSaveThumbFile.cpp34
-rw-r--r--engines/wintermute/Base/file/BSaveThumbFile.h8
-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
-rw-r--r--engines/wintermute/Sys/SysClassRegistry.cpp22
-rw-r--r--engines/wintermute/Sys/SysClassRegistry.h10
-rw-r--r--engines/wintermute/UI/UIButton.cpp110
-rw-r--r--engines/wintermute/UI/UIButton.h12
-rw-r--r--engines/wintermute/UI/UIEdit.cpp60
-rw-r--r--engines/wintermute/UI/UIEdit.h12
-rw-r--r--engines/wintermute/UI/UIEntity.cpp56
-rw-r--r--engines/wintermute/UI/UIEntity.h14
-rw-r--r--engines/wintermute/UI/UIObject.cpp60
-rw-r--r--engines/wintermute/UI/UIObject.h14
-rw-r--r--engines/wintermute/UI/UIText.cpp56
-rw-r--r--engines/wintermute/UI/UIText.h14
-rw-r--r--engines/wintermute/UI/UITiledImage.cpp36
-rw-r--r--engines/wintermute/UI/UITiledImage.h8
-rw-r--r--engines/wintermute/UI/UIWindow.cpp174
-rw-r--r--engines/wintermute/UI/UIWindow.h30
-rw-r--r--engines/wintermute/coll_templ.h6
-rw-r--r--engines/wintermute/persistent.h8
-rw-r--r--engines/wintermute/utils/PathUtil.cpp2
-rw-r--r--engines/wintermute/utils/utils.cpp8
-rw-r--r--engines/wintermute/video/VidPlayer.cpp68
-rw-r--r--engines/wintermute/video/VidPlayer.h16
-rw-r--r--engines/wintermute/video/VidTheoraPlayer.cpp120
-rw-r--r--engines/wintermute/video/VidTheoraPlayer.h26
-rw-r--r--engines/wintermute/wintermute.cpp10
-rw-r--r--engines/wintermute/wintypes.h34
172 files changed, 3482 insertions, 3481 deletions
diff --git a/engines/wintermute/Ad/AdActor.cpp b/engines/wintermute/Ad/AdActor.cpp
index b07e444439..a823a18dde 100644
--- a/engines/wintermute/Ad/AdActor.cpp
+++ b/engines/wintermute/Ad/AdActor.cpp
@@ -76,13 +76,13 @@ CAdActor::CAdActor(CBGame *inGame): CAdTalkHolder(inGame) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdActor::setDefaultAnimNames() {
+ERRORCODE CAdActor::setDefaultAnimNames() {
_talkAnimName = "talk";
_idleAnimName = "idle";
_walkAnimName = "walk";
_turnLeftAnimName = "turnleft";
_turnRightAnimName = "turnright";
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -123,19 +123,19 @@ CAdActor::~CAdActor() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdActor::loadFile(const char *filename) {
+ERRORCODE CAdActor::loadFile(const char *filename) {
byte *buffer = Game->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
Game->LOG(0, "CAdActor::LoadFile failed for file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
- HRESULT ret;
+ ERRORCODE ret;
_filename = new char [strlen(filename) + 1];
strcpy(_filename, filename);
- if (FAILED(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing ACTOR file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing ACTOR file '%s'", filename);
delete [] buffer;
@@ -183,7 +183,7 @@ TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF(ANIMATION)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdActor::loadBuffer(byte *buffer, bool complete) {
+ERRORCODE CAdActor::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(ACTOR)
TOKEN_TABLE(X)
@@ -230,7 +230,7 @@ HRESULT CAdActor::loadBuffer(byte *buffer, bool complete) {
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_ACTOR) {
Game->LOG(0, "'ACTOR' keyword expected.");
- return E_FAIL;
+ return STATUS_FAILED;
}
buffer = params;
}
@@ -241,7 +241,7 @@ HRESULT CAdActor::loadBuffer(byte *buffer, bool complete) {
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
- if (FAILED(loadFile((char *)params))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(loadFile((char *)params))) cmd = PARSERR_GENERIC;
break;
case TOKEN_X:
@@ -291,19 +291,19 @@ HRESULT CAdActor::loadBuffer(byte *buffer, bool complete) {
delete _walkSprite;
_walkSprite = NULL;
spr = new CAdSpriteSet(Game, this);
- if (!spr || FAILED(spr->loadBuffer(params, true, adGame->_texWalkLifeTime, CACHE_HALF))) cmd = PARSERR_GENERIC;
+ if (!spr || DID_FAIL(spr->loadBuffer(params, true, adGame->_texWalkLifeTime, CACHE_HALF))) cmd = PARSERR_GENERIC;
else _walkSprite = spr;
break;
case TOKEN_TALK:
spr = new CAdSpriteSet(Game, this);
- if (!spr || FAILED(spr->loadBuffer(params, true, adGame->_texTalkLifeTime))) cmd = PARSERR_GENERIC;
+ if (!spr || DID_FAIL(spr->loadBuffer(params, true, adGame->_texTalkLifeTime))) cmd = PARSERR_GENERIC;
else _talkSprites.Add(spr);
break;
case TOKEN_TALK_SPECIAL:
spr = new CAdSpriteSet(Game, this);
- if (!spr || FAILED(spr->loadBuffer(params, true, adGame->_texTalkLifeTime))) cmd = PARSERR_GENERIC;
+ if (!spr || DID_FAIL(spr->loadBuffer(params, true, adGame->_texTalkLifeTime))) cmd = PARSERR_GENERIC;
else _talkSpritesEx.Add(spr);
break;
@@ -311,7 +311,7 @@ HRESULT CAdActor::loadBuffer(byte *buffer, bool complete) {
delete _standSprite;
_standSprite = NULL;
spr = new CAdSpriteSet(Game, this);
- if (!spr || FAILED(spr->loadBuffer(params, true, adGame->_texStandLifeTime))) cmd = PARSERR_GENERIC;
+ if (!spr || DID_FAIL(spr->loadBuffer(params, true, adGame->_texStandLifeTime))) cmd = PARSERR_GENERIC;
else _standSprite = spr;
break;
@@ -319,7 +319,7 @@ HRESULT CAdActor::loadBuffer(byte *buffer, bool complete) {
delete _turnLeftSprite;
_turnLeftSprite = NULL;
spr = new CAdSpriteSet(Game, this);
- if (!spr || FAILED(spr->loadBuffer(params, true))) cmd = PARSERR_GENERIC;
+ if (!spr || DID_FAIL(spr->loadBuffer(params, true))) cmd = PARSERR_GENERIC;
else _turnLeftSprite = spr;
break;
@@ -327,7 +327,7 @@ HRESULT CAdActor::loadBuffer(byte *buffer, bool complete) {
delete _turnRightSprite;
_turnRightSprite = NULL;
spr = new CAdSpriteSet(Game, this);
- if (!spr || FAILED(spr->loadBuffer(params, true))) cmd = PARSERR_GENERIC;
+ if (!spr || DID_FAIL(spr->loadBuffer(params, true))) cmd = PARSERR_GENERIC;
else _turnRightSprite = spr;
break;
@@ -338,7 +338,7 @@ HRESULT CAdActor::loadBuffer(byte *buffer, bool complete) {
case TOKEN_CURSOR:
delete _cursor;
_cursor = new CBSprite(Game);
- if (!_cursor || FAILED(_cursor->loadFile((char *)params))) {
+ if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
delete _cursor;
_cursor = NULL;
cmd = PARSERR_GENERIC;
@@ -380,7 +380,7 @@ HRESULT CAdActor::loadBuffer(byte *buffer, bool complete) {
_currentBlockRegion = NULL;
CBRegion *rgn = new CBRegion(Game);
CBRegion *crgn = new CBRegion(Game);
- if (!rgn || !crgn || FAILED(rgn->loadBuffer(params, false))) {
+ if (!rgn || !crgn || DID_FAIL(rgn->loadBuffer(params, false))) {
delete _blockRegion;
delete _currentBlockRegion;
_blockRegion = NULL;
@@ -401,7 +401,7 @@ HRESULT CAdActor::loadBuffer(byte *buffer, bool complete) {
_currentWptGroup = NULL;
CAdWaypointGroup *wpt = new CAdWaypointGroup(Game);
CAdWaypointGroup *cwpt = new CAdWaypointGroup(Game);
- if (!wpt || !cwpt || FAILED(wpt->loadBuffer(params, false))) {
+ if (!wpt || !cwpt || DID_FAIL(wpt->loadBuffer(params, false))) {
delete _wptGroup;
delete _currentWptGroup;
_wptGroup = NULL;
@@ -433,7 +433,7 @@ HRESULT CAdActor::loadBuffer(byte *buffer, bool complete) {
case TOKEN_ANIMATION: {
CAdSpriteSet *Anim = new CAdSpriteSet(Game, this);
- if (!Anim || FAILED(Anim->loadBuffer(params, false))) cmd = PARSERR_GENERIC;
+ if (!Anim || DID_FAIL(Anim->loadBuffer(params, false))) cmd = PARSERR_GENERIC;
else _anims.Add(Anim);
}
break;
@@ -441,21 +441,21 @@ HRESULT CAdActor::loadBuffer(byte *buffer, bool complete) {
}
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in ACTOR definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (cmd == PARSERR_GENERIC) {
if (spr) delete spr;
Game->LOG(0, "Error loading ACTOR definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (alpha != 0 && ar == 0 && ag == 0 && ab == 0) {
ar = ag = ab = 255;
}
- _alphaColor = DRGBA(ar, ag, ab, alpha);
+ _alphaColor = BYTETORGBA(ar, ag, ab, alpha);
_state = _nextState = STATE_READY;
- return S_OK;
+ return STATUS_OK;
}
@@ -504,7 +504,7 @@ void CAdActor::goTo(int x, int y, TDirection afterWalkDir) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdActor::display() {
+ERRORCODE CAdActor::display() {
if (_active) updateSounds();
uint32 alpha;
@@ -542,12 +542,12 @@ HRESULT CAdActor::display() {
if (_active && _partEmitter) _partEmitter->display();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdActor::update() {
+ERRORCODE CAdActor::update() {
_currentSprite = NULL;
if (_state == STATE_READY) {
@@ -742,7 +742,7 @@ HRESULT CAdActor::update() {
updatePartEmitter();
updateSpriteAttachments();
- return S_OK;
+ return STATUS_OK;
}
@@ -850,7 +850,7 @@ void CAdActor::initLine(CBPoint startPt, CBPoint endPt) {
//////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdActor::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CAdActor::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// GoTo / GoToAsync
//////////////////////////////////////////////////////////////////////////
@@ -861,7 +861,7 @@ HRESULT CAdActor::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
goTo(X, Y);
if (strcmp(name, "GoToAsync") != 0) script->waitForExclusive(this);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -873,20 +873,20 @@ HRESULT CAdActor::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
if (!Val->isNative()) {
script->runtimeError("actor.%s method accepts an entity refrence only", name);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
CAdObject *Obj = (CAdObject *)Val->getNative();
if (!Obj || Obj->_type != OBJECT_ENTITY) {
script->runtimeError("actor.%s method accepts an entity refrence only", name);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
CAdEntity *Ent = (CAdEntity *)Obj;
if (Ent->_walkToX == 0 && Ent->_walkToY == 0) goTo(Ent->_posX, Ent->_posY);
else goTo(Ent->_walkToX, Ent->_walkToY, Ent->_walkToDir);
if (strcmp(name, "GoToObjectAsync") != 0) script->waitForExclusive(this);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -911,7 +911,7 @@ HRESULT CAdActor::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
if (strcmp(name, "TurnToAsync") != 0) script->waitForExclusive(this);
}
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -920,7 +920,7 @@ HRESULT CAdActor::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
else if (strcmp(name, "IsWalking") == 0) {
stack->correctParams(0);
stack->pushBool(_state == STATE_FOLLOWING_PATH);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -928,8 +928,8 @@ HRESULT CAdActor::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "MergeAnims") == 0) {
stack->correctParams(1);
- stack->pushBool(SUCCEEDED(mergeAnims(stack->pop()->getString())));
- return S_OK;
+ stack->pushBool(DID_SUCCEED(mergeAnims(stack->pop()->getString())));
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -955,7 +955,7 @@ HRESULT CAdActor::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
}
}
stack->pushBool(Found);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -965,7 +965,7 @@ HRESULT CAdActor::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
stack->correctParams(1);
const char *AnimName = stack->pop()->getString();
stack->pushBool(getAnimByName(AnimName) != NULL);
- return S_OK;
+ return STATUS_OK;
}
else return CAdTalkHolder::scCallMethod(script, stack, thisStack, name);
@@ -1035,14 +1035,14 @@ CScValue *CAdActor::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdActor::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CAdActor::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
// Direction
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "Direction") == 0) {
int dir = value->getInt();
if (dir >= 0 && dir < NUM_DIRECTIONS) _dir = (TDirection)dir;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1051,7 +1051,7 @@ HRESULT CAdActor::scSetProperty(const char *name, CScValue *value) {
else if (strcmp(name, "TalkAnimName") == 0) {
if (value->isNULL()) _talkAnimName = "talk";
else _talkAnimName = value->getString();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1060,7 +1060,7 @@ HRESULT CAdActor::scSetProperty(const char *name, CScValue *value) {
else if (strcmp(name, "WalkAnimName") == 0) {
if (value->isNULL()) _walkAnimName = "walk";
else _walkAnimName = value->getString();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1069,7 +1069,7 @@ HRESULT CAdActor::scSetProperty(const char *name, CScValue *value) {
else if (strcmp(name, "IdleAnimName") == 0) {
if (value->isNULL()) _idleAnimName = "idle";
else _idleAnimName = value->getString();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1078,7 +1078,7 @@ HRESULT CAdActor::scSetProperty(const char *name, CScValue *value) {
else if (strcmp(name, "TurnLeftAnimName") == 0) {
if (value->isNULL()) _turnLeftAnimName = "turnleft";
else _turnLeftAnimName = value->getString();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1087,7 +1087,7 @@ HRESULT CAdActor::scSetProperty(const char *name, CScValue *value) {
else if (strcmp(name, "TurnRightAnimName") == 0) {
if (value->isNULL()) _turnRightAnimName = "turnright";
else _turnRightAnimName = value->getString();
- return S_OK;
+ return STATUS_OK;
}
else return CAdTalkHolder::scSetProperty(name, value);
@@ -1108,8 +1108,8 @@ CBSprite *CAdActor::getTalkStance(const char *stance) {
delete _animSprite;
_animSprite = new CBSprite(Game, this);
if (_animSprite) {
- HRESULT res = _animSprite->loadFile(_forcedTalkAnimName);
- if (FAILED(res)) {
+ ERRORCODE res = _animSprite->loadFile(_forcedTalkAnimName);
+ if (DID_FAIL(res)) {
Game->LOG(res, "CAdActor::GetTalkStance: error loading talk sprite (object:\"%s\" sprite:\"%s\")", _name, _forcedTalkAnimName);
delete _animSprite;
_animSprite = NULL;
@@ -1187,7 +1187,7 @@ CBSprite *CAdActor::getTalkStanceOld(const char *stance) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdActor::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CAdActor::persist(CBPersistMgr *persistMgr) {
CAdTalkHolder::persist(persistMgr);
persistMgr->transfer(TMEMBER_INT(_dir));
@@ -1216,7 +1216,7 @@ HRESULT CAdActor::persist(CBPersistMgr *persistMgr) {
_anims.persist(persistMgr);
- return S_OK;
+ return STATUS_OK;
}
@@ -1262,7 +1262,7 @@ CAdSpriteSet *CAdActor::getAnimByName(const Common::String &animName) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdActor::mergeAnims(const char *animsFilename) {
+ERRORCODE CAdActor::mergeAnims(const char *animsFilename) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(ANIMATION)
TOKEN_TABLE_END
@@ -1271,7 +1271,7 @@ HRESULT CAdActor::mergeAnims(const char *animsFilename) {
byte *fileBuffer = Game->_fileManager->readWholeFile(animsFilename);
if (fileBuffer == NULL) {
Game->LOG(0, "CAdActor::MergeAnims failed for file '%s'", animsFilename);
- return E_FAIL;
+ return STATUS_FAILED;
}
byte *buffer = fileBuffer;
@@ -1279,15 +1279,15 @@ HRESULT CAdActor::mergeAnims(const char *animsFilename) {
int cmd;
CBParser parser(Game);
- HRESULT Ret = S_OK;
+ ERRORCODE Ret = STATUS_OK;
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
switch (cmd) {
case TOKEN_ANIMATION: {
CAdSpriteSet *Anim = new CAdSpriteSet(Game, this);
- if (!Anim || FAILED(Anim->loadBuffer(params, false))) {
+ if (!Anim || DID_FAIL(Anim->loadBuffer(params, false))) {
cmd = PARSERR_GENERIC;
- Ret = E_FAIL;
+ Ret = STATUS_FAILED;
} else _anims.Add(Anim);
}
break;
@@ -1298,7 +1298,7 @@ HRESULT CAdActor::mergeAnims(const char *animsFilename) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdActor::playAnim(const char *filename) {
+ERRORCODE CAdActor::playAnim(const char *filename) {
// if we have an anim with this name, use it
CAdSpriteSet *Anim = getAnimByName(filename);
if (Anim) {
@@ -1306,7 +1306,7 @@ HRESULT CAdActor::playAnim(const char *filename) {
if (_animSprite2) {
_animSprite2->reset();
_state = STATE_PLAYING_ANIM_SET;
- return S_OK;
+ return STATUS_OK;
}
}
// otherwise call the standard handler
diff --git a/engines/wintermute/Ad/AdActor.h b/engines/wintermute/Ad/AdActor.h
index 7ff65a0cae..d767ecd381 100644
--- a/engines/wintermute/Ad/AdActor.h
+++ b/engines/wintermute/Ad/AdActor.h
@@ -52,8 +52,8 @@ public:
CBSprite *getTalkStance(const char *stance);
virtual void goTo(int x, int y, TDirection afterWalkDir = DI_NONE);
CBPoint *_targetPoint;
- virtual HRESULT update();
- virtual HRESULT display();
+ virtual ERRORCODE update();
+ virtual ERRORCODE display();
TDirection _targetDir;
TDirection _afterWalkDir;
virtual void turnTo(TDirection dir);
@@ -67,8 +67,8 @@ public:
TDirection _dir;
CAdActor(CBGame *inGame/*=NULL*/);
virtual ~CAdActor();
- HRESULT loadFile(const char *filename);
- HRESULT loadBuffer(byte *buffer, bool complete = true);
+ ERRORCODE loadFile(const char *filename);
+ ERRORCODE loadBuffer(byte *buffer, bool complete = true);
// new anim system
Common::String _talkAnimName;
@@ -77,19 +77,19 @@ public:
Common::String _turnLeftAnimName;
Common::String _turnRightAnimName;
CBArray<CAdSpriteSet *, CAdSpriteSet *> _anims;
- virtual HRESULT playAnim(const char *filename);
+ virtual ERRORCODE playAnim(const char *filename);
CAdSpriteSet *getAnimByName(const Common::String &animName);
// scripting interface
virtual CScValue *scGetProperty(const char *name);
- virtual HRESULT scSetProperty(const char *name, CScValue *value);
- virtual HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ERRORCODE scSetProperty(const char *name, CScValue *value);
+ virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
virtual const char *scToString();
private:
- HRESULT setDefaultAnimNames();
+ ERRORCODE setDefaultAnimNames();
CBSprite *getTalkStanceOld(const char *stance);
- HRESULT mergeAnims(const char *animsFilename);
+ ERRORCODE mergeAnims(const char *animsFilename);
CBSprite *_animSprite2;
void initLine(CBPoint startPt, CBPoint endPt);
diff --git a/engines/wintermute/Ad/AdEntity.cpp b/engines/wintermute/Ad/AdEntity.cpp
index d839dfec3b..a5fb78858c 100644
--- a/engines/wintermute/Ad/AdEntity.cpp
+++ b/engines/wintermute/Ad/AdEntity.cpp
@@ -84,19 +84,19 @@ CAdEntity::~CAdEntity() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdEntity::loadFile(const char *filename) {
+ERRORCODE CAdEntity::loadFile(const char *filename) {
byte *buffer = Game->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
Game->LOG(0, "CAdEntity::LoadFile failed for file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
- HRESULT ret;
+ ERRORCODE ret;
_filename = new char [strlen(filename) + 1];
strcpy(_filename, filename);
- if (FAILED(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing ENTITY file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing ENTITY file '%s'", filename);
delete [] buffer;
@@ -150,7 +150,7 @@ TOKEN_DEF(WALK_TO_DIR)
TOKEN_DEF(SAVE_STATE)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdEntity::loadBuffer(byte *buffer, bool complete) {
+ERRORCODE CAdEntity::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(ENTITY)
TOKEN_TABLE(SPRITE)
@@ -203,7 +203,7 @@ HRESULT CAdEntity::loadBuffer(byte *buffer, bool complete) {
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_ENTITY) {
Game->LOG(0, "'ENTITY' keyword expected.");
- return E_FAIL;
+ return STATUS_FAILED;
}
buffer = params;
}
@@ -214,7 +214,7 @@ HRESULT CAdEntity::loadBuffer(byte *buffer, bool complete) {
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
- if (FAILED(loadFile((char *)params))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(loadFile((char *)params))) cmd = PARSERR_GENERIC;
break;
case TOKEN_X:
@@ -229,21 +229,21 @@ HRESULT CAdEntity::loadBuffer(byte *buffer, bool complete) {
delete _sprite;
_sprite = NULL;
spr = new CBSprite(Game, this);
- if (!spr || FAILED(spr->loadFile((char *)params))) cmd = PARSERR_GENERIC;
+ if (!spr || DID_FAIL(spr->loadFile((char *)params))) cmd = PARSERR_GENERIC;
else _sprite = spr;
}
break;
case TOKEN_TALK: {
spr = new CBSprite(Game, this);
- if (!spr || FAILED(spr->loadFile((char *)params, adGame->_texTalkLifeTime))) cmd = PARSERR_GENERIC;
+ if (!spr || DID_FAIL(spr->loadFile((char *)params, adGame->_texTalkLifeTime))) cmd = PARSERR_GENERIC;
else _talkSprites.Add(spr);
}
break;
case TOKEN_TALK_SPECIAL: {
spr = new CBSprite(Game, this);
- if (!spr || FAILED(spr->loadFile((char *)params, adGame->_texTalkLifeTime))) cmd = PARSERR_GENERIC;
+ if (!spr || DID_FAIL(spr->loadFile((char *)params, adGame->_texTalkLifeTime))) cmd = PARSERR_GENERIC;
else _talkSpritesEx.Add(spr);
}
break;
@@ -306,7 +306,7 @@ HRESULT CAdEntity::loadBuffer(byte *buffer, bool complete) {
case TOKEN_CURSOR:
delete _cursor;
_cursor = new CBSprite(Game);
- if (!_cursor || FAILED(_cursor->loadFile((char *)params))) {
+ if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
delete _cursor;
_cursor = NULL;
cmd = PARSERR_GENERIC;
@@ -321,7 +321,7 @@ HRESULT CAdEntity::loadBuffer(byte *buffer, bool complete) {
if (_region) Game->unregisterObject(_region);
_region = NULL;
CBRegion *rgn = new CBRegion(Game);
- if (!rgn || FAILED(rgn->loadBuffer(params, false))) cmd = PARSERR_GENERIC;
+ if (!rgn || DID_FAIL(rgn->loadBuffer(params, false))) cmd = PARSERR_GENERIC;
else {
_region = rgn;
Game->registerObject(_region);
@@ -336,7 +336,7 @@ HRESULT CAdEntity::loadBuffer(byte *buffer, bool complete) {
_currentBlockRegion = NULL;
CBRegion *rgn = new CBRegion(Game);
CBRegion *crgn = new CBRegion(Game);
- if (!rgn || !crgn || FAILED(rgn->loadBuffer(params, false))) {
+ if (!rgn || !crgn || DID_FAIL(rgn->loadBuffer(params, false))) {
delete _blockRegion;
_blockRegion = NULL;
delete _currentBlockRegion;
@@ -357,7 +357,7 @@ HRESULT CAdEntity::loadBuffer(byte *buffer, bool complete) {
_currentWptGroup = NULL;
CAdWaypointGroup *wpt = new CAdWaypointGroup(Game);
CAdWaypointGroup *cwpt = new CAdWaypointGroup(Game);
- if (!wpt || !cwpt || FAILED(wpt->loadBuffer(params, false))) {
+ if (!wpt || !cwpt || DID_FAIL(wpt->loadBuffer(params, false))) {
delete _wptGroup;
_wptGroup = NULL;
delete _currentWptGroup;
@@ -381,7 +381,7 @@ HRESULT CAdEntity::loadBuffer(byte *buffer, bool complete) {
_sprite = NULL;
if (Game->_editorMode) {
spr = new CBSprite(Game, this);
- if (!spr || FAILED(spr->loadFile("entity_sound.sprite"))) cmd = PARSERR_GENERIC;
+ if (!spr || DID_FAIL(spr->loadFile("entity_sound.sprite"))) cmd = PARSERR_GENERIC;
else _sprite = spr;
}
if (Game->_editorMode) _editorOnly = true;
@@ -454,12 +454,12 @@ HRESULT CAdEntity::loadBuffer(byte *buffer, bool complete) {
}
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in ENTITY definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (cmd == PARSERR_GENERIC) {
Game->LOG(0, "Error loading ENTITY definition");
if (spr) delete spr;
- return E_FAIL;
+ return STATUS_FAILED;
}
if (_region && _sprite) {
@@ -471,17 +471,17 @@ HRESULT CAdEntity::loadBuffer(byte *buffer, bool complete) {
if (alpha != 0 && ar == 0 && ag == 0 && ab == 0) {
ar = ag = ab = 255;
}
- _alphaColor = DRGBA(ar, ag, ab, alpha);
+ _alphaColor = BYTETORGBA(ar, ag, ab, alpha);
_state = STATE_READY;
if (_item && ((CAdGame *)Game)->isItemTaken(_item)) _active = false;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdEntity::display() {
+ERRORCODE CAdEntity::display() {
if (_active) {
updateSounds();
@@ -524,12 +524,12 @@ HRESULT CAdEntity::display() {
if (_partEmitter) _partEmitter->display(_region);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdEntity::update() {
+ERRORCODE CAdEntity::update() {
_currentSprite = NULL;
if (_state == STATE_READY && _animSprite) {
@@ -618,23 +618,23 @@ HRESULT CAdEntity::update() {
updatePartEmitter();
updateSpriteAttachments();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdEntity::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CAdEntity::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// StopSound
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "StopSound") == 0 && _subtype == ENTITY_SOUND) {
stack->correctParams(0);
- if (FAILED(stopSFX(false))) stack->pushBool(false);
+ if (DID_FAIL(stopSFX(false))) stack->pushBool(false);
else stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -649,7 +649,7 @@ HRESULT CAdEntity::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
delete _theora;
_theora = new CVidTheoraPlayer(Game);
- if (_theora && SUCCEEDED(_theora->initialize(filename))) {
+ if (_theora && DID_SUCCEED(_theora->initialize(filename))) {
if (!valAlpha->isNULL()) _theora->setAlphaImage(valAlpha->getString());
_theora->play(VID_PLAY_POS, 0, 0, false, false, looping, startTime, _scale >= 0.0f ? _scale : -1.0f, _sFXVolume);
//if(m_Scale>=0) m_Theora->m_PlayZoom = m_Scale;
@@ -659,7 +659,7 @@ HRESULT CAdEntity::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
stack->pushBool(false);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -674,7 +674,7 @@ HRESULT CAdEntity::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
stack->pushBool(true);
} else stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -685,7 +685,7 @@ HRESULT CAdEntity::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
if (_theora && _theora->isPlaying()) stack->pushBool(true);
else stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -698,7 +698,7 @@ HRESULT CAdEntity::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
stack->pushBool(true);
} else stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -711,7 +711,7 @@ HRESULT CAdEntity::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
stack->pushBool(true);
} else stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -722,7 +722,7 @@ HRESULT CAdEntity::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
if (_theora && _theora->isPaused()) stack->pushBool(true);
else stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
@@ -738,7 +738,7 @@ HRESULT CAdEntity::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
if (_region) stack->pushNative(_region, true);
else stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -752,7 +752,7 @@ HRESULT CAdEntity::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
stack->pushBool(true);
} else stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
else return CAdTalkHolder::scCallMethod(script, stack, thisStack, name);
@@ -831,14 +831,14 @@ CScValue *CAdEntity::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdEntity::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CAdEntity::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
// Item
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "Item") == 0) {
setItem(value->getString());
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -846,7 +846,7 @@ HRESULT CAdEntity::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "WalkToX") == 0) {
_walkToX = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -854,7 +854,7 @@ HRESULT CAdEntity::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "WalkToY") == 0) {
_walkToY = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -863,7 +863,7 @@ HRESULT CAdEntity::scSetProperty(const char *name, CScValue *value) {
else if (strcmp(name, "WalkToDirection") == 0) {
int dir = value->getInt();
if (dir >= 0 && dir < NUM_DIRECTIONS) _walkToDir = (TDirection)dir;
- return S_OK;
+ return STATUS_OK;
}
else return CAdTalkHolder::scSetProperty(name, value);
@@ -877,7 +877,7 @@ const char *CAdEntity::scToString() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdEntity::saveAsText(CBDynBuffer *buffer, int indent) {
+ERRORCODE CAdEntity::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "ENTITY {\n");
buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", _name);
if (_subtype == ENTITY_SOUND)
@@ -924,11 +924,11 @@ HRESULT CAdEntity::saveAsText(CBDynBuffer *buffer, int indent) {
}
- if (D3DCOLGetR(_alphaColor) != 0 || D3DCOLGetG(_alphaColor) != 0 || D3DCOLGetB(_alphaColor) != 0)
- buffer->putTextIndent(indent + 2, "ALPHA_COLOR { %d,%d,%d }\n", D3DCOLGetR(_alphaColor), D3DCOLGetG(_alphaColor), D3DCOLGetB(_alphaColor));
+ if (RGBCOLGetR(_alphaColor) != 0 || RGBCOLGetG(_alphaColor) != 0 || RGBCOLGetB(_alphaColor) != 0)
+ buffer->putTextIndent(indent + 2, "ALPHA_COLOR { %d,%d,%d }\n", RGBCOLGetR(_alphaColor), RGBCOLGetG(_alphaColor), RGBCOLGetB(_alphaColor));
- if (D3DCOLGetA(_alphaColor) != 0)
- buffer->putTextIndent(indent + 2, "ALPHA = %d\n", D3DCOLGetA(_alphaColor));
+ if (RGBCOLGetA(_alphaColor) != 0)
+ buffer->putTextIndent(indent + 2, "ALPHA = %d\n", RGBCOLGetA(_alphaColor));
if (_scale >= 0)
buffer->putTextIndent(indent + 2, "SCALE = %d\n", (int)_scale);
@@ -952,7 +952,7 @@ HRESULT CAdEntity::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "}\n\n");
- return S_OK;
+ return STATUS_OK;
}
@@ -977,7 +977,7 @@ void CAdEntity::updatePosition() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdEntity::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CAdEntity::persist(CBPersistMgr *persistMgr) {
CAdTalkHolder::persist(persistMgr);
persistMgr->transfer(TMEMBER(_item));
@@ -993,7 +993,7 @@ HRESULT CAdEntity::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(_theora));
- return S_OK;
+ return STATUS_OK;
}
@@ -1003,7 +1003,7 @@ void CAdEntity::setItem(const char *itemName) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdEntity::setSprite(const char *filename) {
+ERRORCODE CAdEntity::setSprite(const char *filename) {
bool setCurrent = false;
if (_currentSprite == _sprite) {
_currentSprite = NULL;
@@ -1013,14 +1013,14 @@ HRESULT CAdEntity::setSprite(const char *filename) {
delete _sprite;
_sprite = NULL;
CBSprite *spr = new CBSprite(Game, this);
- if (!spr || FAILED(spr->loadFile(filename))) {
+ if (!spr || DID_FAIL(spr->loadFile(filename))) {
delete _sprite;
_sprite = NULL;
- return E_FAIL;
+ return STATUS_FAILED;
} else {
_sprite = spr;
_currentSprite = _sprite;
- return S_OK;
+ return STATUS_OK;
}
}
diff --git a/engines/wintermute/Ad/AdEntity.h b/engines/wintermute/Ad/AdEntity.h
index c2d73a4204..9a53f8195b 100644
--- a/engines/wintermute/Ad/AdEntity.h
+++ b/engines/wintermute/Ad/AdEntity.h
@@ -36,7 +36,7 @@ class CVidTheoraPlayer;
class CAdEntity : public CAdTalkHolder {
public:
CVidTheoraPlayer *_theora;
- HRESULT setSprite(const char *filename);
+ ERRORCODE setSprite(const char *filename);
int _walkToX;
int _walkToY;
TDirection _walkToDir;
@@ -46,19 +46,19 @@ public:
void updatePosition();
virtual int getHeight();
CBRegion *_region;
- virtual HRESULT saveAsText(CBDynBuffer *buffer, int indent);
- virtual HRESULT update();
- virtual HRESULT display();
+ virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent);
+ virtual ERRORCODE update();
+ virtual ERRORCODE display();
CAdEntity(CBGame *inGame);
virtual ~CAdEntity();
- HRESULT loadFile(const char *filename);
- HRESULT loadBuffer(byte *buffer, bool complete = true);
+ ERRORCODE loadFile(const char *filename);
+ ERRORCODE loadBuffer(byte *buffer, bool complete = true);
TEntityType _subtype;
// scripting interface
virtual CScValue *scGetProperty(const char *name);
- virtual HRESULT scSetProperty(const char *name, CScValue *value);
- virtual HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ERRORCODE scSetProperty(const char *name, CScValue *value);
+ virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
virtual const char *scToString();
};
diff --git a/engines/wintermute/Ad/AdGame.cpp b/engines/wintermute/Ad/AdGame.cpp
index bfeac84f94..bf4bb41c75 100644
--- a/engines/wintermute/Ad/AdGame.cpp
+++ b/engines/wintermute/Ad/AdGame.cpp
@@ -117,7 +117,7 @@ CAdGame::~CAdGame() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::cleanup() {
+ERRORCODE CAdGame::cleanup() {
int i;
for (i = 0; i < _objects.GetSize(); i++) {
@@ -195,7 +195,7 @@ HRESULT CAdGame::cleanup() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::initLoop() {
+ERRORCODE CAdGame::initLoop() {
if (_scheduledScene && _transMgr->isReady()) {
changeScene(_scheduledScene, _scheduledFadeIn);
delete[] _scheduledScene;
@@ -205,9 +205,9 @@ HRESULT CAdGame::initLoop() {
}
- HRESULT res;
+ ERRORCODE res;
res = CBGame::initLoop();
- if (FAILED(res)) return res;
+ if (DID_FAIL(res)) return res;
if (_scene) res = _scene->initLoop();
@@ -218,18 +218,18 @@ HRESULT CAdGame::initLoop() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::addObject(CAdObject *object) {
+ERRORCODE CAdGame::addObject(CAdObject *object) {
_objects.Add(object);
return registerObject(object);
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::removeObject(CAdObject *object) {
+ERRORCODE CAdGame::removeObject(CAdObject *object) {
// in case the user called Scene.CreateXXX() and Game.DeleteXXX()
if (_scene) {
- HRESULT Res = _scene->removeObject(object);
- if (SUCCEEDED(Res)) return Res;
+ ERRORCODE Res = _scene->removeObject(object);
+ if (DID_SUCCEED(Res)) return Res;
}
for (int i = 0; i < _objects.GetSize(); i++) {
@@ -243,7 +243,7 @@ HRESULT CAdGame::removeObject(CAdObject *object) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::changeScene(const char *filename, bool fadeIn) {
+ERRORCODE CAdGame::changeScene(const char *filename, bool fadeIn) {
if (_scene == NULL) {
_scene = new CAdScene(Game);
registerObject(_scene);
@@ -265,13 +265,13 @@ HRESULT CAdGame::changeScene(const char *filename, bool fadeIn) {
_scene->_sFXVolume = 100;
if (_scene->_scProp) _scene->_scProp->cleanup();
- HRESULT ret;
+ ERRORCODE ret;
if (_initialScene && _dEBUG_DebugMode && _debugStartupScene) {
_initialScene = false;
ret = _scene->loadFile(_debugStartupScene);
} else ret = _scene->loadFile(filename);
- if (SUCCEEDED(ret)) {
+ if (DID_SUCCEED(ret)) {
// invalidate references to the original scene
for (int i = 0; i < _objects.GetSize(); i++) {
_objects[i]->invalidateCurrRegions();
@@ -282,7 +282,7 @@ HRESULT CAdGame::changeScene(const char *filename, bool fadeIn) {
}
if (fadeIn) Game->_transMgr->start(TRANSITION_FADE_IN);
return ret;
- } else return E_FAIL;
+ } else return STATUS_FAILED;
}
@@ -293,12 +293,12 @@ void CAdGame::addSentence(CAdSentence *sentence) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::displaySentences(bool frozen) {
+ERRORCODE CAdGame::displaySentences(bool frozen) {
for (int i = 0; i < _sentences.GetSize(); i++) {
if (frozen && _sentences[i]->_freezable) continue;
else _sentences[i]->display();
}
- return S_OK;
+ return STATUS_OK;
}
@@ -316,7 +316,7 @@ void CAdGame::finishSentences() {
//////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// ChangeScene
//////////////////////////////////////////////////////////////////////////
@@ -334,11 +334,11 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
stack->pushNULL();
- //HRESULT ret = ChangeScene(stack->pop()->getString());
- //if(FAILED(ret)) stack->pushBool(false);
+ //ERRORCODE ret = ChangeScene(stack->pop()->getString());
+ //if(DID_FAIL(ret)) stack->pushBool(false);
//else stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -347,7 +347,7 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
else if (strcmp(name, "LoadActor") == 0) {
stack->correctParams(1);
CAdActor *act = new CAdActor(Game);
- if (act && SUCCEEDED(act->loadFile(stack->pop()->getString()))) {
+ if (act && DID_SUCCEED(act->loadFile(stack->pop()->getString()))) {
addObject(act);
stack->pushNative(act, true);
} else {
@@ -355,7 +355,7 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
act = NULL;
stack->pushNULL();
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -364,7 +364,7 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
else if (strcmp(name, "LoadEntity") == 0) {
stack->correctParams(1);
CAdEntity *ent = new CAdEntity(Game);
- if (ent && SUCCEEDED(ent->loadFile(stack->pop()->getString()))) {
+ if (ent && DID_SUCCEED(ent->loadFile(stack->pop()->getString()))) {
addObject(ent);
stack->pushNative(ent, true);
} else {
@@ -372,7 +372,7 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
ent = NULL;
stack->pushNULL();
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -386,7 +386,7 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
if (val->getType() == VAL_VARIABLE_REF) val->setNULL();
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -400,7 +400,7 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
addObject(ent);
if (!val->isNULL()) ent->setName(val->getString());
stack->pushNative(ent, true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -414,7 +414,7 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
addItem(item);
if (!val->isNULL()) item->setName(val->getString());
stack->pushNative(item, true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -433,7 +433,7 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
}
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -454,7 +454,7 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
if (item) stack->pushNative(item, true);
else stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
@@ -491,7 +491,7 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
}
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -502,7 +502,7 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
int ID = stack->pop()->getInt(-1);
resetResponse(ID);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -513,7 +513,7 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
_responseBox->clearResponses();
_responseBox->clearButtons();
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -528,7 +528,7 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
if (_responseBox->_responses.GetSize() == 0) {
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
@@ -536,7 +536,7 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
stack->pushInt(_responseBox->_responses[0]->_iD);
_responseBox->handleResponse(_responseBox->_responses[0]);
_responseBox->clearResponses();
- return S_OK;
+ return STATUS_OK;
}
_responseBox->createButtons();
@@ -548,7 +548,7 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
script->runtimeError("Game.GetResponse: response box is not defined");
stack->pushNULL();
}
- return S_OK;
+ return STATUS_OK;
}
@@ -564,7 +564,7 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
script->runtimeError("Game.GetNumResponses: response box is not defined");
stack->pushNULL();
}
- return S_OK;
+ return STATUS_OK;
}
@@ -582,7 +582,7 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
startDlgBranch(branchName.c_str(), script->_filename == NULL ? "" : script->_filename, script->_threadEvent == NULL ? "" : script->_threadEvent);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -598,7 +598,7 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -611,7 +611,7 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
stack->pushString(_dlgPendingBranches[_dlgPendingBranches.GetSize() - 1]);
} else stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -656,17 +656,17 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
for (int j = 0; j < Inv->_takenItems.GetSize(); j++) {
if (val->getNative() == Inv->_takenItems[j]) {
stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
} else if (scumm_stricmp(val->getString(), Inv->_takenItems[j]->_name) == 0) {
stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
}
}
} else script->runtimeError("Game.IsItemTaken: item name expected");
stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -679,7 +679,7 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
else
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -692,7 +692,7 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
else
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -704,7 +704,7 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
Game->unregisterObject(_responseBox);
_responseBox = new CAdResponseBox(Game);
- if (_responseBox && !FAILED(_responseBox->loadFile(filename))) {
+ if (_responseBox && !DID_FAIL(_responseBox->loadFile(filename))) {
registerObject(_responseBox);
stack->pushBool(true);
} else {
@@ -712,7 +712,7 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
_responseBox = NULL;
stack->pushBool(false);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -724,7 +724,7 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
Game->unregisterObject(_inventoryBox);
_inventoryBox = new CAdInventoryBox(Game);
- if (_inventoryBox && !FAILED(_inventoryBox->loadFile(filename))) {
+ if (_inventoryBox && !DID_FAIL(_inventoryBox->loadFile(filename))) {
registerObject(_inventoryBox);
stack->pushBool(true);
} else {
@@ -732,7 +732,7 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
_inventoryBox = NULL;
stack->pushBool(false);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -743,10 +743,10 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
const char *filename = stack->pop()->getString();
bool merge = stack->pop()->getBool(false);
- HRESULT ret = loadItemsFile(filename, merge);
- stack->pushBool(SUCCEEDED(ret));
+ ERRORCODE ret = loadItemsFile(filename, merge);
+ stack->pushBool(DID_SUCCEED(ret));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -755,9 +755,9 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
else if (strcmp(name, "AddSpeechDir") == 0) {
stack->correctParams(1);
const char *dir = stack->pop()->getString();
- stack->pushBool(SUCCEEDED(addSpeechDir(dir)));
+ stack->pushBool(DID_SUCCEED(addSpeechDir(dir)));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -766,9 +766,9 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
else if (strcmp(name, "RemoveSpeechDir") == 0) {
stack->correctParams(1);
const char *dir = stack->pop()->getString();
- stack->pushBool(SUCCEEDED(removeSpeechDir(dir)));
+ stack->pushBool(DID_SUCCEED(removeSpeechDir(dir)));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -789,7 +789,7 @@ HRESULT CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
@@ -952,7 +952,7 @@ CScValue *CAdGame::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CAdGame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
// SelectedItem
@@ -974,7 +974,7 @@ HRESULT CAdGame::scSetProperty(const char *name, CScValue *value) {
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -982,7 +982,7 @@ HRESULT CAdGame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SmartItemCursor") == 0) {
_smartItemCursor = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -990,7 +990,7 @@ HRESULT CAdGame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "InventoryVisible") == 0) {
if (_inventoryBox) _inventoryBox->_visible = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1008,7 +1008,7 @@ HRESULT CAdGame::scSetProperty(const char *name, CScValue *value) {
if (_inventoryOwner && _inventoryBox) _inventoryBox->_scrollOffset = _inventoryOwner->getInventory()->_scrollOffset;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1016,7 +1016,7 @@ HRESULT CAdGame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "InventoryScrollOffset") == 0) {
if (_inventoryBox) _inventoryBox->_scrollOffset = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1027,7 +1027,7 @@ HRESULT CAdGame::scSetProperty(const char *name, CScValue *value) {
if (Val < 0) Val = 0;
if (Val > TALK_SKIP_NONE) Val = TALK_SKIP_NONE;
_talkSkipButton = (TTalkSkipButton)Val;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1039,7 +1039,7 @@ HRESULT CAdGame::scSetProperty(const char *name, CScValue *value) {
_startupScene = NULL;
} else CBUtils::setString(&_startupScene, value->getString());
- return S_OK;
+ return STATUS_OK;
}
else return CBGame::scSetProperty(name, value);
@@ -1047,7 +1047,7 @@ HRESULT CAdGame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStack, char *name) {
+ERRORCODE CAdGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStack, char *name) {
CScValue *this_obj;
//////////////////////////////////////////////////////////////////////////
@@ -1078,13 +1078,13 @@ HRESULT CAdGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *this
else return CBGame::ExternalCall(script, stack, thisStack, name);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::showCursor() {
- if (_cursorHidden) return S_OK;
+ERRORCODE CAdGame::showCursor() {
+ if (_cursorHidden) return STATUS_OK;
if (_selectedItem && Game->_state == GAME_RUNNING && _stateEx == GAME_NORMAL && _interactive) {
if (_selectedItem->_cursorCombined) {
@@ -1103,19 +1103,19 @@ HRESULT CAdGame::showCursor() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::loadFile(const char *filename) {
+ERRORCODE CAdGame::loadFile(const char *filename) {
byte *buffer = _fileManager->readWholeFile(filename);
if (buffer == NULL) {
Game->LOG(0, "CAdGame::LoadFile failed for file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
- HRESULT ret;
+ ERRORCODE ret;
_filename = new char [strlen(filename) + 1];
strcpy(_filename, filename);
- if (FAILED(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing GAME file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing GAME file '%s'", filename);
delete [] buffer;
@@ -1139,7 +1139,7 @@ TOKEN_DEF(STARTUP_SCENE)
TOKEN_DEF(DEBUG_STARTUP_SCENE)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::loadBuffer(byte *buffer, bool complete) {
+ERRORCODE CAdGame::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(GAME)
TOKEN_TABLE(AD_GAME)
@@ -1163,7 +1163,7 @@ HRESULT CAdGame::loadBuffer(byte *buffer, bool complete) {
while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
switch (cmd) {
case TOKEN_GAME:
- if (FAILED(CBGame::loadBuffer(params, false))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(CBGame::loadBuffer(params, false))) cmd = PARSERR_GENERIC;
break;
case TOKEN_AD_GAME:
@@ -1172,7 +1172,7 @@ HRESULT CAdGame::loadBuffer(byte *buffer, bool complete) {
case TOKEN_RESPONSE_BOX:
delete _responseBox;
_responseBox = new CAdResponseBox(Game);
- if (_responseBox && !FAILED(_responseBox->loadFile((char *)params2)))
+ if (_responseBox && !DID_FAIL(_responseBox->loadFile((char *)params2)))
registerObject(_responseBox);
else {
delete _responseBox;
@@ -1184,7 +1184,7 @@ HRESULT CAdGame::loadBuffer(byte *buffer, bool complete) {
case TOKEN_INVENTORY_BOX:
delete _inventoryBox;
_inventoryBox = new CAdInventoryBox(Game);
- if (_inventoryBox && !FAILED(_inventoryBox->loadFile((char *)params2)))
+ if (_inventoryBox && !DID_FAIL(_inventoryBox->loadFile((char *)params2)))
registerObject(_inventoryBox);
else {
delete _inventoryBox;
@@ -1196,7 +1196,7 @@ HRESULT CAdGame::loadBuffer(byte *buffer, bool complete) {
case TOKEN_ITEMS:
itemsFound = true;
CBUtils::setString(&_itemsFile, (char *)params2);
- if (FAILED(loadItemsFile(_itemsFile))) {
+ if (DID_FAIL(loadItemsFile(_itemsFile))) {
delete[] _itemsFile;
_itemsFile = NULL;
cmd = PARSERR_GENERIC;
@@ -1236,23 +1236,23 @@ HRESULT CAdGame::loadBuffer(byte *buffer, bool complete) {
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in GAME definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (cmd == PARSERR_GENERIC) {
Game->LOG(0, "Error loading GAME definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (itemFound && !itemsFound) {
Game->LOG(0, "**Warning** Please put the items definition to a separate file.");
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CAdGame::persist(CBPersistMgr *persistMgr) {
if (!persistMgr->_saving) cleanup();
CBGame::persist(persistMgr);
@@ -1298,22 +1298,22 @@ HRESULT CAdGame::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(_startupScene));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::loadGame(const char *filename) {
- HRESULT ret = CBGame::loadGame(filename);
- if (SUCCEEDED(ret)) CSysClassRegistry::getInstance()->enumInstances(afterLoadRegion, "CAdRegion", NULL);
+ERRORCODE CAdGame::loadGame(const char *filename) {
+ ERRORCODE ret = CBGame::loadGame(filename);
+ if (DID_SUCCEED(ret)) CSysClassRegistry::getInstance()->enumInstances(afterLoadRegion, "CAdRegion", NULL);
return ret;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::initAfterLoad() {
+ERRORCODE CAdGame::initAfterLoad() {
CBGame::initAfterLoad();
CSysClassRegistry::getInstance()->enumInstances(afterLoadScene, "CAdScene", NULL);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1345,7 +1345,7 @@ void CAdGame::setPrevSceneFilename(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::scheduleChangeScene(const char *filename, bool fadeIn) {
+ERRORCODE CAdGame::scheduleChangeScene(const char *filename, bool fadeIn) {
delete[] _scheduledScene;
_scheduledScene = NULL;
@@ -1356,36 +1356,36 @@ HRESULT CAdGame::scheduleChangeScene(const char *filename, bool fadeIn) {
_scheduledFadeIn = fadeIn;
- return S_OK;
+ return STATUS_OK;
}
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor) {
+ERRORCODE CAdGame::getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor) {
CBGame::getVersion(verMajor, verMinor, NULL, NULL);
if (extMajor) *extMajor = 0;
if (extMinor) *extMinor = 0;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::loadItemsFile(const char *filename, bool merge) {
+ERRORCODE CAdGame::loadItemsFile(const char *filename, bool merge) {
byte *buffer = Game->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
Game->LOG(0, "CAdGame::LoadItemsFile failed for file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
- HRESULT ret;
+ ERRORCODE ret;
//_filename = new char [strlen(filename)+1];
//strcpy(_filename, filename);
- if (FAILED(ret = loadItemsBuffer(buffer, merge))) Game->LOG(0, "Error parsing ITEMS file '%s'", filename);
+ if (DID_FAIL(ret = loadItemsBuffer(buffer, merge))) Game->LOG(0, "Error parsing ITEMS file '%s'", filename);
delete [] buffer;
@@ -1395,7 +1395,7 @@ HRESULT CAdGame::loadItemsFile(const char *filename, bool merge) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::loadItemsBuffer(byte *buffer, bool merge) {
+ERRORCODE CAdGame::loadItemsBuffer(byte *buffer, bool merge) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(ITEM)
TOKEN_TABLE_END
@@ -1412,7 +1412,7 @@ HRESULT CAdGame::loadItemsBuffer(byte *buffer, bool merge) {
switch (cmd) {
case TOKEN_ITEM: {
CAdItem *item = new CAdItem(Game);
- if (item && !FAILED(item->loadBuffer(params, false))) {
+ if (item && !DID_FAIL(item->loadBuffer(params, false))) {
// delete item with the same name, if exists
if (merge) {
CAdItem *PrevItem = getItemByName(item->_name);
@@ -1431,14 +1431,14 @@ HRESULT CAdGame::loadItemsBuffer(byte *buffer, bool merge) {
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in ITEMS definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (cmd == PARSERR_GENERIC) {
Game->LOG(0, "Error loading ITEMS definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
- return S_OK;
+ return STATUS_OK;
}
@@ -1473,7 +1473,7 @@ CAdSceneState *CAdGame::getSceneState(const char *filename, bool saving) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::windowLoadHook(CUIWindow *win, char **buffer, char **params) {
+ERRORCODE CAdGame::windowLoadHook(CUIWindow *win, char **buffer, char **params) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(ENTITY_CONTAINER)
TOKEN_TABLE_END
@@ -1485,7 +1485,7 @@ HRESULT CAdGame::windowLoadHook(CUIWindow *win, char **buffer, char **params) {
switch (cmd) {
case TOKEN_ENTITY_CONTAINER: {
CUIEntity *ent = new CUIEntity(Game);
- if (!ent || FAILED(ent->loadBuffer((byte *)*params, false))) {
+ if (!ent || DID_FAIL(ent->loadBuffer((byte *)*params, false))) {
delete ent;
ent = NULL;
cmd = PARSERR_GENERIC;
@@ -1498,16 +1498,16 @@ HRESULT CAdGame::windowLoadHook(CUIWindow *win, char **buffer, char **params) {
}
if (cmd == PARSERR_TOKENNOTFOUND || cmd == PARSERR_GENERIC) {
- return E_FAIL;
+ return STATUS_FAILED;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::windowScriptMethodHook(CUIWindow *win, CScScript *script, CScStack *stack, const char *name) {
+ERRORCODE CAdGame::windowScriptMethodHook(CUIWindow *win, CScScript *script, CScStack *stack, const char *name) {
if (strcmp(name, "CreateEntityContainer") == 0) {
stack->correctParams(1);
CScValue *val = stack->pop();
@@ -1519,24 +1519,24 @@ HRESULT CAdGame::windowScriptMethodHook(CUIWindow *win, CScScript *script, CScSt
ent->_parent = win;
win->_widgets.Add(ent);
- return S_OK;
- } else return E_FAIL;
+ return STATUS_OK;
+ } else return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::startDlgBranch(const char *branchName, const char *scriptName, const char *eventName) {
+ERRORCODE CAdGame::startDlgBranch(const char *branchName, const char *scriptName, const char *eventName) {
char *name = new char[strlen(branchName) + 1 + strlen(scriptName) + 1 + strlen(eventName) + 1];
if (name) {
sprintf(name, "%s.%s.%s", branchName, scriptName, eventName);
_dlgPendingBranches.Add(name);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::endDlgBranch(const char *branchName, const char *scriptName, const char *eventName) {
+ERRORCODE CAdGame::endDlgBranch(const char *branchName, const char *scriptName, const char *eventName) {
char *name = NULL;
bool deleteName = false;
if (branchName == NULL && _dlgPendingBranches.GetSize() > 0) {
@@ -1551,7 +1551,7 @@ HRESULT CAdGame::endDlgBranch(const char *branchName, const char *scriptName, co
}
}
- if (name == NULL) return S_OK;
+ if (name == NULL) return STATUS_OK;
int startIndex = -1;
@@ -1578,12 +1578,12 @@ HRESULT CAdGame::endDlgBranch(const char *branchName, const char *scriptName, co
if (deleteName) delete [] name;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::clearBranchResponses(char *name) {
+ERRORCODE CAdGame::clearBranchResponses(char *name) {
for (int i = 0; i < _responsesBranch.GetSize(); i++) {
if (scumm_stricmp(name, _responsesBranch[i]->_context) == 0) {
delete _responsesBranch[i];
@@ -1591,18 +1591,18 @@ HRESULT CAdGame::clearBranchResponses(char *name) {
i--;
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::addBranchResponse(int ID) {
- if (branchResponseUsed(ID)) return S_OK;
+ERRORCODE CAdGame::addBranchResponse(int ID) {
+ if (branchResponseUsed(ID)) return STATUS_OK;
CAdResponseContext *r = new CAdResponseContext(Game);
r->_iD = ID;
r->setContext(_dlgPendingBranches.GetSize() > 0 ? _dlgPendingBranches[_dlgPendingBranches.GetSize() - 1] : NULL);
_responsesBranch.Add(r);
- return S_OK;
+ return STATUS_OK;
}
@@ -1619,13 +1619,13 @@ bool CAdGame::branchResponseUsed(int ID) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::addGameResponse(int ID) {
- if (gameResponseUsed(ID)) return S_OK;
+ERRORCODE CAdGame::addGameResponse(int ID) {
+ if (gameResponseUsed(ID)) return STATUS_OK;
CAdResponseContext *r = new CAdResponseContext(Game);
r->_iD = ID;
r->setContext(_dlgPendingBranches.GetSize() > 0 ? _dlgPendingBranches[_dlgPendingBranches.GetSize() - 1] : NULL);
_responsesGame.Add(r);
- return S_OK;
+ return STATUS_OK;
}
@@ -1643,7 +1643,7 @@ bool CAdGame::gameResponseUsed(int ID) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::resetResponse(int ID) {
+ERRORCODE CAdGame::resetResponse(int ID) {
char *Context = _dlgPendingBranches.GetSize() > 0 ? _dlgPendingBranches[_dlgPendingBranches.GetSize() - 1] : NULL;
int i;
@@ -1667,12 +1667,12 @@ HRESULT CAdGame::resetResponse(int ID) {
}
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::displayContent(bool doUpdate, bool displayAll) {
+ERRORCODE CAdGame::displayContent(bool doUpdate, bool displayAll) {
// init
if (doUpdate) initLoop();
@@ -1736,30 +1736,30 @@ HRESULT CAdGame::displayContent(bool doUpdate, bool displayAll) {
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::registerInventory(CAdInventory *inv) {
+ERRORCODE CAdGame::registerInventory(CAdInventory *inv) {
for (int i = 0; i < _inventories.GetSize(); i++) {
- if (_inventories[i] == inv) return S_OK;
+ if (_inventories[i] == inv) return STATUS_OK;
}
registerObject(inv);
_inventories.Add(inv);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::unregisterInventory(CAdInventory *inv) {
+ERRORCODE CAdGame::unregisterInventory(CAdInventory *inv) {
for (int i = 0; i < _inventories.GetSize(); i++) {
if (_inventories[i] == inv) {
unregisterObject(_inventories[i]);
_inventories.RemoveAt(i);
- return S_OK;
+ return STATUS_OK;
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1786,14 +1786,14 @@ CAdItem *CAdGame::getItemByName(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::addItem(CAdItem *item) {
+ERRORCODE CAdGame::addItem(CAdItem *item) {
_items.Add(item);
return Game->registerObject(item);
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::resetContent() {
+ERRORCODE CAdGame::resetContent() {
// clear pending dialogs
for (int i = 0; i < _dlgPendingBranches.GetSize(); i++) {
delete [] _dlgPendingBranches[i];
@@ -1828,8 +1828,8 @@ HRESULT CAdGame::resetContent() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::deleteItem(CAdItem *item) {
- if (!item) return E_FAIL;
+ERRORCODE CAdGame::deleteItem(CAdItem *item) {
+ if (!item) return STATUS_FAILED;
if (_selectedItem == item) _selectedItem = NULL;
_scene->handleItemAssociations(item->_name, false);
@@ -1848,13 +1848,13 @@ HRESULT CAdGame::deleteItem(CAdItem *item) {
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::addSpeechDir(const char *dir) {
- if (!dir || dir[0] == '\0') return E_FAIL;
+ERRORCODE CAdGame::addSpeechDir(const char *dir) {
+ if (!dir || dir[0] == '\0') return STATUS_FAILED;
char *temp = new char[strlen(dir) + 2];
strcpy(temp, dir);
@@ -1864,18 +1864,18 @@ HRESULT CAdGame::addSpeechDir(const char *dir) {
for (int i = 0; i < _speechDirs.GetSize(); i++) {
if (scumm_stricmp(_speechDirs[i], temp) == 0) {
delete [] temp;
- return S_OK;
+ return STATUS_OK;
}
}
_speechDirs.Add(temp);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::removeSpeechDir(const char *dir) {
- if (!dir || dir[0] == '\0') return E_FAIL;
+ERRORCODE CAdGame::removeSpeechDir(const char *dir) {
+ if (!dir || dir[0] == '\0') return STATUS_FAILED;
char *temp = new char[strlen(dir) + 2];
strcpy(temp, dir);
@@ -1893,8 +1893,8 @@ HRESULT CAdGame::removeSpeechDir(const char *dir) {
}
delete [] temp;
- if (Found) return S_OK;
- else return E_FAIL;
+ if (Found) return STATUS_OK;
+ else return STATUS_FAILED;
}
@@ -1931,18 +1931,18 @@ bool CAdGame::validMouse() {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::onMouseLeftDown() {
- if (!validMouse()) return S_OK;
+ERRORCODE CAdGame::onMouseLeftDown() {
+ if (!validMouse()) return STATUS_OK;
if (_state == GAME_RUNNING && !_interactive) {
if (_talkSkipButton == TALK_SKIP_LEFT || _talkSkipButton == TALK_SKIP_BOTH) {
finishSentences();
}
- return S_OK;
+ return STATUS_OK;
}
if (_activeObject) _activeObject->handleMouse(MOUSE_CLICK, MOUSE_BUTTON_LEFT);
- bool handled = _state == GAME_RUNNING && SUCCEEDED(applyEvent("LeftClick"));
+ bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("LeftClick"));
if (!handled) {
if (_activeObject != NULL) {
_activeObject->applyEvent("LeftClick");
@@ -1955,18 +1955,18 @@ HRESULT CAdGame::onMouseLeftDown() {
_mouseLeftDown = true;
CBPlatform::setCapture(/*_renderer->_window*/);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::onMouseLeftUp() {
+ERRORCODE CAdGame::onMouseLeftUp() {
if (_activeObject) _activeObject->handleMouse(MOUSE_RELEASE, MOUSE_BUTTON_LEFT);
CBPlatform::releaseCapture();
_capturedObject = NULL;
_mouseLeftDown = false;
- bool handled = /*_state==GAME_RUNNING &&*/ SUCCEEDED(applyEvent("LeftRelease"));
+ bool handled = /*_state==GAME_RUNNING &&*/ DID_SUCCEED(applyEvent("LeftRelease"));
if (!handled) {
if (_activeObject != NULL) {
_activeObject->applyEvent("LeftRelease");
@@ -1974,18 +1974,18 @@ HRESULT CAdGame::onMouseLeftUp() {
_scene->applyEvent("LeftRelease");
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::onMouseLeftDblClick() {
- if (!validMouse()) return S_OK;
+ERRORCODE CAdGame::onMouseLeftDblClick() {
+ if (!validMouse()) return STATUS_OK;
- if (_state == GAME_RUNNING && !_interactive) return S_OK;
+ if (_state == GAME_RUNNING && !_interactive) return STATUS_OK;
if (_activeObject) _activeObject->handleMouse(MOUSE_DBLCLICK, MOUSE_BUTTON_LEFT);
- bool handled = _state == GAME_RUNNING && SUCCEEDED(applyEvent("LeftDoubleClick"));
+ bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("LeftDoubleClick"));
if (!handled) {
if (_activeObject != NULL) {
_activeObject->applyEvent("LeftDoubleClick");
@@ -1993,24 +1993,24 @@ HRESULT CAdGame::onMouseLeftDblClick() {
_scene->applyEvent("LeftDoubleClick");
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::onMouseRightDown() {
- if (!validMouse()) return S_OK;
+ERRORCODE CAdGame::onMouseRightDown() {
+ if (!validMouse()) return STATUS_OK;
if (_state == GAME_RUNNING && !_interactive) {
if (_talkSkipButton == TALK_SKIP_RIGHT || _talkSkipButton == TALK_SKIP_BOTH) {
finishSentences();
}
- return S_OK;
+ return STATUS_OK;
}
- if ((_state == GAME_RUNNING && !_interactive) || _stateEx == GAME_WAITING_RESPONSE) return S_OK;
+ if ((_state == GAME_RUNNING && !_interactive) || _stateEx == GAME_WAITING_RESPONSE) return STATUS_OK;
if (_activeObject) _activeObject->handleMouse(MOUSE_CLICK, MOUSE_BUTTON_RIGHT);
- bool handled = _state == GAME_RUNNING && SUCCEEDED(applyEvent("RightClick"));
+ bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("RightClick"));
if (!handled) {
if (_activeObject != NULL) {
_activeObject->applyEvent("RightClick");
@@ -2018,14 +2018,14 @@ HRESULT CAdGame::onMouseRightDown() {
_scene->applyEvent("RightClick");
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::onMouseRightUp() {
+ERRORCODE CAdGame::onMouseRightUp() {
if (_activeObject) _activeObject->handleMouse(MOUSE_RELEASE, MOUSE_BUTTON_RIGHT);
- bool handled = _state == GAME_RUNNING && SUCCEEDED(applyEvent("RightRelease"));
+ bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("RightRelease"));
if (!handled) {
if (_activeObject != NULL) {
_activeObject->applyEvent("RightRelease");
@@ -2033,11 +2033,11 @@ HRESULT CAdGame::onMouseRightUp() {
_scene->applyEvent("RightRelease");
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::displayDebugInfo() {
+ERRORCODE CAdGame::displayDebugInfo() {
char str[100];
if (Game->_dEBUG_DebugMode) {
sprintf(str, "Mouse: %d, %d (scene: %d, %d)", _mousePos.x, _mousePos.y, _mousePos.x + _scene->getOffsetLeft(), _mousePos.y + _scene->getOffsetTop());
@@ -2051,11 +2051,11 @@ HRESULT CAdGame::displayDebugInfo() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdGame::onScriptShutdown(CScScript *script) {
+ERRORCODE CAdGame::onScriptShutdown(CScScript *script) {
if (_responseBox && _responseBox->_waitingScript == script)
_responseBox->_waitingScript = NULL;
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Ad/AdGame.h b/engines/wintermute/Ad/AdGame.h
index ed5f5b3f73..80a7bb7ea0 100644
--- a/engines/wintermute/Ad/AdGame.h
+++ b/engines/wintermute/Ad/AdGame.h
@@ -44,56 +44,56 @@ class CAdResponseContext;
class CAdResponseBox;
class CAdGame : public CBGame {
public:
- virtual HRESULT onScriptShutdown(CScScript *script);
+ virtual ERRORCODE onScriptShutdown(CScScript *script);
- virtual HRESULT onMouseLeftDown();
- virtual HRESULT onMouseLeftUp();
- virtual HRESULT onMouseLeftDblClick();
- virtual HRESULT onMouseRightDown();
- virtual HRESULT onMouseRightUp();
+ virtual ERRORCODE onMouseLeftDown();
+ virtual ERRORCODE onMouseLeftUp();
+ virtual ERRORCODE onMouseLeftDblClick();
+ virtual ERRORCODE onMouseRightDown();
+ virtual ERRORCODE onMouseRightUp();
- virtual HRESULT displayDebugInfo();
+ virtual ERRORCODE displayDebugInfo();
- virtual HRESULT initAfterLoad();
+ virtual ERRORCODE initAfterLoad();
static void afterLoadScene(void *scene, void *data);
bool _smartItemCursor;
CBArray<char *, char *> _speechDirs;
- HRESULT addSpeechDir(const char *dir);
- HRESULT removeSpeechDir(const char *dir);
+ ERRORCODE addSpeechDir(const char *dir);
+ ERRORCODE removeSpeechDir(const char *dir);
char *findSpeechFile(char *StringID);
- HRESULT deleteItem(CAdItem *Item);
+ ERRORCODE deleteItem(CAdItem *Item);
char *_itemsFile;
bool _tempDisableSaveState;
- virtual HRESULT resetContent();
- HRESULT addItem(CAdItem *item);
+ virtual ERRORCODE resetContent();
+ ERRORCODE addItem(CAdItem *item);
CAdItem *getItemByName(const char *name);
CBArray<CAdItem *, CAdItem *> _items;
CAdObject *_inventoryOwner;
bool isItemTaken(char *itemName);
- HRESULT registerInventory(CAdInventory *inv);
- HRESULT unregisterInventory(CAdInventory *inv);
+ ERRORCODE registerInventory(CAdInventory *inv);
+ ERRORCODE unregisterInventory(CAdInventory *inv);
CAdObject *_invObject;
CBArray<CAdInventory *, CAdInventory *> _inventories;
- virtual HRESULT displayContent(bool update = true, bool displayAll = false);
+ virtual ERRORCODE displayContent(bool update = true, bool displayAll = false);
char *_debugStartupScene;
char *_startupScene;
bool _initialScene;
bool gameResponseUsed(int ID);
- HRESULT addGameResponse(int ID);
- HRESULT resetResponse(int ID);
+ ERRORCODE addGameResponse(int ID);
+ ERRORCODE resetResponse(int ID);
bool branchResponseUsed(int ID);
- HRESULT addBranchResponse(int ID);
- HRESULT clearBranchResponses(char *name);
- HRESULT startDlgBranch(const char *branchName, const char *scriptName, const char *eventName);
- HRESULT endDlgBranch(const char *branchName, const char *scriptName, const char *eventName);
- virtual HRESULT windowLoadHook(CUIWindow *win, char **buf, char **params);
- virtual HRESULT windowScriptMethodHook(CUIWindow *win, CScScript *script, CScStack *stack, const char *name);
+ ERRORCODE addBranchResponse(int ID);
+ ERRORCODE clearBranchResponses(char *name);
+ ERRORCODE startDlgBranch(const char *branchName, const char *scriptName, const char *eventName);
+ ERRORCODE endDlgBranch(const char *branchName, const char *scriptName, const char *eventName);
+ virtual ERRORCODE windowLoadHook(CUIWindow *win, char **buf, char **params);
+ virtual ERRORCODE windowScriptMethodHook(CUIWindow *win, CScScript *script, CScStack *stack, const char *name);
CAdSceneState *getSceneState(const char *filename, bool saving);
CBViewport *_sceneViewport;
@@ -104,31 +104,31 @@ public:
TTalkSkipButton _talkSkipButton;
- virtual HRESULT getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor);
- HRESULT scheduleChangeScene(const char *filename, bool fadeIn);
+ virtual ERRORCODE getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor);
+ ERRORCODE scheduleChangeScene(const char *filename, bool fadeIn);
char *_scheduledScene;
bool _scheduledFadeIn;
void setPrevSceneName(const char *name);
void setPrevSceneFilename(const char *name);
char *_prevSceneName;
char *_prevSceneFilename;
- virtual HRESULT loadGame(const char *filename);
+ virtual ERRORCODE loadGame(const char *filename);
CAdItem *_selectedItem;
- HRESULT cleanup();
+ ERRORCODE cleanup();
DECLARE_PERSISTENT(CAdGame, CBGame)
void finishSentences();
- HRESULT showCursor();
+ ERRORCODE showCursor();
TGameStateEx _stateEx;
CAdResponseBox *_responseBox;
CAdInventoryBox *_inventoryBox;
- HRESULT displaySentences(bool frozen);
+ ERRORCODE displaySentences(bool frozen);
void addSentence(CAdSentence *sentence);
- HRESULT changeScene(const char *filename, bool fadeIn);
- HRESULT removeObject(CAdObject *object);
- HRESULT addObject(CAdObject *object);
+ ERRORCODE changeScene(const char *filename, bool fadeIn);
+ ERRORCODE removeObject(CAdObject *object);
+ ERRORCODE addObject(CAdObject *object);
CAdScene *_scene;
- HRESULT initLoop();
+ ERRORCODE initLoop();
CAdGame();
virtual ~CAdGame();
CBArray<CAdObject *, CAdObject *> _objects;
@@ -140,19 +140,19 @@ public:
CBArray<CAdResponseContext *, CAdResponseContext *> _responsesBranch;
CBArray<CAdResponseContext *, CAdResponseContext *> _responsesGame;
- virtual HRESULT loadFile(const char *filename);
- virtual HRESULT loadBuffer(byte *buffer, bool complete = true);
+ virtual ERRORCODE loadFile(const char *filename);
+ virtual ERRORCODE loadBuffer(byte *buffer, bool complete = true);
- HRESULT loadItemsFile(const char *filename, bool merge = false);
- HRESULT loadItemsBuffer(byte *buffer, bool merge = false);
+ ERRORCODE loadItemsFile(const char *filename, bool merge = false);
+ ERRORCODE loadItemsBuffer(byte *buffer, bool merge = false);
- virtual HRESULT ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStack, char *name);
+ virtual ERRORCODE ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStack, char *name);
// scripting interface
virtual CScValue *scGetProperty(const char *name);
- virtual HRESULT scSetProperty(const char *name, CScValue *value);
- virtual HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ERRORCODE scSetProperty(const char *name, CScValue *value);
+ virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
bool validMouse();
};
diff --git a/engines/wintermute/Ad/AdInventory.cpp b/engines/wintermute/Ad/AdInventory.cpp
index 6260e23778..41e9a89ed5 100644
--- a/engines/wintermute/Ad/AdInventory.cpp
+++ b/engines/wintermute/Ad/AdInventory.cpp
@@ -49,11 +49,11 @@ CAdInventory::~CAdInventory() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdInventory::insertItem(const char *name, const char *insertAfter) {
- if (name == NULL) return E_FAIL;
+ERRORCODE CAdInventory::insertItem(const char *name, const char *insertAfter) {
+ if (name == NULL) return STATUS_FAILED;
CAdItem *item = ((CAdGame *)Game)->getItemByName(name);
- if (item == NULL) return E_FAIL;
+ if (item == NULL) return STATUS_FAILED;
int insertIndex = -1;
for (int i = 0; i < _takenItems.GetSize(); i++) {
@@ -69,51 +69,51 @@ HRESULT CAdInventory::insertItem(const char *name, const char *insertAfter) {
if (insertIndex == -1) _takenItems.Add(item);
else _takenItems.InsertAt(insertIndex, item);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdInventory::removeItem(const char *name) {
- if (name == NULL) return E_FAIL;
+ERRORCODE CAdInventory::removeItem(const char *name) {
+ if (name == NULL) return STATUS_FAILED;
for (int i = 0; i < _takenItems.GetSize(); i++) {
if (scumm_stricmp(_takenItems[i]->_name, name) == 0) {
if (((CAdGame *)Game)->_selectedItem == _takenItems[i])((CAdGame *)Game)->_selectedItem = NULL;
_takenItems.RemoveAt(i);
- return S_OK;
+ return STATUS_OK;
}
}
- return E_FAIL;
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdInventory::removeItem(CAdItem *item) {
- if (item == NULL) return E_FAIL;
+ERRORCODE CAdInventory::removeItem(CAdItem *item) {
+ if (item == NULL) return STATUS_FAILED;
for (int i = 0; i < _takenItems.GetSize(); i++) {
if (_takenItems[i] == item) {
if (((CAdGame *)Game)->_selectedItem == _takenItems[i])((CAdGame *)Game)->_selectedItem = NULL;
_takenItems.RemoveAt(i);
- return S_OK;
+ return STATUS_OK;
}
}
- return E_FAIL;
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdInventory::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CAdInventory::persist(CBPersistMgr *persistMgr) {
CBObject::persist(persistMgr);
_takenItems.persist(persistMgr);
persistMgr->transfer(TMEMBER(_scrollOffset));
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Ad/AdInventory.h b/engines/wintermute/Ad/AdInventory.h
index 6ba48a59c9..d78b78d89d 100644
--- a/engines/wintermute/Ad/AdInventory.h
+++ b/engines/wintermute/Ad/AdInventory.h
@@ -38,9 +38,9 @@ class CAdItem;
class CAdInventory : public CBObject {
public:
DECLARE_PERSISTENT(CAdInventory, CBObject)
- HRESULT removeItem(const char *name);
- HRESULT removeItem(CAdItem *Item);
- HRESULT insertItem(const char *name, const char *insertAfter = NULL);
+ ERRORCODE removeItem(const char *name);
+ ERRORCODE removeItem(CAdItem *Item);
+ ERRORCODE insertItem(const char *name, const char *insertAfter = NULL);
CAdInventory(CBGame *inGame);
virtual ~CAdInventory();
CBArray<CAdItem *, CAdItem *> _takenItems;
diff --git a/engines/wintermute/Ad/AdInventoryBox.cpp b/engines/wintermute/Ad/AdInventoryBox.cpp
index 81a8f7db2b..9cb26d8e53 100644
--- a/engines/wintermute/Ad/AdInventoryBox.cpp
+++ b/engines/wintermute/Ad/AdInventoryBox.cpp
@@ -73,7 +73,7 @@ CAdInventoryBox::~CAdInventoryBox() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdInventoryBox::listen(CBScriptHolder *param1, uint32 param2) {
+ERRORCODE CAdInventoryBox::listen(CBScriptHolder *param1, uint32 param2) {
CUIObject *obj = (CUIObject *)param1;
switch (obj->_type) {
@@ -92,15 +92,15 @@ HRESULT CAdInventoryBox::listen(CBScriptHolder *param1, uint32 param2) {
break;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdInventoryBox::display() {
+ERRORCODE CAdInventoryBox::display() {
CAdGame *adGame = (CAdGame *)Game;
- if (!_visible) return S_OK;
+ if (!_visible) return STATUS_OK;
int ItemsX, ItemsY;
ItemsX = (int)floor((float)((_itemsArea.right - _itemsArea.left + _spacing) / (_itemWidth + _spacing)));
@@ -149,24 +149,24 @@ HRESULT CAdInventoryBox::display() {
}
if (_window && _window->_alphaColor != 0) Game->_renderer->_forceAlphaColor = 0;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdInventoryBox::loadFile(const char *filename) {
+ERRORCODE CAdInventoryBox::loadFile(const char *filename) {
byte *buffer = Game->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
Game->LOG(0, "CAdInventoryBox::LoadFile failed for file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
- HRESULT ret;
+ ERRORCODE ret;
_filename = new char [strlen(filename) + 1];
strcpy(_filename, filename);
- if (FAILED(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing INVENTORY_BOX file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing INVENTORY_BOX file '%s'", filename);
delete [] buffer;
@@ -192,7 +192,7 @@ TOKEN_DEF(HIDE_SELECTED)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdInventoryBox::loadBuffer(byte *buffer, bool complete) {
+ERRORCODE CAdInventoryBox::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(INVENTORY_BOX)
TOKEN_TABLE(TEMPLATE)
@@ -219,7 +219,7 @@ HRESULT CAdInventoryBox::loadBuffer(byte *buffer, bool complete) {
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_INVENTORY_BOX) {
Game->LOG(0, "'INVENTORY_BOX' keyword expected.");
- return E_FAIL;
+ return STATUS_FAILED;
}
buffer = params;
}
@@ -227,7 +227,7 @@ HRESULT CAdInventoryBox::loadBuffer(byte *buffer, bool complete) {
while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
- if (FAILED(loadFile((char *)params))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(loadFile((char *)params))) cmd = PARSERR_GENERIC;
break;
case TOKEN_NAME:
@@ -241,7 +241,7 @@ HRESULT CAdInventoryBox::loadBuffer(byte *buffer, bool complete) {
case TOKEN_WINDOW:
delete _window;
_window = new CUIWindow(Game);
- if (!_window || FAILED(_window->loadBuffer(params, false))) {
+ if (!_window || DID_FAIL(_window->loadBuffer(params, false))) {
delete _window;
_window = NULL;
cmd = PARSERR_GENERIC;
@@ -287,11 +287,11 @@ HRESULT CAdInventoryBox::loadBuffer(byte *buffer, bool complete) {
}
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in INVENTORY_BOX definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (cmd == PARSERR_GENERIC) {
Game->LOG(0, "Error loading INVENTORY_BOX definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (_exclusive) {
@@ -313,11 +313,11 @@ HRESULT CAdInventoryBox::loadBuffer(byte *buffer, bool complete) {
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdInventoryBox::saveAsText(CBDynBuffer *buffer, int indent) {
+ERRORCODE CAdInventoryBox::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "INVENTORY_BOX\n");
buffer->putTextIndent(indent, "{\n");
@@ -345,12 +345,12 @@ HRESULT CAdInventoryBox::saveAsText(CBDynBuffer *buffer, int indent) {
CBBase::saveAsText(buffer, indent + 2);
buffer->putTextIndent(indent, "}\n");
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdInventoryBox::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CAdInventoryBox::persist(CBPersistMgr *persistMgr) {
CBObject::persist(persistMgr);
persistMgr->transfer(TMEMBER(_closeButton));
@@ -365,7 +365,7 @@ HRESULT CAdInventoryBox::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(_window));
persistMgr->transfer(TMEMBER(_exclusive));
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Ad/AdInventoryBox.h b/engines/wintermute/Ad/AdInventoryBox.h
index e05c001da8..536f60130e 100644
--- a/engines/wintermute/Ad/AdInventoryBox.h
+++ b/engines/wintermute/Ad/AdInventoryBox.h
@@ -44,18 +44,18 @@ public:
int _itemHeight;
int _itemWidth;
bool _visible;
- virtual HRESULT display();
+ virtual ERRORCODE display();
CUIButton *_closeButton;
int _spacing;
int _scrollOffset;
RECT _itemsArea;
- HRESULT listen(CBScriptHolder *param1, uint32 param2);
+ ERRORCODE listen(CBScriptHolder *param1, uint32 param2);
CUIWindow *_window;
CAdInventoryBox(CBGame *inGame);
virtual ~CAdInventoryBox();
- HRESULT loadFile(const char *filename);
- HRESULT loadBuffer(byte *buffer, bool complete = true);
- virtual HRESULT saveAsText(CBDynBuffer *buffer, int indent);
+ ERRORCODE loadFile(const char *filename);
+ ERRORCODE loadBuffer(byte *buffer, bool complete = true);
+ virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent);
};
} // end of namespace WinterMute
diff --git a/engines/wintermute/Ad/AdItem.cpp b/engines/wintermute/Ad/AdItem.cpp
index c05e18daf1..3b17cfd963 100644
--- a/engines/wintermute/Ad/AdItem.cpp
+++ b/engines/wintermute/Ad/AdItem.cpp
@@ -84,19 +84,19 @@ CAdItem::~CAdItem() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdItem::loadFile(const char *filename) {
+ERRORCODE CAdItem::loadFile(const char *filename) {
byte *buffer = Game->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
Game->LOG(0, "CAdItem::LoadFile failed for file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
- HRESULT ret;
+ ERRORCODE ret;
_filename = new char [strlen(filename) + 1];
strcpy(_filename, filename);
- if (FAILED(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing ITEM file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing ITEM file '%s'", filename);
delete [] buffer;
@@ -134,7 +134,7 @@ TOKEN_DEF(AMOUNT_STRING)
TOKEN_DEF(AMOUNT)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdItem::loadBuffer(byte *buffer, bool complete) {
+ERRORCODE CAdItem::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(ITEM)
TOKEN_TABLE(TEMPLATE)
@@ -171,7 +171,7 @@ HRESULT CAdItem::loadBuffer(byte *buffer, bool complete) {
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_ITEM) {
Game->LOG(0, "'ITEM' keyword expected.");
- return E_FAIL;
+ return STATUS_FAILED;
}
buffer = params;
}
@@ -180,7 +180,7 @@ HRESULT CAdItem::loadBuffer(byte *buffer, bool complete) {
while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
- if (FAILED(loadFile((char *)params))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(loadFile((char *)params))) cmd = PARSERR_GENERIC;
break;
case TOKEN_NAME:
@@ -199,7 +199,7 @@ HRESULT CAdItem::loadBuffer(byte *buffer, bool complete) {
case TOKEN_SPRITE:
delete _sprite;
_sprite = new CBSprite(Game, this);
- if (!_sprite || FAILED(_sprite->loadFile((char *)params, ((CAdGame *)Game)->_texItemLifeTime))) {
+ if (!_sprite || DID_FAIL(_sprite->loadFile((char *)params, ((CAdGame *)Game)->_texItemLifeTime))) {
delete _sprite;
cmd = PARSERR_GENERIC;
}
@@ -209,7 +209,7 @@ HRESULT CAdItem::loadBuffer(byte *buffer, bool complete) {
case TOKEN_SPRITE_HOVER:
delete _spriteHover;
_spriteHover = new CBSprite(Game, this);
- if (!_spriteHover || FAILED(_spriteHover->loadFile((char *)params, ((CAdGame *)Game)->_texItemLifeTime))) {
+ if (!_spriteHover || DID_FAIL(_spriteHover->loadFile((char *)params, ((CAdGame *)Game)->_texItemLifeTime))) {
delete _spriteHover;
cmd = PARSERR_GENERIC;
}
@@ -243,14 +243,14 @@ HRESULT CAdItem::loadBuffer(byte *buffer, bool complete) {
case TOKEN_TALK: {
CBSprite *spr = new CBSprite(Game, this);
- if (!spr || FAILED(spr->loadFile((char *)params, ((CAdGame *)Game)->_texTalkLifeTime))) cmd = PARSERR_GENERIC;
+ if (!spr || DID_FAIL(spr->loadFile((char *)params, ((CAdGame *)Game)->_texTalkLifeTime))) cmd = PARSERR_GENERIC;
else _talkSprites.Add(spr);
}
break;
case TOKEN_TALK_SPECIAL: {
CBSprite *spr = new CBSprite(Game, this);
- if (!spr || FAILED(spr->loadFile((char *)params, ((CAdGame *)Game)->_texTalkLifeTime))) cmd = PARSERR_GENERIC;
+ if (!spr || DID_FAIL(spr->loadFile((char *)params, ((CAdGame *)Game)->_texTalkLifeTime))) cmd = PARSERR_GENERIC;
else _talkSpritesEx.Add(spr);
}
break;
@@ -258,7 +258,7 @@ HRESULT CAdItem::loadBuffer(byte *buffer, bool complete) {
case TOKEN_CURSOR:
delete _cursorNormal;
_cursorNormal = new CBSprite(Game);
- if (!_cursorNormal || FAILED(_cursorNormal->loadFile((char *)params, ((CAdGame *)Game)->_texItemLifeTime))) {
+ if (!_cursorNormal || DID_FAIL(_cursorNormal->loadFile((char *)params, ((CAdGame *)Game)->_texItemLifeTime))) {
delete _cursorNormal;
_cursorNormal = NULL;
cmd = PARSERR_GENERIC;
@@ -268,7 +268,7 @@ HRESULT CAdItem::loadBuffer(byte *buffer, bool complete) {
case TOKEN_CURSOR_HOVER:
delete _cursorHover;
_cursorHover = new CBSprite(Game);
- if (!_cursorHover || FAILED(_cursorHover->loadFile((char *)params, ((CAdGame *)Game)->_texItemLifeTime))) {
+ if (!_cursorHover || DID_FAIL(_cursorHover->loadFile((char *)params, ((CAdGame *)Game)->_texItemLifeTime))) {
delete _cursorHover;
_cursorHover = NULL;
cmd = PARSERR_GENERIC;
@@ -302,24 +302,24 @@ HRESULT CAdItem::loadBuffer(byte *buffer, bool complete) {
}
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in ITEM definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (cmd == PARSERR_GENERIC) {
Game->LOG(0, "Error loading ITEM definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (alpha != 0 && ar == 0 && ag == 0 && ab == 0) {
ar = ag = ab = 255;
}
- _alphaColor = DRGBA(ar, ag, ab, alpha);
+ _alphaColor = BYTETORGBA(ar, ag, ab, alpha);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdItem::update() {
+ERRORCODE CAdItem::update() {
_currentSprite = NULL;
if (_state == STATE_READY && _animSprite) {
@@ -381,12 +381,12 @@ HRESULT CAdItem::update() {
}
_ready = (_state == STATE_READY);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdItem::display(int x, int y) {
+ERRORCODE CAdItem::display(int x, int y) {
int width = 0;
if (_currentSprite) {
RECT rc;
@@ -397,10 +397,10 @@ HRESULT CAdItem::display(int x, int y) {
_posX = x + width / 2;
_posY = y;
- HRESULT ret;
+ ERRORCODE ret;
if (_currentSprite)
ret = _currentSprite->draw(x, y, this, 100, 100, _alphaColor);
- else ret = S_OK;
+ else ret = STATUS_OK;
if (_displayAmount) {
int amountX = x;
@@ -430,7 +430,7 @@ HRESULT CAdItem::display(int x, int y) {
//////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdItem::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CAdItem::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// SetHoverSprite
//////////////////////////////////////////////////////////////////////////
@@ -445,7 +445,7 @@ HRESULT CAdItem::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
delete _spriteHover;
_spriteHover = NULL;
CBSprite *spr = new CBSprite(Game, this);
- if (!spr || FAILED(spr->loadFile(filename))) {
+ if (!spr || DID_FAIL(spr->loadFile(filename))) {
stack->pushBool(false);
script->runtimeError("Item.SetHoverSprite failed for file '%s'", filename);
} else {
@@ -453,7 +453,7 @@ HRESULT CAdItem::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
if (setCurrent) _currentSprite = _spriteHover;
stack->pushBool(true);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -464,7 +464,7 @@ HRESULT CAdItem::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
if (!_spriteHover || !_spriteHover->_filename) stack->pushNULL();
else stack->pushString(_spriteHover->_filename);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -474,7 +474,7 @@ HRESULT CAdItem::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
stack->correctParams(0);
if (!_spriteHover) stack->pushNULL();
else stack->pushNative(_spriteHover, true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -488,14 +488,14 @@ HRESULT CAdItem::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
delete _cursorNormal;
_cursorNormal = NULL;
CBSprite *spr = new CBSprite(Game);
- if (!spr || FAILED(spr->loadFile(filename))) {
+ if (!spr || DID_FAIL(spr->loadFile(filename))) {
stack->pushBool(false);
script->runtimeError("Item.SetNormalCursor failed for file '%s'", filename);
} else {
_cursorNormal = spr;
stack->pushBool(true);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -506,7 +506,7 @@ HRESULT CAdItem::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
if (!_cursorNormal || !_cursorNormal->_filename) stack->pushNULL();
else stack->pushString(_cursorNormal->_filename);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -517,7 +517,7 @@ HRESULT CAdItem::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
if (!_cursorNormal) stack->pushNULL();
else stack->pushNative(_cursorNormal, true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -531,14 +531,14 @@ HRESULT CAdItem::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
delete _cursorHover;
_cursorHover = NULL;
CBSprite *spr = new CBSprite(Game);
- if (!spr || FAILED(spr->loadFile(filename))) {
+ if (!spr || DID_FAIL(spr->loadFile(filename))) {
stack->pushBool(false);
script->runtimeError("Item.SetHoverCursor failed for file '%s'", filename);
} else {
_cursorHover = spr;
stack->pushBool(true);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -549,7 +549,7 @@ HRESULT CAdItem::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
if (!_cursorHover || !_cursorHover->_filename) stack->pushNULL();
else stack->pushString(_cursorHover->_filename);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -560,7 +560,7 @@ HRESULT CAdItem::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
if (!_cursorHover) stack->pushNULL();
else stack->pushNative(_cursorHover, true);
- return S_OK;
+ return STATUS_OK;
}
else return CAdTalkHolder::scCallMethod(script, stack, thisStack, name);
@@ -649,13 +649,13 @@ CScValue *CAdItem::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdItem::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CAdItem::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
// Name
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "Name") == 0) {
setName(value->getString());
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -663,7 +663,7 @@ HRESULT CAdItem::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "DisplayAmount") == 0) {
_displayAmount = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -671,7 +671,7 @@ HRESULT CAdItem::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Amount") == 0) {
_amount = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -679,7 +679,7 @@ HRESULT CAdItem::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "AmountOffsetX") == 0) {
_amountOffsetX = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -687,7 +687,7 @@ HRESULT CAdItem::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "AmountOffsetY") == 0) {
_amountOffsetY = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -695,7 +695,7 @@ HRESULT CAdItem::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "AmountAlign") == 0) {
_amountAlign = (TTextAlign)value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -708,7 +708,7 @@ HRESULT CAdItem::scSetProperty(const char *name, CScValue *value) {
} else {
CBUtils::setString(&_amountString, value->getString());
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -716,7 +716,7 @@ HRESULT CAdItem::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "CursorCombined") == 0) {
_cursorCombined = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
else return CAdTalkHolder::scSetProperty(name, value);
@@ -730,7 +730,7 @@ const char *CAdItem::scToString() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdItem::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CAdItem::persist(CBPersistMgr *persistMgr) {
CAdTalkHolder::persist(persistMgr);
@@ -746,7 +746,7 @@ HRESULT CAdItem::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER_INT(_amountAlign));
persistMgr->transfer(TMEMBER(_amountString));
- return S_OK;
+ return STATUS_OK;
}
diff --git a/engines/wintermute/Ad/AdItem.h b/engines/wintermute/Ad/AdItem.h
index fa2e99fa5a..f0810d95d1 100644
--- a/engines/wintermute/Ad/AdItem.h
+++ b/engines/wintermute/Ad/AdItem.h
@@ -44,9 +44,9 @@ public:
char *_amountString;
- HRESULT update();
+ ERRORCODE update();
DECLARE_PERSISTENT(CAdItem, CAdTalkHolder)
- HRESULT display(int x, int y);
+ ERRORCODE display(int x, int y);
bool getExtendedFlag(const char *flagName);
bool _inInventory;
bool _cursorCombined;
@@ -55,13 +55,13 @@ public:
CBSprite *_cursorHover;
CAdItem(CBGame *inGame);
virtual ~CAdItem();
- HRESULT loadFile(const char *filename);
- HRESULT loadBuffer(byte *buffer, bool complete = true);
+ ERRORCODE loadFile(const char *filename);
+ ERRORCODE loadBuffer(byte *buffer, bool complete = true);
// scripting interface
virtual CScValue *scGetProperty(const char *name);
- virtual HRESULT scSetProperty(const char *name, CScValue *value);
- virtual HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ERRORCODE scSetProperty(const char *name, CScValue *value);
+ virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
virtual const char *scToString();
};
diff --git a/engines/wintermute/Ad/AdLayer.cpp b/engines/wintermute/Ad/AdLayer.cpp
index 64d36e67db..06765b6cba 100644
--- a/engines/wintermute/Ad/AdLayer.cpp
+++ b/engines/wintermute/Ad/AdLayer.cpp
@@ -61,19 +61,19 @@ CAdLayer::~CAdLayer() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdLayer::loadFile(const char *filename) {
+ERRORCODE CAdLayer::loadFile(const char *filename) {
byte *buffer = Game->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
Game->LOG(0, "CAdLayer::LoadFile failed for file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
- HRESULT ret;
+ ERRORCODE ret;
_filename = new char [strlen(filename) + 1];
strcpy(_filename, filename);
- if (FAILED(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing LAYER file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing LAYER file '%s'", filename);
delete [] buffer;
@@ -99,7 +99,7 @@ TOKEN_DEF(CLOSE_UP)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdLayer::loadBuffer(byte *buffer, bool complete) {
+ERRORCODE CAdLayer::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(LAYER)
TOKEN_TABLE(TEMPLATE)
@@ -125,7 +125,7 @@ HRESULT CAdLayer::loadBuffer(byte *buffer, bool complete) {
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_LAYER) {
Game->LOG(0, "'LAYER' keyword expected.");
- return E_FAIL;
+ return STATUS_FAILED;
}
buffer = params;
}
@@ -133,7 +133,7 @@ HRESULT CAdLayer::loadBuffer(byte *buffer, bool complete) {
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
- if (FAILED(loadFile((char *)params))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(loadFile((char *)params))) cmd = PARSERR_GENERIC;
break;
case TOKEN_NAME:
@@ -167,7 +167,7 @@ HRESULT CAdLayer::loadBuffer(byte *buffer, bool complete) {
case TOKEN_REGION: {
CAdRegion *region = new CAdRegion(Game);
CAdSceneNode *node = new CAdSceneNode(Game);
- if (!region || !node || FAILED(region->loadBuffer(params, false))) {
+ if (!region || !node || DID_FAIL(region->loadBuffer(params, false))) {
cmd = PARSERR_GENERIC;
delete region;
delete node;
@@ -184,7 +184,7 @@ HRESULT CAdLayer::loadBuffer(byte *buffer, bool complete) {
CAdEntity *entity = new CAdEntity(Game);
CAdSceneNode *node = new CAdSceneNode(Game);
if (entity) entity->_zoomable = false; // scene entites default to NOT zoom
- if (!entity || !node || FAILED(entity->loadBuffer(params, false))) {
+ if (!entity || !node || DID_FAIL(entity->loadBuffer(params, false))) {
cmd = PARSERR_GENERIC;
delete entity;
delete node;
@@ -216,17 +216,17 @@ HRESULT CAdLayer::loadBuffer(byte *buffer, bool complete) {
}
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in LAYER definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdLayer::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CAdLayer::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// GetNode
//////////////////////////////////////////////////////////////////////////
@@ -259,7 +259,7 @@ HRESULT CAdLayer::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
stack->pushNULL();
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -282,7 +282,7 @@ HRESULT CAdLayer::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
stack->pushNative(entity, true);
}
_nodes.Add(node);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -309,7 +309,7 @@ HRESULT CAdLayer::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
if (index <= _nodes.GetSize() - 1) _nodes.InsertAt(index, node);
else _nodes.Add(node);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -336,7 +336,7 @@ HRESULT CAdLayer::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
}
if (toDelete == NULL) {
stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
for (int i = 0; i < _nodes.GetSize(); i++) {
@@ -348,7 +348,7 @@ HRESULT CAdLayer::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
}
}
stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
else return CBObject::scCallMethod(script, stack, thisStack, name);
@@ -420,13 +420,13 @@ CScValue *CAdLayer::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdLayer::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CAdLayer::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
// Name
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "Name") == 0) {
setName(value->getString());
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -434,7 +434,7 @@ HRESULT CAdLayer::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "CloseUp") == 0) {
_closeUp = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -443,7 +443,7 @@ HRESULT CAdLayer::scSetProperty(const char *name, CScValue *value) {
else if (strcmp(name, "Width") == 0) {
_width = value->getInt();
if (_width < 0) _width = 0;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -452,7 +452,7 @@ HRESULT CAdLayer::scSetProperty(const char *name, CScValue *value) {
else if (strcmp(name, "Height") == 0) {
_height = value->getInt();
if (_height < 0) _height = 0;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -463,7 +463,7 @@ HRESULT CAdLayer::scSetProperty(const char *name, CScValue *value) {
if (b == false && _main) {
Game->LOG(0, "Warning: cannot deactivate scene's main layer");
} else _active = b;
- return S_OK;
+ return STATUS_OK;
}
else return CBObject::scSetProperty(name, value);
@@ -477,7 +477,7 @@ const char *CAdLayer::scToString() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdLayer::saveAsText(CBDynBuffer *buffer, int indent) {
+ERRORCODE CAdLayer::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "LAYER {\n");
buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", _name);
buffer->putTextIndent(indent + 2, "CAPTION=\"%s\"\n", getCaption());
@@ -515,12 +515,12 @@ HRESULT CAdLayer::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "}\n\n");
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdLayer::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CAdLayer::persist(CBPersistMgr *persistMgr) {
CBObject::persist(persistMgr);
@@ -531,7 +531,7 @@ HRESULT CAdLayer::persist(CBPersistMgr *persistMgr) {
_nodes.persist(persistMgr);
persistMgr->transfer(TMEMBER(_width));
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Ad/AdLayer.h b/engines/wintermute/Ad/AdLayer.h
index 1090d253e1..29df4c0c34 100644
--- a/engines/wintermute/Ad/AdLayer.h
+++ b/engines/wintermute/Ad/AdLayer.h
@@ -42,14 +42,14 @@ public:
CAdLayer(CBGame *inGame);
virtual ~CAdLayer();
CBArray<CAdSceneNode *, CAdSceneNode *> _nodes;
- HRESULT loadFile(const char *filename);
- HRESULT loadBuffer(byte *buffer, bool complete = true);
- virtual HRESULT saveAsText(CBDynBuffer *buffer, int indent);
+ ERRORCODE loadFile(const char *filename);
+ ERRORCODE loadBuffer(byte *buffer, bool complete = true);
+ virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent);
// scripting interface
virtual CScValue *scGetProperty(const char *name);
- virtual HRESULT scSetProperty(const char *name, CScValue *value);
- virtual HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ERRORCODE scSetProperty(const char *name, CScValue *value);
+ virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
virtual const char *scToString();
};
diff --git a/engines/wintermute/Ad/AdNodeState.cpp b/engines/wintermute/Ad/AdNodeState.cpp
index 954c12c9fc..7c190285ae 100644
--- a/engines/wintermute/Ad/AdNodeState.cpp
+++ b/engines/wintermute/Ad/AdNodeState.cpp
@@ -92,7 +92,7 @@ void CAdNodeState::setCursor(const char *filename) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdNodeState::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CAdNodeState::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(Game));
persistMgr->transfer(TMEMBER(_active));
@@ -102,7 +102,7 @@ HRESULT CAdNodeState::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(_alphaColor));
for (int i = 0; i < 7; i++) persistMgr->transfer(TMEMBER(_caption[i]));
- return S_OK;
+ return STATUS_OK;
}
@@ -129,8 +129,8 @@ char *CAdNodeState::getCaption(int caseVal) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdNodeState::transferEntity(CAdEntity *entity, bool includingSprites, bool saving) {
- if (!entity) return E_FAIL;
+ERRORCODE CAdNodeState::transferEntity(CAdEntity *entity, bool includingSprites, bool saving) {
+ if (!entity) return STATUS_FAILED;
// hack!
if (this->Game != entity->Game) this->Game = entity->Game;
@@ -163,7 +163,7 @@ HRESULT CAdNodeState::transferEntity(CAdEntity *entity, bool includingSprites, b
entity->_alphaColor = _alphaColor;
}
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Ad/AdNodeState.h b/engines/wintermute/Ad/AdNodeState.h
index a5456b3407..fcd1f1402b 100644
--- a/engines/wintermute/Ad/AdNodeState.h
+++ b/engines/wintermute/Ad/AdNodeState.h
@@ -35,7 +35,7 @@ class CAdEntity;
class CAdNodeState : public CBBase {
public:
- HRESULT transferEntity(CAdEntity *entity, bool includingSprites, bool saving);
+ ERRORCODE transferEntity(CAdEntity *entity, bool includingSprites, bool saving);
void setName(const char *name);
void setFilename(const char *filename);
void setCursor(const char *filename);
diff --git a/engines/wintermute/Ad/AdObject.cpp b/engines/wintermute/Ad/AdObject.cpp
index cdb84a35da..038cacefad 100644
--- a/engines/wintermute/Ad/AdObject.cpp
+++ b/engines/wintermute/Ad/AdObject.cpp
@@ -151,16 +151,16 @@ CAdObject::~CAdObject() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdObject::playAnim(const char *filename) {
+ERRORCODE CAdObject::playAnim(const char *filename) {
delete _animSprite;
_animSprite = NULL;
_animSprite = new CBSprite(Game, this);
if (!_animSprite) {
Game->LOG(0, "CAdObject::PlayAnim: error creating temp sprite (object:\"%s\" sprite:\"%s\")", _name, filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
- HRESULT res = _animSprite->loadFile(filename);
- if (FAILED(res)) {
+ ERRORCODE res = _animSprite->loadFile(filename);
+ if (DID_FAIL(res)) {
Game->LOG(res, "CAdObject::PlayAnim: error loading temp sprite (object:\"%s\" sprite:\"%s\")", _name, filename);
delete _animSprite;
_animSprite = NULL;
@@ -168,38 +168,38 @@ HRESULT CAdObject::playAnim(const char *filename) {
}
_state = STATE_PLAYING_ANIM;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdObject::display() {
- return S_OK;
+ERRORCODE CAdObject::display() {
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdObject::update() {
- return S_OK;
+ERRORCODE CAdObject::update() {
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// PlayAnim / PlayAnimAsync
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "PlayAnim") == 0 || strcmp(name, "PlayAnimAsync") == 0) {
stack->correctParams(1);
- if (FAILED(playAnim(stack->pop()->getString()))) stack->pushBool(false);
+ if (DID_FAIL(playAnim(stack->pop()->getString()))) stack->pushBool(false);
else {
if (strcmp(name, "PlayAnimAsync") != 0) script->waitFor(this);
stack->pushBool(true);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -209,7 +209,7 @@ HRESULT CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
stack->correctParams(0);
reset();
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -218,7 +218,7 @@ HRESULT CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
else if (strcmp(name, "IsTalking") == 0) {
stack->correctParams(0);
stack->pushBool(_state == STATE_TALKING);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -232,7 +232,7 @@ HRESULT CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
_nextState = STATE_READY;
stack->pushBool(true);
} else stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -246,7 +246,7 @@ HRESULT CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
strcpy(_forcedTalkAnimName, animName);
_forcedTalkAnimUsed = false;
stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
@@ -276,7 +276,7 @@ HRESULT CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
if (strcmp(name, "TalkAsync") != 0) script->waitForExclusive(this);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -317,7 +317,7 @@ HRESULT CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
if (!regFound) _stickRegion = NULL;
stack->pushBool(regFound);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -331,7 +331,7 @@ HRESULT CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
else SetFont(val->getString());
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -341,7 +341,7 @@ HRESULT CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
stack->correctParams(0);
if (_font && _font->_filename) stack->pushString(_font->_filename);
else stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -360,7 +360,7 @@ HRESULT CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
const char *itemName = val->getString();
val = stack->pop();
const char *insertAfter = val->isNULL() ? NULL : val->getString();
- if (FAILED(_inventory->insertItem(itemName, insertAfter))) script->runtimeError("Cannot add item '%s' to inventory", itemName);
+ if (DID_FAIL(_inventory->insertItem(itemName, insertAfter))) script->runtimeError("Cannot add item '%s' to inventory", itemName);
else {
// hide associated entities
((CAdGame *)Game)->_scene->handleItemAssociations(itemName, false);
@@ -369,7 +369,7 @@ HRESULT CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
} else script->runtimeError("TakeItem: item name expected");
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -385,7 +385,7 @@ HRESULT CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
CScValue *val = stack->pop();
if (!val->isNULL()) {
- if (FAILED(_inventory->removeItem(val->getString()))) script->runtimeError("Cannot remove item '%s' from inventory", val->getString());
+ if (DID_FAIL(_inventory->removeItem(val->getString()))) script->runtimeError("Cannot remove item '%s' from inventory", val->getString());
else {
// show associated entities
((CAdGame *)Game)->_scene->handleItemAssociations(val->getString(), true);
@@ -393,7 +393,7 @@ HRESULT CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
} else script->runtimeError("DropItem: item name expected");
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -417,7 +417,7 @@ HRESULT CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
else
stack->pushNative(_inventory->_takenItems[val->getInt()], true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -436,16 +436,16 @@ HRESULT CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
for (int i = 0; i < _inventory->_takenItems.GetSize(); i++) {
if (val->getNative() == _inventory->_takenItems[i]) {
stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
} else if (scumm_stricmp(val->getString(), _inventory->_takenItems[i]->_name) == 0) {
stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
}
} else script->runtimeError("HasItem: item name expected");
stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -461,7 +461,7 @@ HRESULT CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
if (emitter) stack->pushNative(_partEmitter, true);
else stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -475,7 +475,7 @@ HRESULT CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
}
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -488,9 +488,9 @@ HRESULT CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
int offsetX = stack->pop()->getInt();
int offsetY = stack->pop()->getInt();
- HRESULT res;
+ ERRORCODE res;
CAdEntity *ent = new CAdEntity(Game);
- if (FAILED(res = ent->loadFile(filename))) {
+ if (DID_FAIL(res = ent->loadFile(filename))) {
delete ent;
ent = NULL;
script->runtimeError("AddAttachment() failed loading entity '%s'", filename);
@@ -508,7 +508,7 @@ HRESULT CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
stack->pushBool(true);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -557,7 +557,7 @@ HRESULT CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
}
stack->pushBool(found);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -600,7 +600,7 @@ HRESULT CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
if (ret != NULL) stack->pushNative(ret, true);
else stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
else return CBObject::scCallMethod(script, stack, thisStack, name);
@@ -715,14 +715,14 @@ CScValue *CAdObject::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdObject::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CAdObject::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
// Active
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "Active") == 0) {
_active = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -730,7 +730,7 @@ HRESULT CAdObject::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "IgnoreItems") == 0) {
_ignoreItems = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -738,7 +738,7 @@ HRESULT CAdObject::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SceneIndependent") == 0) {
_sceneIndependent = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -746,7 +746,7 @@ HRESULT CAdObject::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SubtitlesWidth") == 0) {
_subtitlesWidth = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -754,7 +754,7 @@ HRESULT CAdObject::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SubtitlesPosRelative") == 0) {
_subtitlesModRelative = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -762,7 +762,7 @@ HRESULT CAdObject::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SubtitlesPosX") == 0) {
_subtitlesModX = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -770,7 +770,7 @@ HRESULT CAdObject::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SubtitlesPosY") == 0) {
_subtitlesModY = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -778,7 +778,7 @@ HRESULT CAdObject::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SubtitlesPosXCenter") == 0) {
_subtitlesModXCenter = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
else return CBObject::scSetProperty(name, value);
@@ -792,14 +792,14 @@ const char *CAdObject::scToString() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdObject::SetFont(const char *filename) {
+ERRORCODE CAdObject::SetFont(const char *filename) {
if (_font) Game->_fontStorage->removeFont(_font);
if (filename) {
_font = Game->_fontStorage->addFont(filename);
- return _font == NULL ? E_FAIL : S_OK;
+ return _font == NULL ? STATUS_FAILED : STATUS_OK;
} else {
_font = NULL;
- return S_OK;
+ return STATUS_OK;
}
}
@@ -862,7 +862,7 @@ void CAdObject::talk(const char *text, const char *sound, uint32 duration, const
// load sound and set duration appropriately
if (sound) {
CBSound *snd = new CBSound(Game);
- if (snd && SUCCEEDED(snd->setSound(sound, SOUND_SPEECH, true))) {
+ if (snd && DID_SUCCEED(snd->setSound(sound, SOUND_SPEECH, true))) {
_sentence->setSound(snd);
if (_sentence->_duration <= 0) {
uint32 Length = snd->getLength();
@@ -936,7 +936,7 @@ void CAdObject::talk(const char *text, const char *sound, uint32 duration, const
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdObject::reset() {
+ERRORCODE CAdObject::reset() {
if (_state == STATE_PLAYING_ANIM && _animSprite != NULL) {
delete _animSprite;
_animSprite = NULL;
@@ -948,12 +948,12 @@ HRESULT CAdObject::reset() {
Game->_scEngine->resetObject(this);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdObject::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CAdObject::persist(CBPersistMgr *persistMgr) {
CBObject::persist(persistMgr);
persistMgr->transfer(TMEMBER(_active));
@@ -993,12 +993,12 @@ HRESULT CAdObject::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(_partOffsetX));
persistMgr->transfer(TMEMBER(_partOffsetY));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdObject::updateSounds() {
+ERRORCODE CAdObject::updateSounds() {
if (_sentence && _sentence->_sound)
updateOneSound(_sentence->_sound);
@@ -1007,7 +1007,7 @@ HRESULT CAdObject::updateSounds() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdObject::resetSoundPan() {
+ERRORCODE CAdObject::resetSoundPan() {
if (_sentence && _sentence->_sound) {
_sentence->_sound->setPan(0.0f);
}
@@ -1025,18 +1025,18 @@ bool CAdObject::getExtendedFlag(const char *flagName) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdObject::saveAsText(CBDynBuffer *buffer, int indent) {
+ERRORCODE CAdObject::saveAsText(CBDynBuffer *buffer, int indent) {
if (_blockRegion) _blockRegion->saveAsText(buffer, indent + 2, "BLOCKED_REGION");
if (_wptGroup) _wptGroup->saveAsText(buffer, indent + 2);
CBBase::saveAsText(buffer, indent + 2);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdObject::updateBlockRegion() {
+ERRORCODE CAdObject::updateBlockRegion() {
CAdGame *adGame = (CAdGame *)Game;
if (adGame->_scene) {
if (_blockRegion && _currentBlockRegion)
@@ -1045,7 +1045,7 @@ HRESULT CAdObject::updateBlockRegion() {
if (_wptGroup && _currentWptGroup)
_currentWptGroup->mimic(_wptGroup, _zoomable ? adGame->_scene->getScaleAt(_posY) : 100.0f, _posX, _posY);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1059,7 +1059,7 @@ CAdInventory *CAdObject::getInventory() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdObject::afterMove() {
+ERRORCODE CAdObject::afterMove() {
CAdRegion *newRegions[MAX_NUM_REGIONS];
((CAdGame *)Game)->_scene->getRegionsAt(_posX, _posY, newRegions, MAX_NUM_REGIONS);
@@ -1083,18 +1083,18 @@ HRESULT CAdObject::afterMove() {
_currentRegions[i] = newRegions[i];
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdObject::invalidateCurrRegions() {
+ERRORCODE CAdObject::invalidateCurrRegions() {
for (int i = 0; i < MAX_NUM_REGIONS; i++) _currentRegions[i] = NULL;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdObject::getScale(float *scaleX, float *scaleY) {
+ERRORCODE CAdObject::getScale(float *scaleX, float *scaleY) {
if (_zoomable) {
if (_scaleX >= 0 || _scaleY >= 0) {
*scaleX = _scaleX < 0 ? 100 : _scaleX;
@@ -1104,22 +1104,22 @@ HRESULT CAdObject::getScale(float *scaleX, float *scaleY) {
} else {
*scaleX = *scaleY = 100;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdObject::updateSpriteAttachments() {
+ERRORCODE CAdObject::updateSpriteAttachments() {
for (int i = 0; i < _attachmentsPre.GetSize(); i++) {
_attachmentsPre[i]->update();
}
for (int i = 0; i < _attachmentsPost.GetSize(); i++) {
_attachmentsPost[i]->update();
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdObject::displaySpriteAttachments(bool preDisplay) {
+ERRORCODE CAdObject::displaySpriteAttachments(bool preDisplay) {
if (preDisplay) {
for (int i = 0; i < _attachmentsPre.GetSize(); i++) {
displaySpriteAttachment(_attachmentsPre[i]);
@@ -1129,12 +1129,12 @@ HRESULT CAdObject::displaySpriteAttachments(bool preDisplay) {
displaySpriteAttachment(_attachmentsPost[i]);
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdObject::displaySpriteAttachment(CAdObject *attachment) {
- if (!attachment->_active) return S_OK;
+ERRORCODE CAdObject::displaySpriteAttachment(CAdObject *attachment) {
+ if (!attachment->_active) return STATUS_OK;
float scaleX, scaleY;
getScale(&scaleX, &scaleY);
@@ -1162,7 +1162,7 @@ HRESULT CAdObject::displaySpriteAttachment(CAdObject *attachment) {
attachment->_registerAlias = this;
attachment->_registrable = this->_registrable;
- HRESULT ret = attachment->display();
+ ERRORCODE ret = attachment->display();
attachment->_posX = origX;
attachment->_posY = origY;
@@ -1187,8 +1187,8 @@ CPartEmitter *CAdObject::createParticleEmitter(bool followParent, int offsetX, i
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdObject::updatePartEmitter() {
- if (!_partEmitter) return E_FAIL;
+ERRORCODE CAdObject::updatePartEmitter() {
+ if (!_partEmitter) return STATUS_FAILED;
if (_partFollowParent) {
float scaleX, scaleY;
diff --git a/engines/wintermute/Ad/AdObject.h b/engines/wintermute/Ad/AdObject.h
index def28eff1d..c71efce1a5 100644
--- a/engines/wintermute/Ad/AdObject.h
+++ b/engines/wintermute/Ad/AdObject.h
@@ -47,12 +47,12 @@ class CAdObject : public CBObject {
public:
CPartEmitter *_partEmitter;
virtual CPartEmitter *createParticleEmitter(bool followParent = false, int offsetX = 0, int offsetY = 0);
- virtual HRESULT updatePartEmitter();
+ virtual ERRORCODE updatePartEmitter();
bool _partFollowParent;
int _partOffsetX;
int _partOffsetY;
- HRESULT invalidateCurrRegions();
+ ERRORCODE invalidateCurrRegions();
bool _subtitlesModRelative;
bool _subtitlesModXCenter;
int _subtitlesModX;
@@ -61,23 +61,23 @@ public:
CAdRegion *_stickRegion;
bool _sceneIndependent;
bool _ignoreItems;
- HRESULT updateBlockRegion();
+ ERRORCODE updateBlockRegion();
bool _forcedTalkAnimUsed;
char *_forcedTalkAnimName;
virtual bool getExtendedFlag(const char *flagName);
- virtual HRESULT resetSoundPan();
- virtual HRESULT updateSounds();
- HRESULT reset();
+ virtual ERRORCODE resetSoundPan();
+ virtual ERRORCODE updateSounds();
+ ERRORCODE reset();
DECLARE_PERSISTENT(CAdObject, CBObject)
virtual void talk(const char *text, const char *sound = NULL, uint32 duration = 0, const char *stances = NULL, TTextAlign align = TAL_CENTER);
virtual int getHeight();
CAdSentence *_sentence;
- HRESULT SetFont(const char *filename);
- virtual HRESULT update();
- virtual HRESULT display();
+ ERRORCODE SetFont(const char *filename);
+ virtual ERRORCODE update();
+ virtual ERRORCODE display();
bool _drawn;
bool _active;
- virtual HRESULT playAnim(const char *filename);
+ virtual ERRORCODE playAnim(const char *filename);
CBSprite *_animSprite;
CBSprite *_currentSprite;
TObjectState _state;
@@ -93,29 +93,29 @@ public:
CAdWaypointGroup *_currentWptGroup;
CAdInventory *getInventory();
- virtual HRESULT saveAsText(CBDynBuffer *buffer, int indent);
+ virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent);
- virtual HRESULT afterMove();
+ virtual ERRORCODE afterMove();
CAdRegion *_currentRegions[MAX_NUM_REGIONS];
// scripting interface
virtual CScValue *scGetProperty(const char *name);
- virtual HRESULT scSetProperty(const char *name, CScValue *value);
- virtual HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ERRORCODE scSetProperty(const char *name, CScValue *value);
+ virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
virtual const char *scToString();
CBArray<CAdObject *, CAdObject *> _attachmentsPre;
CBArray<CAdObject *, CAdObject *> _attachmentsPost;
- HRESULT updateSpriteAttachments();
- HRESULT displaySpriteAttachments(bool preDisplay);
+ ERRORCODE updateSpriteAttachments();
+ ERRORCODE displaySpriteAttachments(bool preDisplay);
CAdObject *_registerAlias;
private:
- HRESULT displaySpriteAttachment(CAdObject *attachment);
+ ERRORCODE displaySpriteAttachment(CAdObject *attachment);
CAdInventory *_inventory;
protected:
- HRESULT getScale(float *scaleX, float *scaleY);
+ ERRORCODE getScale(float *scaleX, float *scaleY);
};
} // end of namespace WinterMute
diff --git a/engines/wintermute/Ad/AdPath.cpp b/engines/wintermute/Ad/AdPath.cpp
index ca7adf0461..bac9681cef 100644
--- a/engines/wintermute/Ad/AdPath.cpp
+++ b/engines/wintermute/Ad/AdPath.cpp
@@ -98,7 +98,7 @@ bool CAdPath::setReady(bool ready) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdPath::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CAdPath::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(Game));
@@ -106,7 +106,7 @@ HRESULT CAdPath::persist(CBPersistMgr *persistMgr) {
_points.persist(persistMgr);
persistMgr->transfer(TMEMBER(_ready));
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Ad/AdPathPoint.cpp b/engines/wintermute/Ad/AdPathPoint.cpp
index 4f82f8e7f4..17c2e41fb1 100644
--- a/engines/wintermute/Ad/AdPathPoint.cpp
+++ b/engines/wintermute/Ad/AdPathPoint.cpp
@@ -61,7 +61,7 @@ CAdPathPoint::~CAdPathPoint() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdPathPoint::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CAdPathPoint::persist(CBPersistMgr *persistMgr) {
CBPoint::persist(persistMgr);
@@ -69,7 +69,7 @@ HRESULT CAdPathPoint::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(_marked));
persistMgr->transfer(TMEMBER(_origin));
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Ad/AdRegion.cpp b/engines/wintermute/Ad/AdRegion.cpp
index 0ea0bb9ed1..ec6017759a 100644
--- a/engines/wintermute/Ad/AdRegion.cpp
+++ b/engines/wintermute/Ad/AdRegion.cpp
@@ -54,19 +54,19 @@ CAdRegion::~CAdRegion() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdRegion::loadFile(const char *filename) {
+ERRORCODE CAdRegion::loadFile(const char *filename) {
byte *buffer = Game->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
Game->LOG(0, "CAdRegion::LoadFile failed for file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
- HRESULT ret;
+ ERRORCODE ret;
_filename = new char [strlen(filename) + 1];
strcpy(_filename, filename);
- if (FAILED(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing REGION file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing REGION file '%s'", filename);
delete [] buffer;
@@ -95,7 +95,7 @@ TOKEN_DEF(PROPERTY)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdRegion::loadBuffer(byte *buffer, bool complete) {
+ERRORCODE CAdRegion::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(REGION)
TOKEN_TABLE(TEMPLATE)
@@ -123,7 +123,7 @@ HRESULT CAdRegion::loadBuffer(byte *buffer, bool complete) {
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_REGION) {
Game->LOG(0, "'REGION' keyword expected.");
- return E_FAIL;
+ return STATUS_FAILED;
}
buffer = params;
}
@@ -136,7 +136,7 @@ HRESULT CAdRegion::loadBuffer(byte *buffer, bool complete) {
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
- if (FAILED(loadFile((char *)params))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(loadFile((char *)params))) cmd = PARSERR_GENERIC;
break;
case TOKEN_NAME:
@@ -205,21 +205,21 @@ HRESULT CAdRegion::loadBuffer(byte *buffer, bool complete) {
}
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in REGION definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
createRegion();
- _alpha = DRGBA(ar, ag, ab, alpha);
+ _alpha = BYTETORGBA(ar, ag, ab, alpha);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdRegion::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CAdRegion::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
/*
//////////////////////////////////////////////////////////////////////////
// SkipTo
@@ -230,7 +230,7 @@ HRESULT CAdRegion::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
_posY = stack->pop()->getInt();
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
else*/ return CBRegion::scCallMethod(script, stack, thisStack, name);
@@ -294,13 +294,13 @@ CScValue *CAdRegion::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdRegion::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CAdRegion::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
// Name
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "Name") == 0) {
setName(value->getString());
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -308,7 +308,7 @@ HRESULT CAdRegion::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Blocked") == 0) {
_blocked = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -316,7 +316,7 @@ HRESULT CAdRegion::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Decoration") == 0) {
_decoration = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -324,7 +324,7 @@ HRESULT CAdRegion::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Scale") == 0) {
_zoom = value->getFloat();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -332,7 +332,7 @@ HRESULT CAdRegion::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "AlphaColor") == 0) {
_alpha = (uint32)value->getInt();
- return S_OK;
+ return STATUS_OK;
}
else return CBRegion::scSetProperty(name, value);
@@ -346,7 +346,7 @@ const char *CAdRegion::scToString() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdRegion::saveAsText(CBDynBuffer *buffer, int indent) {
+ERRORCODE CAdRegion::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "REGION {\n");
buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", _name);
buffer->putTextIndent(indent + 2, "CAPTION=\"%s\"\n", getCaption());
@@ -354,8 +354,8 @@ HRESULT CAdRegion::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent + 2, "DECORATION=%s\n", _decoration ? "TRUE" : "FALSE");
buffer->putTextIndent(indent + 2, "ACTIVE=%s\n", _active ? "TRUE" : "FALSE");
buffer->putTextIndent(indent + 2, "SCALE=%d\n", (int)_zoom);
- buffer->putTextIndent(indent + 2, "ALPHA_COLOR { %d,%d,%d }\n", D3DCOLGetR(_alpha), D3DCOLGetG(_alpha), D3DCOLGetB(_alpha));
- buffer->putTextIndent(indent + 2, "ALPHA = %d\n", D3DCOLGetA(_alpha));
+ buffer->putTextIndent(indent + 2, "ALPHA_COLOR { %d,%d,%d }\n", RGBCOLGetR(_alpha), RGBCOLGetG(_alpha), RGBCOLGetB(_alpha));
+ buffer->putTextIndent(indent + 2, "ALPHA = %d\n", RGBCOLGetA(_alpha));
buffer->putTextIndent(indent + 2, "EDITOR_SELECTED=%s\n", _editorSelected ? "TRUE" : "FALSE");
int i;
@@ -373,12 +373,12 @@ HRESULT CAdRegion::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "}\n\n");
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdRegion::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CAdRegion::persist(CBPersistMgr *persistMgr) {
CBRegion::persist(persistMgr);
persistMgr->transfer(TMEMBER(_alpha));
@@ -386,7 +386,7 @@ HRESULT CAdRegion::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(_decoration));
persistMgr->transfer(TMEMBER(_zoom));
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Ad/AdRegion.h b/engines/wintermute/Ad/AdRegion.h
index 0e5700828a..2b8d13b587 100644
--- a/engines/wintermute/Ad/AdRegion.h
+++ b/engines/wintermute/Ad/AdRegion.h
@@ -42,14 +42,14 @@ public:
bool _decoration;
CAdRegion(CBGame *inGame);
virtual ~CAdRegion();
- HRESULT loadFile(const char *filename);
- HRESULT loadBuffer(byte *buffer, bool complete = true);
- virtual HRESULT saveAsText(CBDynBuffer *buffer, int indent);
+ ERRORCODE loadFile(const char *filename);
+ ERRORCODE loadBuffer(byte *buffer, bool complete = true);
+ virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent);
// scripting interface
virtual CScValue *scGetProperty(const char *name);
- virtual HRESULT scSetProperty(const char *name, CScValue *value);
- virtual HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ERRORCODE scSetProperty(const char *name, CScValue *value);
+ virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
virtual const char *scToString();
};
diff --git a/engines/wintermute/Ad/AdResponse.cpp b/engines/wintermute/Ad/AdResponse.cpp
index 320f026863..7c6d3f56c9 100644
--- a/engines/wintermute/Ad/AdResponse.cpp
+++ b/engines/wintermute/Ad/AdResponse.cpp
@@ -72,59 +72,59 @@ void CAdResponse::setText(const char *text) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdResponse::setIcon(const char *filename) {
+ERRORCODE CAdResponse::setIcon(const char *filename) {
delete _icon;
_icon = new CBSprite(Game);
- if (!_icon || FAILED(_icon->loadFile(filename))) {
+ if (!_icon || DID_FAIL(_icon->loadFile(filename))) {
Game->LOG(0, "CAdResponse::setIcon failed for file '%s'", filename);
delete _icon;
_icon = NULL;
- return E_FAIL;
+ return STATUS_FAILED;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdResponse::setFont(const char *filename) {
+ERRORCODE CAdResponse::setFont(const char *filename) {
if (_font) Game->_fontStorage->removeFont(_font);
_font = Game->_fontStorage->addFont(filename);
if (!_font) {
Game->LOG(0, "CAdResponse::setFont failed for file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdResponse::setIconHover(const char *filename) {
+ERRORCODE CAdResponse::setIconHover(const char *filename) {
delete _iconHover;
_iconHover = new CBSprite(Game);
- if (!_iconHover || FAILED(_iconHover->loadFile(filename))) {
+ if (!_iconHover || DID_FAIL(_iconHover->loadFile(filename))) {
Game->LOG(0, "CAdResponse::setIconHover failed for file '%s'", filename);
delete _iconHover;
_iconHover = NULL;
- return E_FAIL;
+ return STATUS_FAILED;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdResponse::setIconPressed(const char *filename) {
+ERRORCODE CAdResponse::setIconPressed(const char *filename) {
delete _iconPressed;
_iconPressed = new CBSprite(Game);
- if (!_iconPressed || FAILED(_iconPressed->loadFile(filename))) {
+ if (!_iconPressed || DID_FAIL(_iconPressed->loadFile(filename))) {
Game->LOG(0, "CAdResponse::setIconPressed failed for file '%s'", filename);
delete _iconPressed;
_iconPressed = NULL;
- return E_FAIL;
+ return STATUS_FAILED;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdResponse::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CAdResponse::persist(CBPersistMgr *persistMgr) {
CBObject::persist(persistMgr);
@@ -137,7 +137,7 @@ HRESULT CAdResponse::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER_INT(_responseType));
persistMgr->transfer(TMEMBER(_font));
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Ad/AdResponse.h b/engines/wintermute/Ad/AdResponse.h
index 8774267a97..46f16ea98f 100644
--- a/engines/wintermute/Ad/AdResponse.h
+++ b/engines/wintermute/Ad/AdResponse.h
@@ -38,10 +38,10 @@ class CBFont;
class CAdResponse : public CBObject {
public:
DECLARE_PERSISTENT(CAdResponse, CBObject)
- HRESULT setIcon(const char *filename);
- HRESULT setFont(const char *filename);
- HRESULT setIconHover(const char *filename);
- HRESULT setIconPressed(const char *filename);
+ ERRORCODE setIcon(const char *filename);
+ ERRORCODE setFont(const char *filename);
+ ERRORCODE setIconHover(const char *filename);
+ ERRORCODE setIconPressed(const char *filename);
void setText(const char *text);
int _iD;
CBSprite *_icon;
diff --git a/engines/wintermute/Ad/AdResponseBox.cpp b/engines/wintermute/Ad/AdResponseBox.cpp
index eea61a4268..0eeadd72bc 100644
--- a/engines/wintermute/Ad/AdResponseBox.cpp
+++ b/engines/wintermute/Ad/AdResponseBox.cpp
@@ -111,7 +111,7 @@ void CAdResponseBox::clearButtons() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdResponseBox::invalidateButtons() {
+ERRORCODE CAdResponseBox::invalidateButtons() {
for (int i = 0; i < _respButtons.GetSize(); i++) {
_respButtons[i]->_image = NULL;
_respButtons[i]->_cursor = NULL;
@@ -120,12 +120,12 @@ HRESULT CAdResponseBox::invalidateButtons() {
_respButtons[i]->_fontPress = NULL;
_respButtons[i]->setText("");
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdResponseBox::createButtons() {
+ERRORCODE CAdResponseBox::createButtons() {
clearButtons();
_scrollOffset = 0;
@@ -182,24 +182,24 @@ HRESULT CAdResponseBox::createButtons() {
}
_ready = false;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdResponseBox::loadFile(const char *filename) {
+ERRORCODE CAdResponseBox::loadFile(const char *filename) {
byte *buffer = Game->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
Game->LOG(0, "CAdResponseBox::LoadFile failed for file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
- HRESULT ret;
+ ERRORCODE ret;
_filename = new char [strlen(filename) + 1];
strcpy(_filename, filename);
- if (FAILED(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing RESPONSE_BOX file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing RESPONSE_BOX file '%s'", filename);
delete [] buffer;
@@ -223,7 +223,7 @@ TOKEN_DEF(VERTICAL_ALIGN)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdResponseBox::loadBuffer(byte *buffer, bool complete) {
+ERRORCODE CAdResponseBox::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(RESPONSE_BOX)
TOKEN_TABLE(TEMPLATE)
@@ -247,7 +247,7 @@ HRESULT CAdResponseBox::loadBuffer(byte *buffer, bool complete) {
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_RESPONSE_BOX) {
Game->LOG(0, "'RESPONSE_BOX' keyword expected.");
- return E_FAIL;
+ return STATUS_FAILED;
}
buffer = params;
}
@@ -255,13 +255,13 @@ HRESULT CAdResponseBox::loadBuffer(byte *buffer, bool complete) {
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
- if (FAILED(loadFile((char *)params))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(loadFile((char *)params))) cmd = PARSERR_GENERIC;
break;
case TOKEN_WINDOW:
delete _window;
_window = new CUIWindow(Game);
- if (!_window || FAILED(_window->loadBuffer(params, false))) {
+ if (!_window || DID_FAIL(_window->loadBuffer(params, false))) {
delete _window;
_window = NULL;
cmd = PARSERR_GENERIC;
@@ -311,7 +311,7 @@ HRESULT CAdResponseBox::loadBuffer(byte *buffer, bool complete) {
case TOKEN_CURSOR:
delete _cursor;
_cursor = new CBSprite(Game);
- if (!_cursor || FAILED(_cursor->loadFile((char *)params))) {
+ if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
delete _cursor;
_cursor = NULL;
cmd = PARSERR_GENERIC;
@@ -321,7 +321,7 @@ HRESULT CAdResponseBox::loadBuffer(byte *buffer, bool complete) {
}
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in RESPONSE_BOX definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (_window) {
@@ -331,11 +331,11 @@ HRESULT CAdResponseBox::loadBuffer(byte *buffer, bool complete) {
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdResponseBox::saveAsText(CBDynBuffer *buffer, int indent) {
+ERRORCODE CAdResponseBox::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "RESPONSE_BOX\n");
buffer->putTextIndent(indent, "{\n");
@@ -391,12 +391,12 @@ HRESULT CAdResponseBox::saveAsText(CBDynBuffer *buffer, int indent) {
CBBase::saveAsText(buffer, indent + 2);
buffer->putTextIndent(indent, "}\n");
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdResponseBox::display() {
+ERRORCODE CAdResponseBox::display() {
RECT rect = _responseArea;
if (_window) {
CBPlatform::offsetRect(&rect, _window->_posX, _window->_posY);
@@ -477,12 +477,12 @@ HRESULT CAdResponseBox::display() {
_respButtons[i]->display();
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdResponseBox::listen(CBScriptHolder *param1, uint32 param2) {
+ERRORCODE CAdResponseBox::listen(CBScriptHolder *param1, uint32 param2) {
CUIObject *obj = (CUIObject *)param1;
switch (obj->_type) {
@@ -506,12 +506,12 @@ HRESULT CAdResponseBox::listen(CBScriptHolder *param1, uint32 param2) {
error("AdResponseBox::Listen - Unhandled enum");
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdResponseBox::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CAdResponseBox::persist(CBPersistMgr *persistMgr) {
CBObject::persist(persistMgr);
persistMgr->transfer(TMEMBER(_font));
@@ -531,12 +531,12 @@ HRESULT CAdResponseBox::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER_INT(_verticalAlign));
persistMgr->transfer(TMEMBER_INT(_align));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdResponseBox::weedResponses() {
+ERRORCODE CAdResponseBox::weedResponses() {
CAdGame *adGame = (CAdGame *)Game;
for (int i = 0; i < _responses.GetSize(); i++) {
@@ -561,7 +561,7 @@ HRESULT CAdResponseBox::weedResponses() {
break;
}
}
- return S_OK;
+ return STATUS_OK;
}
@@ -573,7 +573,7 @@ void CAdResponseBox::setLastResponseText(const char *text, const char *textOrig)
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdResponseBox::handleResponse(CAdResponse *response) {
+ERRORCODE CAdResponseBox::handleResponse(CAdResponse *response) {
setLastResponseText(response->_text, response->_textOrig);
CAdGame *adGame = (CAdGame *)Game;
@@ -590,7 +590,7 @@ HRESULT CAdResponseBox::handleResponse(CAdResponse *response) {
warning("CAdResponseBox::HandleResponse - Unhandled enum");
}
- return S_OK;
+ return STATUS_OK;
}
@@ -635,13 +635,13 @@ CBObject *CAdResponseBox::getPrevAccessObject(CBObject *currObject) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdResponseBox::getObjects(CBArray<CUIObject *, CUIObject *> &objects, bool interactiveOnly) {
+ERRORCODE CAdResponseBox::getObjects(CBArray<CUIObject *, CUIObject *> &objects, bool interactiveOnly) {
for (int i = 0; i < _respButtons.GetSize(); i++) {
objects.Add(_respButtons[i]);
}
if (_window) _window->getWindowObjects(objects, interactiveOnly);
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Ad/AdResponseBox.h b/engines/wintermute/Ad/AdResponseBox.h
index 3d8a8bb7a6..de21921fde 100644
--- a/engines/wintermute/Ad/AdResponseBox.h
+++ b/engines/wintermute/Ad/AdResponseBox.h
@@ -42,29 +42,29 @@ class CAdResponseBox : public CBObject {
public:
CBObject *getNextAccessObject(CBObject *CurrObject);
CBObject *getPrevAccessObject(CBObject *CurrObject);
- HRESULT getObjects(CBArray<CUIObject *, CUIObject *> &objects, bool interactiveOnly);
+ ERRORCODE getObjects(CBArray<CUIObject *, CUIObject *> &objects, bool interactiveOnly);
- HRESULT handleResponse(CAdResponse *response);
+ ERRORCODE handleResponse(CAdResponse *response);
void setLastResponseText(const char *text, const char *textOrig);
char *_lastResponseText;
char *_lastResponseTextOrig;
DECLARE_PERSISTENT(CAdResponseBox, CBObject)
CScScript *_waitingScript;
- virtual HRESULT listen(CBScriptHolder *param1, uint32 param2);
+ virtual ERRORCODE listen(CBScriptHolder *param1, uint32 param2);
typedef enum {
EVENT_PREV,
EVENT_NEXT,
EVENT_RESPONSE
} TResponseEvent;
- HRESULT weedResponses();
- HRESULT display();
+ ERRORCODE weedResponses();
+ ERRORCODE display();
int _spacing;
int _scrollOffset;
CBFont *_fontHover;
CBFont *_font;
- HRESULT createButtons();
- HRESULT invalidateButtons();
+ ERRORCODE createButtons();
+ ERRORCODE invalidateButtons();
void clearButtons();
void clearResponses();
CAdResponseBox(CBGame *inGame);
@@ -77,9 +77,9 @@ public:
RECT _responseArea;
int _verticalAlign;
TTextAlign _align;
- HRESULT loadFile(const char *filename);
- HRESULT loadBuffer(byte *buffer, bool complete = true);
- virtual HRESULT saveAsText(CBDynBuffer *buffer, int indent);
+ ERRORCODE loadFile(const char *filename);
+ ERRORCODE loadBuffer(byte *buffer, bool complete = true);
+ virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent);
};
} // end of namespace WinterMute
diff --git a/engines/wintermute/Ad/AdResponseContext.cpp b/engines/wintermute/Ad/AdResponseContext.cpp
index 60df7734e1..5615777daf 100644
--- a/engines/wintermute/Ad/AdResponseContext.cpp
+++ b/engines/wintermute/Ad/AdResponseContext.cpp
@@ -49,12 +49,12 @@ CAdResponseContext::~CAdResponseContext() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdResponseContext::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CAdResponseContext::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(Game));
persistMgr->transfer(TMEMBER(_context));
persistMgr->transfer(TMEMBER(_iD));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/wintermute/Ad/AdRotLevel.cpp b/engines/wintermute/Ad/AdRotLevel.cpp
index dbe00460dc..26e4bca48d 100644
--- a/engines/wintermute/Ad/AdRotLevel.cpp
+++ b/engines/wintermute/Ad/AdRotLevel.cpp
@@ -53,19 +53,19 @@ CAdRotLevel::~CAdRotLevel() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdRotLevel::loadFile(const char *filename) {
+ERRORCODE CAdRotLevel::loadFile(const char *filename) {
byte *buffer = Game->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
Game->LOG(0, "CAdRotLevel::LoadFile failed for file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
- HRESULT ret;
+ ERRORCODE ret;
_filename = new char [strlen(filename) + 1];
strcpy(_filename, filename);
- if (FAILED(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing ROTATION_LEVEL file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing ROTATION_LEVEL file '%s'", filename);
delete [] buffer;
@@ -82,7 +82,7 @@ TOKEN_DEF(ROTATION)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdRotLevel::loadBuffer(byte *buffer, bool complete) {
+ERRORCODE CAdRotLevel::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(ROTATION_LEVEL)
TOKEN_TABLE(TEMPLATE)
@@ -98,7 +98,7 @@ HRESULT CAdRotLevel::loadBuffer(byte *buffer, bool complete) {
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_ROTATION_LEVEL) {
Game->LOG(0, "'ROTATION_LEVEL' keyword expected.");
- return E_FAIL;
+ return STATUS_FAILED;
}
buffer = params;
}
@@ -106,7 +106,7 @@ HRESULT CAdRotLevel::loadBuffer(byte *buffer, bool complete) {
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
- if (FAILED(loadFile((char *)params))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(loadFile((char *)params))) cmd = PARSERR_GENERIC;
break;
case TOKEN_X:
@@ -127,33 +127,33 @@ HRESULT CAdRotLevel::loadBuffer(byte *buffer, bool complete) {
}
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in ROTATION_LEVEL definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdRotLevel::saveAsText(CBDynBuffer *buffer, int indent) {
+ERRORCODE CAdRotLevel::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "ROTATION_LEVEL {\n");
buffer->putTextIndent(indent + 2, "X=%d\n", _posX);
buffer->putTextIndent(indent + 2, "ROTATION=%d\n", (int)_rotation);
CBBase::saveAsText(buffer, indent + 2);
buffer->putTextIndent(indent, "}\n");
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdRotLevel::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CAdRotLevel::persist(CBPersistMgr *persistMgr) {
CBObject::persist(persistMgr);
persistMgr->transfer(TMEMBER(_rotation));
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Ad/AdRotLevel.h b/engines/wintermute/Ad/AdRotLevel.h
index 3c02cddc34..76e2484b07 100644
--- a/engines/wintermute/Ad/AdRotLevel.h
+++ b/engines/wintermute/Ad/AdRotLevel.h
@@ -39,9 +39,9 @@ public:
CAdRotLevel(CBGame *inGame);
virtual ~CAdRotLevel();
float _rotation;
- virtual HRESULT saveAsText(CBDynBuffer *buffer, int indent);
- HRESULT loadFile(const char *filename);
- HRESULT loadBuffer(byte *buffer, bool complete = true);
+ virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent);
+ ERRORCODE loadFile(const char *filename);
+ ERRORCODE loadBuffer(byte *buffer, bool complete = true);
};
} // end of namespace WinterMute
diff --git a/engines/wintermute/Ad/AdScaleLevel.cpp b/engines/wintermute/Ad/AdScaleLevel.cpp
index d0f1d479b3..2cfbbb05e1 100644
--- a/engines/wintermute/Ad/AdScaleLevel.cpp
+++ b/engines/wintermute/Ad/AdScaleLevel.cpp
@@ -51,19 +51,19 @@ CAdScaleLevel::~CAdScaleLevel() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScaleLevel::loadFile(const char *filename) {
+ERRORCODE CAdScaleLevel::loadFile(const char *filename) {
byte *buffer = Game->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
Game->LOG(0, "CAdScaleLevel::LoadFile failed for file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
- HRESULT ret;
+ ERRORCODE ret;
_filename = new char [strlen(filename) + 1];
strcpy(_filename, filename);
- if (FAILED(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing SCALE_LEVEL file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing SCALE_LEVEL file '%s'", filename);
delete [] buffer;
@@ -80,7 +80,7 @@ TOKEN_DEF(SCALE)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScaleLevel::loadBuffer(byte *buffer, bool complete) {
+ERRORCODE CAdScaleLevel::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(SCALE_LEVEL)
TOKEN_TABLE(TEMPLATE)
@@ -96,7 +96,7 @@ HRESULT CAdScaleLevel::loadBuffer(byte *buffer, bool complete) {
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_SCALE_LEVEL) {
Game->LOG(0, "'SCALE_LEVEL' keyword expected.");
- return E_FAIL;
+ return STATUS_FAILED;
}
buffer = params;
}
@@ -104,7 +104,7 @@ HRESULT CAdScaleLevel::loadBuffer(byte *buffer, bool complete) {
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
- if (FAILED(loadFile((char *)params))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(loadFile((char *)params))) cmd = PARSERR_GENERIC;
break;
case TOKEN_Y:
@@ -125,33 +125,33 @@ HRESULT CAdScaleLevel::loadBuffer(byte *buffer, bool complete) {
}
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in SCALE_LEVEL definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScaleLevel::saveAsText(CBDynBuffer *buffer, int indent) {
+ERRORCODE CAdScaleLevel::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "SCALE_LEVEL {\n");
buffer->putTextIndent(indent + 2, "Y=%d\n", _posY);
buffer->putTextIndent(indent + 2, "SCALE=%d\n", (int)_scale);
CBBase::saveAsText(buffer, indent + 2);
buffer->putTextIndent(indent, "}\n");
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScaleLevel::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CAdScaleLevel::persist(CBPersistMgr *persistMgr) {
CBObject::persist(persistMgr);
persistMgr->transfer(TMEMBER(_scale));
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Ad/AdScaleLevel.h b/engines/wintermute/Ad/AdScaleLevel.h
index 31e67f05d8..b62e18e344 100644
--- a/engines/wintermute/Ad/AdScaleLevel.h
+++ b/engines/wintermute/Ad/AdScaleLevel.h
@@ -40,9 +40,9 @@ public:
float _scale;
CAdScaleLevel(CBGame *inGame);
virtual ~CAdScaleLevel();
- virtual HRESULT saveAsText(CBDynBuffer *buffer, int indent);
- HRESULT loadFile(const char *filename);
- HRESULT loadBuffer(byte *buffer, bool complete = true);
+ virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent);
+ ERRORCODE loadFile(const char *filename);
+ ERRORCODE loadBuffer(byte *buffer, bool complete = true);
};
} // end of namespace WinterMute
diff --git a/engines/wintermute/Ad/AdScene.cpp b/engines/wintermute/Ad/AdScene.cpp
index fe8295abad..9362830a54 100644
--- a/engines/wintermute/Ad/AdScene.cpp
+++ b/engines/wintermute/Ad/AdScene.cpp
@@ -481,7 +481,7 @@ void CAdScene::pathFinderStep() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::initLoop() {
+ERRORCODE CAdScene::initLoop() {
#ifdef _DEBUGxxxx
int nu_steps = 0;
uint32 start = Game->_currentTime;
@@ -495,25 +495,25 @@ HRESULT CAdScene::initLoop() {
while (!_pfReady && CBPlatform::getTime() - start <= _pfMaxTime) pathFinderStep();
#endif
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::loadFile(const char *filename) {
+ERRORCODE CAdScene::loadFile(const char *filename) {
byte *buffer = Game->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
Game->LOG(0, "CAdScene::LoadFile failed for file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
- HRESULT ret;
+ ERRORCODE ret;
delete[] _filename;
_filename = new char [strlen(filename) + 1];
strcpy(_filename, filename);
- if (FAILED(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing SCENE file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing SCENE file '%s'", filename);
_filename = new char [strlen(filename) + 1];
strcpy(_filename, filename);
@@ -565,7 +565,7 @@ TOKEN_DEF(PERSISTENT_STATE)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::loadBuffer(byte *buffer, bool complete) {
+ERRORCODE CAdScene::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(SCENE)
TOKEN_TABLE(TEMPLATE)
@@ -615,7 +615,7 @@ HRESULT CAdScene::loadBuffer(byte *buffer, bool complete) {
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_SCENE) {
Game->LOG(0, "'SCENE' keyword expected.");
- return E_FAIL;
+ return STATUS_FAILED;
}
buffer = params;
}
@@ -627,7 +627,7 @@ HRESULT CAdScene::loadBuffer(byte *buffer, bool complete) {
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
- if (FAILED(loadFile((char *)params))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(loadFile((char *)params))) cmd = PARSERR_GENERIC;
break;
case TOKEN_NAME:
@@ -640,7 +640,7 @@ HRESULT CAdScene::loadBuffer(byte *buffer, bool complete) {
case TOKEN_LAYER: {
CAdLayer *layer = new CAdLayer(Game);
- if (!layer || FAILED(layer->loadBuffer(params, false))) {
+ if (!layer || DID_FAIL(layer->loadBuffer(params, false))) {
cmd = PARSERR_GENERIC;
delete layer;
layer = NULL;
@@ -658,7 +658,7 @@ HRESULT CAdScene::loadBuffer(byte *buffer, bool complete) {
case TOKEN_WAYPOINTS: {
CAdWaypointGroup *wpt = new CAdWaypointGroup(Game);
- if (!wpt || FAILED(wpt->loadBuffer(params, false))) {
+ if (!wpt || DID_FAIL(wpt->loadBuffer(params, false))) {
cmd = PARSERR_GENERIC;
delete wpt;
wpt = NULL;
@@ -671,7 +671,7 @@ HRESULT CAdScene::loadBuffer(byte *buffer, bool complete) {
case TOKEN_SCALE_LEVEL: {
CAdScaleLevel *sl = new CAdScaleLevel(Game);
- if (!sl || FAILED(sl->loadBuffer(params, false))) {
+ if (!sl || DID_FAIL(sl->loadBuffer(params, false))) {
cmd = PARSERR_GENERIC;
delete sl;
sl = NULL;
@@ -684,7 +684,7 @@ HRESULT CAdScene::loadBuffer(byte *buffer, bool complete) {
case TOKEN_ROTATION_LEVEL: {
CAdRotLevel *rl = new CAdRotLevel(Game);
- if (!rl || FAILED(rl->loadBuffer(params, false))) {
+ if (!rl || DID_FAIL(rl->loadBuffer(params, false))) {
cmd = PARSERR_GENERIC;
delete rl;
rl = NULL;
@@ -697,7 +697,7 @@ HRESULT CAdScene::loadBuffer(byte *buffer, bool complete) {
case TOKEN_ENTITY: {
CAdEntity *entity = new CAdEntity(Game);
- if (!entity || FAILED(entity->loadBuffer(params, false))) {
+ if (!entity || DID_FAIL(entity->loadBuffer(params, false))) {
cmd = PARSERR_GENERIC;
delete entity;
entity = NULL;
@@ -710,7 +710,7 @@ HRESULT CAdScene::loadBuffer(byte *buffer, bool complete) {
case TOKEN_CURSOR:
delete _cursor;
_cursor = new CBSprite(Game);
- if (!_cursor || FAILED(_cursor->loadFile((char *)params))) {
+ if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
delete _cursor;
_cursor = NULL;
cmd = PARSERR_GENERIC;
@@ -731,62 +731,62 @@ HRESULT CAdScene::loadBuffer(byte *buffer, bool complete) {
case TOKEN_EDITOR_COLOR_FRAME:
parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
- _editorColFrame = DRGBA(ar, ag, ab, aa);
+ _editorColFrame = BYTETORGBA(ar, ag, ab, aa);
break;
case TOKEN_EDITOR_COLOR_ENTITY:
parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
- _editorColEntity = DRGBA(ar, ag, ab, aa);
+ _editorColEntity = BYTETORGBA(ar, ag, ab, aa);
break;
case TOKEN_EDITOR_COLOR_ENTITY_SEL:
parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
- _editorColEntitySel = DRGBA(ar, ag, ab, aa);
+ _editorColEntitySel = BYTETORGBA(ar, ag, ab, aa);
break;
case TOKEN_EDITOR_COLOR_REGION_SEL:
parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
- _editorColRegionSel = DRGBA(ar, ag, ab, aa);
+ _editorColRegionSel = BYTETORGBA(ar, ag, ab, aa);
break;
case TOKEN_EDITOR_COLOR_DECORATION_SEL:
parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
- _editorColDecorSel = DRGBA(ar, ag, ab, aa);
+ _editorColDecorSel = BYTETORGBA(ar, ag, ab, aa);
break;
case TOKEN_EDITOR_COLOR_BLOCKED_SEL:
parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
- _editorColBlockedSel = DRGBA(ar, ag, ab, aa);
+ _editorColBlockedSel = BYTETORGBA(ar, ag, ab, aa);
break;
case TOKEN_EDITOR_COLOR_WAYPOINTS_SEL:
parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
- _editorColWaypointsSel = DRGBA(ar, ag, ab, aa);
+ _editorColWaypointsSel = BYTETORGBA(ar, ag, ab, aa);
break;
case TOKEN_EDITOR_COLOR_REGION:
parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
- _editorColRegion = DRGBA(ar, ag, ab, aa);
+ _editorColRegion = BYTETORGBA(ar, ag, ab, aa);
break;
case TOKEN_EDITOR_COLOR_DECORATION:
parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
- _editorColDecor = DRGBA(ar, ag, ab, aa);
+ _editorColDecor = BYTETORGBA(ar, ag, ab, aa);
break;
case TOKEN_EDITOR_COLOR_BLOCKED:
parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
- _editorColBlocked = DRGBA(ar, ag, ab, aa);
+ _editorColBlocked = BYTETORGBA(ar, ag, ab, aa);
break;
case TOKEN_EDITOR_COLOR_WAYPOINTS:
parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
- _editorColWaypoints = DRGBA(ar, ag, ab, aa);
+ _editorColWaypoints = BYTETORGBA(ar, ag, ab, aa);
break;
case TOKEN_EDITOR_COLOR_SCALE:
parser.scanStr((char *)params, "%d,%d,%d,%d", &ar, &ag, &ab, &aa);
- _editorColScale = DRGBA(ar, ag, ab, aa);
+ _editorColScale = BYTETORGBA(ar, ag, ab, aa);
break;
case TOKEN_EDITOR_SHOW_REGIONS:
@@ -840,7 +840,7 @@ HRESULT CAdScene::loadBuffer(byte *buffer, bool complete) {
}
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in SCENE definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (_mainLayer == NULL) Game->LOG(0, "Warning: scene '%s' has no main layer.", _filename);
@@ -852,12 +852,12 @@ HRESULT CAdScene::loadBuffer(byte *buffer, bool complete) {
_initialized = true;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::traverseNodes(bool doUpdate) {
- if (!_initialized) return S_OK;
+ERRORCODE CAdScene::traverseNodes(bool doUpdate) {
+ if (!_initialized) return STATUS_OK;
int j, k;
CAdGame *adGame = (CAdGame *)Game;
@@ -1025,17 +1025,17 @@ HRESULT CAdScene::traverseNodes(bool doUpdate) {
if (PopViewport) Game->popViewport();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::display() {
+ERRORCODE CAdScene::display() {
return traverseNodes(false);
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::updateFreeObjects() {
+ERRORCODE CAdScene::updateFreeObjects() {
CAdGame *adGame = (CAdGame *)Game;
bool is3DSet;
@@ -1062,12 +1062,12 @@ HRESULT CAdScene::updateFreeObjects() {
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::displayRegionContent(CAdRegion *region, bool display3DOnly) {
+ERRORCODE CAdScene::displayRegionContent(CAdRegion *region, bool display3DOnly) {
CAdGame *adGame = (CAdGame *)Game;
CBArray<CAdObject *, CAdObject *> objects;
CAdObject *obj;
@@ -1116,7 +1116,7 @@ HRESULT CAdScene::displayRegionContent(CAdRegion *region, bool display3DOnly) {
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1130,7 +1130,7 @@ int CAdScene::compareObjs(const void *obj1, const void *obj2) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::displayRegionContentOld(CAdRegion *region) {
+ERRORCODE CAdScene::displayRegionContentOld(CAdRegion *region) {
CAdGame *adGame = (CAdGame *)Game;
CAdObject *obj;
@@ -1175,12 +1175,12 @@ HRESULT CAdScene::displayRegionContentOld(CAdRegion *region) {
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::update() {
+ERRORCODE CAdScene::update() {
return traverseNodes(true);
}
@@ -1240,14 +1240,14 @@ void CAdScene::skipTo(int offsetX, int offsetY) {
//////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// LoadActor
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "LoadActor") == 0) {
stack->correctParams(1);
CAdActor *act = new CAdActor(Game);
- if (act && SUCCEEDED(act->loadFile(stack->pop()->getString()))) {
+ if (act && DID_SUCCEED(act->loadFile(stack->pop()->getString()))) {
addObject(act);
stack->pushNative(act, true);
} else {
@@ -1255,7 +1255,7 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
act = NULL;
stack->pushNULL();
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1264,7 +1264,7 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
else if (strcmp(name, "LoadEntity") == 0) {
stack->correctParams(1);
CAdEntity *ent = new CAdEntity(Game);
- if (ent && SUCCEEDED(ent->loadFile(stack->pop()->getString()))) {
+ if (ent && DID_SUCCEED(ent->loadFile(stack->pop()->getString()))) {
addObject(ent);
stack->pushNative(ent, true);
} else {
@@ -1272,7 +1272,7 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
ent = NULL;
stack->pushNULL();
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1286,7 +1286,7 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
addObject(ent);
if (!val->isNULL()) ent->setName(val->getString());
stack->pushNative(ent, true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1300,7 +1300,7 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
if (val->getType() == VAL_VARIABLE_REF) val->setNULL();
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1316,7 +1316,7 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
skipTo(val1->getInt(), val2->getInt());
}
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1333,7 +1333,7 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
}
if (strcmp(name, "ScrollTo") == 0) script->waitForExclusive(this);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1358,7 +1358,7 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
}
if (!LayerFound) stack->pushNULL();
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1369,7 +1369,7 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
int group = stack->pop()->getInt();
if (group < 0 || group >= _waypointGroups.GetSize()) stack->pushNULL();
else stack->pushNative(_waypointGroups[group], true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1383,7 +1383,7 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
if (node) stack->pushNative((CBScriptable *)node, true);
else stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1409,7 +1409,7 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
if (ret) stack->pushNative(ret, true);
else stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1431,12 +1431,12 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
if (node->_region->_decoration && !includeDecors) continue;
stack->pushNative(node->_region, true);
- return S_OK;
+ return STATUS_OK;
}
}
}
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1448,7 +1448,7 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
int y = stack->pop()->getInt();
stack->pushBool(isBlockedAt(x, y));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1460,7 +1460,7 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
int y = stack->pop()->getInt();
stack->pushBool(isWalkableAt(x, y));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1472,7 +1472,7 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
int y = stack->pop()->getInt();
stack->pushFloat(getZoomAt(x, y));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1484,7 +1484,7 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
int y = stack->pop()->getInt();
stack->pushFloat(getRotationAt(x, y));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1498,7 +1498,7 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
}
stack->pushBool(ret);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1512,11 +1512,11 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
byte blue = stack->pop()->getInt(0);
byte alpha = stack->pop()->getInt(0xFF);
- _fader->fadeOut(DRGBA(red, green, blue, alpha), duration);
+ _fader->fadeOut(BYTETORGBA(red, green, blue, alpha), duration);
if (strcmp(name, "FadeOutAsync") != 0) script->waitFor(_fader);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1530,11 +1530,11 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
byte blue = stack->pop()->getInt(0);
byte alpha = stack->pop()->getInt(0xFF);
- _fader->fadeIn(DRGBA(red, green, blue, alpha), duration);
+ _fader->fadeIn(BYTETORGBA(red, green, blue, alpha), duration);
if (strcmp(name, "FadeInAsync") != 0) script->waitFor(_fader);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1543,7 +1543,7 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
else if (strcmp(name, "GetFadeColor") == 0) {
stack->correctParams(0);
stack->pushInt(_fader->getCurrentColor());
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1554,7 +1554,7 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
int x = stack->pop()->getInt();
int y = stack->pop()->getInt();
stack->pushBool(pointInViewport(x, y));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1575,7 +1575,7 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1595,7 +1595,7 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
Game->registerObject(layer);
stack->pushNative(layer, true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1619,7 +1619,7 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
Game->registerObject(layer);
stack->pushNative(layer, true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1646,13 +1646,13 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
}
if (toDelete == NULL) {
stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
if (toDelete->_main) {
script->runtimeError("Scene.DeleteLayer - cannot delete main scene layer");
stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
for (int i = 0; i < _layers.GetSize(); i++) {
@@ -1663,7 +1663,7 @@ HRESULT CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
}
}
stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
else return CBObject::scCallMethod(script, stack, thisStack, name);
@@ -1834,13 +1834,13 @@ CScValue *CAdScene::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CAdScene::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
// Name
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "Name") == 0) {
setName(value->getString());
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1848,7 +1848,7 @@ HRESULT CAdScene::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "AutoScroll") == 0) {
_autoScroll = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1856,7 +1856,7 @@ HRESULT CAdScene::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "PersistentState") == 0) {
_persistentState = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1864,7 +1864,7 @@ HRESULT CAdScene::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "PersistentStateSprites") == 0) {
_persistentStateSprites = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1872,7 +1872,7 @@ HRESULT CAdScene::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ScrollPixelsX") == 0) {
_scrollPixelsH = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1880,7 +1880,7 @@ HRESULT CAdScene::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ScrollPixelsY") == 0) {
_scrollPixelsV = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1888,7 +1888,7 @@ HRESULT CAdScene::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ScrollSpeedX") == 0) {
_scrollTimeH = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1896,7 +1896,7 @@ HRESULT CAdScene::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ScrollSpeedY") == 0) {
_scrollTimeV = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1912,7 +1912,7 @@ HRESULT CAdScene::scSetProperty(const char *name, CScValue *value) {
_offsetLeft = MIN(_offsetLeft, _width - viewportWidth);
_targetOffsetLeft = _offsetLeft;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1928,7 +1928,7 @@ HRESULT CAdScene::scSetProperty(const char *name, CScValue *value) {
_offsetTop = MIN(_offsetTop, _height - viewportHeight);
_targetOffsetTop = _offsetTop;
- return S_OK;
+ return STATUS_OK;
}
else return CBObject::scSetProperty(name, value);
@@ -1942,26 +1942,26 @@ const char *CAdScene::scToString() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::addObject(CAdObject *object) {
+ERRORCODE CAdScene::addObject(CAdObject *object) {
_objects.Add(object);
return Game->registerObject(object);
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::removeObject(CAdObject *object) {
+ERRORCODE CAdScene::removeObject(CAdObject *object) {
for (int i = 0; i < _objects.GetSize(); i++) {
if (_objects[i] == object) {
_objects.RemoveAt(i);
return Game->unregisterObject(object);
}
}
- return E_FAIL;
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::saveAsText(CBDynBuffer *buffer, int indent) {
+ERRORCODE CAdScene::saveAsText(CBDynBuffer *buffer, int indent) {
int i;
buffer->putTextIndent(indent, "SCENE {\n");
@@ -1998,18 +1998,18 @@ HRESULT CAdScene::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent + 2, "; ----- editor settings\n");
buffer->putTextIndent(indent + 2, "EDITOR_MARGIN_H=%d\n", _editorMarginH);
buffer->putTextIndent(indent + 2, "EDITOR_MARGIN_V=%d\n", _editorMarginV);
- buffer->putTextIndent(indent + 2, "EDITOR_COLOR_FRAME { %d,%d,%d,%d }\n", D3DCOLGetR(_editorColFrame), D3DCOLGetG(_editorColFrame), D3DCOLGetB(_editorColFrame), D3DCOLGetA(_editorColFrame));
- buffer->putTextIndent(indent + 2, "EDITOR_COLOR_ENTITY_SEL { %d,%d,%d,%d }\n", D3DCOLGetR(_editorColEntitySel), D3DCOLGetG(_editorColEntitySel), D3DCOLGetB(_editorColEntitySel), D3DCOLGetA(_editorColEntitySel));
- buffer->putTextIndent(indent + 2, "EDITOR_COLOR_REGION_SEL { %d,%d,%d,%d }\n", D3DCOLGetR(_editorColRegionSel), D3DCOLGetG(_editorColRegionSel), D3DCOLGetB(_editorColRegionSel), D3DCOLGetA(_editorColRegionSel));
- buffer->putTextIndent(indent + 2, "EDITOR_COLOR_BLOCKED_SEL { %d,%d,%d,%d }\n", D3DCOLGetR(_editorColBlockedSel), D3DCOLGetG(_editorColBlockedSel), D3DCOLGetB(_editorColBlockedSel), D3DCOLGetA(_editorColBlockedSel));
- buffer->putTextIndent(indent + 2, "EDITOR_COLOR_DECORATION_SEL { %d,%d,%d,%d }\n", D3DCOLGetR(_editorColDecorSel), D3DCOLGetG(_editorColDecorSel), D3DCOLGetB(_editorColDecorSel), D3DCOLGetA(_editorColDecorSel));
- buffer->putTextIndent(indent + 2, "EDITOR_COLOR_WAYPOINTS_SEL { %d,%d,%d,%d }\n", D3DCOLGetR(_editorColWaypointsSel), D3DCOLGetG(_editorColWaypointsSel), D3DCOLGetB(_editorColWaypointsSel), D3DCOLGetA(_editorColWaypointsSel));
- buffer->putTextIndent(indent + 2, "EDITOR_COLOR_ENTITY { %d,%d,%d,%d }\n", D3DCOLGetR(_editorColEntity), D3DCOLGetG(_editorColEntity), D3DCOLGetB(_editorColEntity), D3DCOLGetA(_editorColEntity));
- buffer->putTextIndent(indent + 2, "EDITOR_COLOR_REGION { %d,%d,%d,%d }\n", D3DCOLGetR(_editorColRegion), D3DCOLGetG(_editorColRegion), D3DCOLGetB(_editorColRegion), D3DCOLGetA(_editorColRegion));
- buffer->putTextIndent(indent + 2, "EDITOR_COLOR_DECORATION { %d,%d,%d,%d }\n", D3DCOLGetR(_editorColDecor), D3DCOLGetG(_editorColDecor), D3DCOLGetB(_editorColDecor), D3DCOLGetA(_editorColDecor));
- buffer->putTextIndent(indent + 2, "EDITOR_COLOR_BLOCKED { %d,%d,%d,%d }\n", D3DCOLGetR(_editorColBlocked), D3DCOLGetG(_editorColBlocked), D3DCOLGetB(_editorColBlocked), D3DCOLGetA(_editorColBlocked));
- buffer->putTextIndent(indent + 2, "EDITOR_COLOR_WAYPOINTS { %d,%d,%d,%d }\n", D3DCOLGetR(_editorColWaypoints), D3DCOLGetG(_editorColWaypoints), D3DCOLGetB(_editorColWaypoints), D3DCOLGetA(_editorColWaypoints));
- buffer->putTextIndent(indent + 2, "EDITOR_COLOR_SCALE { %d,%d,%d,%d }\n", D3DCOLGetR(_editorColScale), D3DCOLGetG(_editorColScale), D3DCOLGetB(_editorColScale), D3DCOLGetA(_editorColScale));
+ buffer->putTextIndent(indent + 2, "EDITOR_COLOR_FRAME { %d,%d,%d,%d }\n", RGBCOLGetR(_editorColFrame), RGBCOLGetG(_editorColFrame), RGBCOLGetB(_editorColFrame), RGBCOLGetA(_editorColFrame));
+ buffer->putTextIndent(indent + 2, "EDITOR_COLOR_ENTITY_SEL { %d,%d,%d,%d }\n", RGBCOLGetR(_editorColEntitySel), RGBCOLGetG(_editorColEntitySel), RGBCOLGetB(_editorColEntitySel), RGBCOLGetA(_editorColEntitySel));
+ buffer->putTextIndent(indent + 2, "EDITOR_COLOR_REGION_SEL { %d,%d,%d,%d }\n", RGBCOLGetR(_editorColRegionSel), RGBCOLGetG(_editorColRegionSel), RGBCOLGetB(_editorColRegionSel), RGBCOLGetA(_editorColRegionSel));
+ buffer->putTextIndent(indent + 2, "EDITOR_COLOR_BLOCKED_SEL { %d,%d,%d,%d }\n", RGBCOLGetR(_editorColBlockedSel), RGBCOLGetG(_editorColBlockedSel), RGBCOLGetB(_editorColBlockedSel), RGBCOLGetA(_editorColBlockedSel));
+ buffer->putTextIndent(indent + 2, "EDITOR_COLOR_DECORATION_SEL { %d,%d,%d,%d }\n", RGBCOLGetR(_editorColDecorSel), RGBCOLGetG(_editorColDecorSel), RGBCOLGetB(_editorColDecorSel), RGBCOLGetA(_editorColDecorSel));
+ buffer->putTextIndent(indent + 2, "EDITOR_COLOR_WAYPOINTS_SEL { %d,%d,%d,%d }\n", RGBCOLGetR(_editorColWaypointsSel), RGBCOLGetG(_editorColWaypointsSel), RGBCOLGetB(_editorColWaypointsSel), RGBCOLGetA(_editorColWaypointsSel));
+ buffer->putTextIndent(indent + 2, "EDITOR_COLOR_ENTITY { %d,%d,%d,%d }\n", RGBCOLGetR(_editorColEntity), RGBCOLGetG(_editorColEntity), RGBCOLGetB(_editorColEntity), RGBCOLGetA(_editorColEntity));
+ buffer->putTextIndent(indent + 2, "EDITOR_COLOR_REGION { %d,%d,%d,%d }\n", RGBCOLGetR(_editorColRegion), RGBCOLGetG(_editorColRegion), RGBCOLGetB(_editorColRegion), RGBCOLGetA(_editorColRegion));
+ buffer->putTextIndent(indent + 2, "EDITOR_COLOR_DECORATION { %d,%d,%d,%d }\n", RGBCOLGetR(_editorColDecor), RGBCOLGetG(_editorColDecor), RGBCOLGetB(_editorColDecor), RGBCOLGetA(_editorColDecor));
+ buffer->putTextIndent(indent + 2, "EDITOR_COLOR_BLOCKED { %d,%d,%d,%d }\n", RGBCOLGetR(_editorColBlocked), RGBCOLGetG(_editorColBlocked), RGBCOLGetB(_editorColBlocked), RGBCOLGetA(_editorColBlocked));
+ buffer->putTextIndent(indent + 2, "EDITOR_COLOR_WAYPOINTS { %d,%d,%d,%d }\n", RGBCOLGetR(_editorColWaypoints), RGBCOLGetG(_editorColWaypoints), RGBCOLGetB(_editorColWaypoints), RGBCOLGetA(_editorColWaypoints));
+ buffer->putTextIndent(indent + 2, "EDITOR_COLOR_SCALE { %d,%d,%d,%d }\n", RGBCOLGetR(_editorColScale), RGBCOLGetG(_editorColScale), RGBCOLGetB(_editorColScale), RGBCOLGetA(_editorColScale));
buffer->putTextIndent(indent + 2, "EDITOR_SHOW_REGIONS=%s\n", _editorShowRegions ? "TRUE" : "FALSE");
buffer->putTextIndent(indent + 2, "EDITOR_SHOW_BLOCKED=%s\n", _editorShowBlocked ? "TRUE" : "FALSE");
@@ -2054,12 +2054,12 @@ HRESULT CAdScene::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "}\n");
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::sortScaleLevels() {
+ERRORCODE CAdScene::sortScaleLevels() {
bool changed;
do {
changed = false;
@@ -2075,12 +2075,12 @@ HRESULT CAdScene::sortScaleLevels() {
} while (changed);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::sortRotLevels() {
+ERRORCODE CAdScene::sortRotLevels() {
bool changed;
do {
changed = false;
@@ -2096,7 +2096,7 @@ HRESULT CAdScene::sortRotLevels() {
} while (changed);
- return S_OK;
+ return STATUS_OK;
}
@@ -2127,7 +2127,7 @@ float CAdScene::getScaleAt(int Y) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CAdScene::persist(CBPersistMgr *persistMgr) {
CBObject::persist(persistMgr);
persistMgr->transfer(TMEMBER(_autoScroll));
@@ -2183,16 +2183,16 @@ HRESULT CAdScene::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(_viewport));
persistMgr->transfer(TMEMBER(_width));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::afterLoad() {
- return S_OK;
+ERRORCODE CAdScene::afterLoad() {
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::correctTargetPoint2(int startX, int startY, int *targetX, int *targetY, bool checkFreeObjects, CBObject *requester) {
+ERRORCODE CAdScene::correctTargetPoint2(int startX, int startY, int *targetX, int *targetY, bool checkFreeObjects, CBObject *requester) {
double xStep, yStep, x, y;
int xLength, yLength, xCount, yCount;
int x1, y1, x2, y2;
@@ -2222,7 +2222,7 @@ HRESULT CAdScene::correctTargetPoint2(int startX, int startY, int *targetX, int
if (isWalkableAt(xCount, (int)y, checkFreeObjects, requester)) {
*targetX = xCount;
*targetY = (int)y;
- return S_OK;
+ return STATUS_OK;
}
y += yStep;
}
@@ -2241,22 +2241,22 @@ HRESULT CAdScene::correctTargetPoint2(int startX, int startY, int *targetX, int
if (isWalkableAt((int)x, yCount, checkFreeObjects, requester)) {
*targetX = (int)x;
*targetY = yCount;
- return S_OK;
+ return STATUS_OK;
}
x += xStep;
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::correctTargetPoint(int startX, int startY, int *argX, int *argY, bool checkFreeObjects, CBObject *requester) {
+ERRORCODE CAdScene::correctTargetPoint(int startX, int startY, int *argX, int *argY, bool checkFreeObjects, CBObject *requester) {
int x = *argX;
int y = *argY;
if (isWalkableAt(x, y, checkFreeObjects, requester) || !_mainLayer) {
- return S_OK;
+ return STATUS_OK;
}
// right
@@ -2300,7 +2300,7 @@ HRESULT CAdScene::correctTargetPoint(int startX, int startY, int *argX, int *arg
}
if (!found_left && !found_right && !found_up && !found_down) {
- return S_OK;
+ return STATUS_OK;
}
int OffsetX = INT_MAX, OffsetY = INT_MAX;
@@ -2323,7 +2323,7 @@ HRESULT CAdScene::correctTargetPoint(int startX, int startY, int *argX, int *arg
*argY = *argY + OffsetY;
if (!isWalkableAt(*argX, *argY)) return correctTargetPoint2(startX, startY, argX, argY, checkFreeObjects, requester);
- else return S_OK;
+ else return STATUS_OK;
}
@@ -2350,7 +2350,7 @@ void CAdScene::pfPointsAdd(int x, int y, int distance) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::getViewportOffset(int *offsetX, int *offsetY) {
+ERRORCODE CAdScene::getViewportOffset(int *offsetX, int *offsetY) {
CAdGame *adGame = (CAdGame *)Game;
if (_viewport && !Game->_editorMode) {
if (offsetX) *offsetX = _viewport->_offsetX;
@@ -2362,12 +2362,12 @@ HRESULT CAdScene::getViewportOffset(int *offsetX, int *offsetY) {
if (offsetX) *offsetX = 0;
if (offsetY) *offsetY = 0;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::getViewportSize(int *width, int *height) {
+ERRORCODE CAdScene::getViewportSize(int *width, int *height) {
CAdGame *adGame = (CAdGame *)Game;
if (_viewport && !Game->_editorMode) {
if (width) *width = _viewport->getWidth();
@@ -2379,7 +2379,7 @@ HRESULT CAdScene::getViewportSize(int *width, int *height) {
if (width) *width = Game->_renderer->_width;
if (height) *height = Game->_renderer->_height;
}
- return S_OK;
+ return STATUS_OK;
}
@@ -2464,24 +2464,24 @@ CBObject *CAdScene::getNodeByName(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::saveState() {
+ERRORCODE CAdScene::saveState() {
return persistState(true);
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::loadState() {
+ERRORCODE CAdScene::loadState() {
return persistState(false);
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::persistState(bool saving) {
- if (!_persistentState) return S_OK;
+ERRORCODE CAdScene::persistState(bool saving) {
+ if (!_persistentState) return STATUS_OK;
CAdGame *adGame = (CAdGame *)Game;
CAdSceneState *state = adGame->getSceneState(_filename, saving);
- if (!state) return S_OK;
+ if (!state) return STATUS_OK;
CAdNodeState *nodeState;
@@ -2537,7 +2537,7 @@ HRESULT CAdScene::persistState(bool saving) {
}
}
- return S_OK;
+ return STATUS_OK;
}
@@ -2568,7 +2568,7 @@ float CAdScene::getRotationAt(int x, int y) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::handleItemAssociations(const char *itemName, bool show) {
+ERRORCODE CAdScene::handleItemAssociations(const char *itemName, bool show) {
for (int i = 0; i < _layers.GetSize(); i++) {
CAdLayer *layer = _layers[i];
for (int j = 0; j < layer->_nodes.GetSize(); j++) {
@@ -2587,12 +2587,12 @@ HRESULT CAdScene::handleItemAssociations(const char *itemName, bool show) {
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::getRegionsAt(int x, int y, CAdRegion **regionList, int numRegions) {
+ERRORCODE CAdScene::getRegionsAt(int x, int y, CAdRegion **regionList, int numRegions) {
int numUsed = 0;
if (_mainLayer) {
for (int i = _mainLayer->_nodes.GetSize() - 1; i >= 0; i--) {
@@ -2609,12 +2609,12 @@ HRESULT CAdScene::getRegionsAt(int x, int y, CAdRegion **regionList, int numRegi
regionList[i] = NULL;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::restoreDeviceObjects() {
- return S_OK;
+ERRORCODE CAdScene::restoreDeviceObjects() {
+ return STATUS_OK;
}
@@ -2660,7 +2660,7 @@ CBObject *CAdScene::getPrevAccessObject(CBObject *currObject) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::getSceneObjects(CBArray<CAdObject *, CAdObject *> &objects, bool interactiveOnly) {
+ERRORCODE CAdScene::getSceneObjects(CBArray<CAdObject *, CAdObject *> &objects, bool interactiveOnly) {
for (int i = 0; i < _layers.GetSize(); i++) {
// close-up layer -> remove everything below it
if (interactiveOnly && _layers[i]->_closeUp) objects.RemoveAll();
@@ -2714,12 +2714,12 @@ HRESULT CAdScene::getSceneObjects(CBArray<CAdObject *, CAdObject *> &objects, bo
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdScene::getRegionObjects(CAdRegion *region, CBArray<CAdObject *, CAdObject *> &objects, bool interactiveOnly) {
+ERRORCODE CAdScene::getRegionObjects(CAdRegion *region, CBArray<CAdObject *, CAdObject *> &objects, bool interactiveOnly) {
CAdGame *adGame = (CAdGame *)Game;
CAdObject *obj;
@@ -2746,7 +2746,7 @@ HRESULT CAdScene::getRegionObjects(CAdRegion *region, CBArray<CAdObject *, CAdOb
// sort by _posY
qsort(objects.GetData(), objects.GetSize(), sizeof(CAdObject *), CAdScene::compareObjs);
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Ad/AdScene.h b/engines/wintermute/Ad/AdScene.h
index e89d4540f1..d47d727884 100644
--- a/engines/wintermute/Ad/AdScene.h
+++ b/engines/wintermute/Ad/AdScene.h
@@ -49,17 +49,17 @@ public:
CBObject *getNextAccessObject(CBObject *CurrObject);
CBObject *getPrevAccessObject(CBObject *CurrObject);
- HRESULT getSceneObjects(CBArray<CAdObject *, CAdObject *> &Objects, bool InteractiveOnly);
- HRESULT getRegionObjects(CAdRegion *Region, CBArray<CAdObject *, CAdObject *> &Objects, bool InteractiveOnly);
+ ERRORCODE getSceneObjects(CBArray<CAdObject *, CAdObject *> &Objects, bool InteractiveOnly);
+ ERRORCODE getRegionObjects(CAdRegion *Region, CBArray<CAdObject *, CAdObject *> &Objects, bool InteractiveOnly);
- HRESULT afterLoad();
+ ERRORCODE afterLoad();
- HRESULT getRegionsAt(int X, int Y, CAdRegion **RegionList, int NumRegions);
- HRESULT handleItemAssociations(const char *ItemName, bool Show);
+ ERRORCODE getRegionsAt(int X, int Y, CAdRegion **RegionList, int NumRegions);
+ ERRORCODE handleItemAssociations(const char *ItemName, bool Show);
CUIWindow *_shieldWindow;
float getRotationAt(int X, int Y);
- HRESULT loadState();
- HRESULT saveState();
+ ERRORCODE loadState();
+ ERRORCODE saveState();
bool _persistentState;
bool _persistentStateSprites;
CBObject *getNodeByName(const char *name);
@@ -67,27 +67,27 @@ public:
bool pointInViewport(int X, int Y);
int getOffsetTop();
int getOffsetLeft();
- HRESULT getViewportSize(int *Width = NULL, int *Height = NULL);
- HRESULT getViewportOffset(int *OffsetX = NULL, int *OffsetY = NULL);
+ ERRORCODE getViewportSize(int *Width = NULL, int *Height = NULL);
+ ERRORCODE getViewportOffset(int *OffsetX = NULL, int *OffsetY = NULL);
CBViewport *_viewport;
CBFader *_fader;
int _pfPointsNum;
void pfPointsAdd(int X, int Y, int Distance);
void pfPointsStart();
bool _initialized;
- HRESULT correctTargetPoint(int StartX, int StartY, int *X, int *Y, bool CheckFreeObjects = false, CBObject *Requester = NULL);
- HRESULT correctTargetPoint2(int StartX, int StartY, int *TargetX, int *TargetY, bool CheckFreeObjects, CBObject *Requester);
+ ERRORCODE correctTargetPoint(int StartX, int StartY, int *X, int *Y, bool CheckFreeObjects = false, CBObject *Requester = NULL);
+ ERRORCODE correctTargetPoint2(int StartX, int StartY, int *TargetX, int *TargetY, bool CheckFreeObjects, CBObject *Requester);
DECLARE_PERSISTENT(CAdScene, CBObject)
- HRESULT displayRegionContent(CAdRegion *Region = NULL, bool Display3DOnly = false);
- HRESULT displayRegionContentOld(CAdRegion *Region = NULL);
+ ERRORCODE displayRegionContent(CAdRegion *Region = NULL, bool Display3DOnly = false);
+ ERRORCODE displayRegionContentOld(CAdRegion *Region = NULL);
static int compareObjs(const void *Obj1, const void *Obj2);
- HRESULT updateFreeObjects();
- HRESULT traverseNodes(bool Update = false);
+ ERRORCODE updateFreeObjects();
+ ERRORCODE traverseNodes(bool Update = false);
float getScaleAt(int Y);
- HRESULT sortScaleLevels();
- HRESULT sortRotLevels();
- virtual HRESULT saveAsText(CBDynBuffer *buffer, int indent);
+ ERRORCODE sortScaleLevels();
+ ERRORCODE sortRotLevels();
+ virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent);
uint32 getAlphaAt(int X, int Y, bool ColorCheck = false);
bool _paralaxScrolling;
void skipTo(int OffsetX, int OffsetY);
@@ -96,7 +96,7 @@ public:
void skipToObject(CBObject *Object);
void scrollToObject(CBObject *Object);
void scrollTo(int OffsetX, int OffsetY);
- virtual HRESULT update();
+ virtual ERRORCODE update();
bool _autoScroll;
int _targetOffsetTop;
int _targetOffsetLeft;
@@ -109,9 +109,9 @@ public:
uint32 _scrollTimeH;
uint32 _lastTimeH;
- virtual HRESULT display();
+ virtual ERRORCODE display();
uint32 _pfMaxTime;
- HRESULT initLoop();
+ ERRORCODE initLoop();
void pathFinderStep();
bool isBlockedAt(int X, int Y, bool CheckFreeObjects = false, CBObject *Requester = NULL);
bool isWalkableAt(int X, int Y, bool CheckFreeObjects = false, CBObject *Requester = NULL);
@@ -123,12 +123,12 @@ public:
CBArray<CAdLayer *, CAdLayer *> _layers;
CBArray<CAdObject *, CAdObject *> _objects;
CBArray<CAdWaypointGroup *, CAdWaypointGroup *> _waypointGroups;
- HRESULT loadFile(const char *filename);
- HRESULT loadBuffer(byte *buffer, bool complete = true);
+ ERRORCODE loadFile(const char *filename);
+ ERRORCODE loadBuffer(byte *buffer, bool complete = true);
int _width;
int _height;
- HRESULT addObject(CAdObject *Object);
- HRESULT removeObject(CAdObject *Object);
+ ERRORCODE addObject(CAdObject *Object);
+ ERRORCODE removeObject(CAdObject *Object);
int _editorMarginH;
int _editorMarginV;
uint32 _editorColFrame;
@@ -152,18 +152,18 @@ public:
CBArray<CAdScaleLevel *, CAdScaleLevel *> _scaleLevels;
CBArray<CAdRotLevel *, CAdRotLevel *> _rotLevels;
- virtual HRESULT restoreDeviceObjects();
+ virtual ERRORCODE restoreDeviceObjects();
int getPointsDist(CBPoint p1, CBPoint p2, CBObject *requester = NULL);
// scripting interface
virtual CScValue *scGetProperty(const char *name);
- virtual HRESULT scSetProperty(const char *name, CScValue *value);
- virtual HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ERRORCODE scSetProperty(const char *name, CScValue *value);
+ virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
virtual const char *scToString();
private:
- HRESULT persistState(bool Saving = true);
+ ERRORCODE persistState(bool Saving = true);
void pfAddWaypointGroup(CAdWaypointGroup *Wpt, CBObject *Requester = NULL);
bool _pfReady;
CBPoint *_pfTarget;
diff --git a/engines/wintermute/Ad/AdSceneNode.cpp b/engines/wintermute/Ad/AdSceneNode.cpp
index 0fc4a6a7d6..60ab2891f5 100644
--- a/engines/wintermute/Ad/AdSceneNode.cpp
+++ b/engines/wintermute/Ad/AdSceneNode.cpp
@@ -53,7 +53,7 @@ CAdSceneNode::~CAdSceneNode() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdSceneNode::setEntity(CAdEntity *entity) {
+ERRORCODE CAdSceneNode::setEntity(CAdEntity *entity) {
_type = OBJECT_ENTITY;
_entity = entity;
return Game->registerObject(entity);
@@ -61,7 +61,7 @@ HRESULT CAdSceneNode::setEntity(CAdEntity *entity) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdSceneNode::setRegion(CAdRegion *region) {
+ERRORCODE CAdSceneNode::setRegion(CAdRegion *region) {
_type = OBJECT_REGION;
_region = region;
return Game->registerObject(region);
@@ -69,7 +69,7 @@ HRESULT CAdSceneNode::setRegion(CAdRegion *region) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdSceneNode::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CAdSceneNode::persist(CBPersistMgr *persistMgr) {
CBObject::persist(persistMgr);
@@ -77,7 +77,7 @@ HRESULT CAdSceneNode::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(_region));
persistMgr->transfer(TMEMBER_INT(_type));
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Ad/AdSceneNode.h b/engines/wintermute/Ad/AdSceneNode.h
index 0ba0c5d7b6..931d859cca 100644
--- a/engines/wintermute/Ad/AdSceneNode.h
+++ b/engines/wintermute/Ad/AdSceneNode.h
@@ -39,8 +39,8 @@ namespace WinterMute {
class CAdSceneNode : public CBObject {
public:
DECLARE_PERSISTENT(CAdSceneNode, CBObject)
- HRESULT setRegion(CAdRegion *region);
- HRESULT setEntity(CAdEntity *entity);
+ ERRORCODE setRegion(CAdRegion *region);
+ ERRORCODE setEntity(CAdEntity *entity);
CAdEntity *_entity;
CAdRegion *_region;
TObjectType _type;
diff --git a/engines/wintermute/Ad/AdSceneState.cpp b/engines/wintermute/Ad/AdSceneState.cpp
index ffa1dfe84f..9778e8919d 100644
--- a/engines/wintermute/Ad/AdSceneState.cpp
+++ b/engines/wintermute/Ad/AdSceneState.cpp
@@ -54,11 +54,11 @@ CAdSceneState::~CAdSceneState() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdSceneState::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CAdSceneState::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(_filename));
_nodeStates.persist(persistMgr);
- return S_OK;
+ return STATUS_OK;
}
diff --git a/engines/wintermute/Ad/AdSentence.cpp b/engines/wintermute/Ad/AdSentence.cpp
index 88b0f26d92..341f47a503 100644
--- a/engines/wintermute/Ad/AdSentence.cpp
+++ b/engines/wintermute/Ad/AdSentence.cpp
@@ -165,8 +165,8 @@ char *CAdSentence::getStance(int stance) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdSentence::display() {
- if (!_font || !_text) return E_FAIL;
+ERRORCODE CAdSentence::display() {
+ if (!_font || !_text) return STATUS_FAILED;
if (_sound && !_soundStarted) {
_sound->play();
@@ -190,7 +190,7 @@ HRESULT CAdSentence::display() {
_font->drawText((byte *)_text, x, y, _width, _align);
}
- return S_OK;
+ return STATUS_OK;
}
@@ -204,14 +204,14 @@ void CAdSentence::setSound(CBSound *sound) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdSentence::finish() {
+ERRORCODE CAdSentence::finish() {
if (_sound) _sound->stop();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdSentence::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CAdSentence::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(Game));
@@ -233,17 +233,17 @@ HRESULT CAdSentence::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(_fixedPos));
persistMgr->transfer(TMEMBER(_freezable));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdSentence::setupTalkFile(const char *soundFilename) {
+ERRORCODE CAdSentence::setupTalkFile(const char *soundFilename) {
delete _talkDef;
_talkDef = NULL;
_currentSprite = NULL;
- if (!soundFilename) return S_OK;
+ if (!soundFilename) return STATUS_OK;
AnsiString path = PathUtil::getDirectoryName(soundFilename);
@@ -254,24 +254,24 @@ HRESULT CAdSentence::setupTalkFile(const char *soundFilename) {
Common::SeekableReadStream *file = Game->_fileManager->openFile(talkDefFileName.c_str());
if (file) {
Game->_fileManager->closeFile(file);
- } else return S_OK; // no talk def file found
+ } else return STATUS_OK; // no talk def file found
_talkDef = new CAdTalkDef(Game);
- if (!_talkDef || FAILED(_talkDef->loadFile(talkDefFileName.c_str()))) {
+ if (!_talkDef || DID_FAIL(_talkDef->loadFile(talkDefFileName.c_str()))) {
delete _talkDef;
_talkDef = NULL;
- return E_FAIL;
+ return STATUS_FAILED;
}
//Game->LOG(0, "Using .talk file: %s", TalkDefFile);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdSentence::update(TDirection dir) {
- if (!_talkDef) return S_OK;
+ERRORCODE CAdSentence::update(TDirection dir) {
+ if (!_talkDef) return STATUS_OK;
uint32 currentTime;
// if sound is available, synchronize with sound, otherwise use timer
@@ -305,7 +305,7 @@ HRESULT CAdSentence::update(TDirection dir) {
} else _currentSprite = NULL;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/wintermute/Ad/AdSentence.h b/engines/wintermute/Ad/AdSentence.h
index 38b44bd619..a8b08433c1 100644
--- a/engines/wintermute/Ad/AdSentence.h
+++ b/engines/wintermute/Ad/AdSentence.h
@@ -45,15 +45,15 @@ public:
bool _fixedPos;
CBSprite *_currentSprite;
char *_currentSkelAnim;
- HRESULT update(TDirection dir = DI_DOWN);
- HRESULT setupTalkFile(const char *soundFilename);
+ ERRORCODE update(TDirection dir = DI_DOWN);
+ ERRORCODE setupTalkFile(const char *soundFilename);
DECLARE_PERSISTENT(CAdSentence, CBBase)
- HRESULT finish();
+ ERRORCODE finish();
void setSound(CBSound *Sound);
bool _soundStarted;
CBSound *_sound;
TTextAlign _align;
- HRESULT display();
+ ERRORCODE display();
int _width;
POINT _pos;
CBFont *_font;
diff --git a/engines/wintermute/Ad/AdSpriteSet.cpp b/engines/wintermute/Ad/AdSpriteSet.cpp
index c02ba32ea1..29026a9508 100644
--- a/engines/wintermute/Ad/AdSpriteSet.cpp
+++ b/engines/wintermute/Ad/AdSpriteSet.cpp
@@ -58,16 +58,16 @@ CAdSpriteSet::~CAdSpriteSet() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdSpriteSet::loadFile(const char *filename, int lifeTime, TSpriteCacheType cacheType) {
+ERRORCODE CAdSpriteSet::loadFile(const char *filename, int lifeTime, TSpriteCacheType cacheType) {
byte *buffer = Game->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
Game->LOG(0, "CAdSpriteSet::LoadFile failed for file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
- HRESULT ret;
+ ERRORCODE ret;
- if (FAILED(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing SPRITESET file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing SPRITESET file '%s'", filename);
delete [] buffer;
@@ -90,7 +90,7 @@ TOKEN_DEF(TEMPLATE)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteCacheType CacheType) {
+ERRORCODE CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteCacheType CacheType) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(SPRITESET)
TOKEN_TABLE(NAME)
@@ -113,7 +113,7 @@ HRESULT CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpr
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_SPRITESET) {
Game->LOG(0, "'SPRITESET' keyword expected.");
- return E_FAIL;
+ return STATUS_FAILED;
}
buffer = params;
}
@@ -122,7 +122,7 @@ HRESULT CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpr
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
- if (FAILED(loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC;
break;
case TOKEN_NAME:
@@ -133,7 +133,7 @@ HRESULT CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpr
delete _sprites[DI_LEFT];
_sprites[DI_LEFT] = NULL;
spr = new CBSprite(Game, _owner);
- if (!spr || FAILED(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC;
+ if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC;
else _sprites[DI_LEFT] = spr;
break;
@@ -141,7 +141,7 @@ HRESULT CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpr
delete _sprites[DI_RIGHT];
_sprites[DI_RIGHT] = NULL;
spr = new CBSprite(Game, _owner);
- if (!spr || FAILED(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC;
+ if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC;
else _sprites[DI_RIGHT] = spr;
break;
@@ -149,7 +149,7 @@ HRESULT CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpr
delete _sprites[DI_UP];
_sprites[DI_UP] = NULL;
spr = new CBSprite(Game, _owner);
- if (!spr || FAILED(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC;
+ if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC;
else _sprites[DI_UP] = spr;
break;
@@ -157,7 +157,7 @@ HRESULT CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpr
delete _sprites[DI_DOWN];
_sprites[DI_DOWN] = NULL;
spr = new CBSprite(Game, _owner);
- if (!spr || FAILED(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC;
+ if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC;
else _sprites[DI_DOWN] = spr;
break;
@@ -165,7 +165,7 @@ HRESULT CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpr
delete _sprites[DI_UPLEFT];
_sprites[DI_UPLEFT] = NULL;
spr = new CBSprite(Game, _owner);
- if (!spr || FAILED(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC;
+ if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC;
else _sprites[DI_UPLEFT] = spr;
break;
@@ -173,7 +173,7 @@ HRESULT CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpr
delete _sprites[DI_UPRIGHT];
_sprites[DI_UPRIGHT] = NULL;
spr = new CBSprite(Game, _owner);
- if (!spr || FAILED(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC;
+ if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC;
else _sprites[DI_UPRIGHT] = spr;
break;
@@ -181,7 +181,7 @@ HRESULT CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpr
delete _sprites[DI_DOWNLEFT];
_sprites[DI_DOWNLEFT] = NULL;
spr = new CBSprite(Game, _owner);
- if (!spr || FAILED(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC;
+ if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC;
else _sprites[DI_DOWNLEFT] = spr;
break;
@@ -189,7 +189,7 @@ HRESULT CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpr
delete _sprites[DI_DOWNRIGHT];
_sprites[DI_DOWNRIGHT] = NULL;
spr = new CBSprite(Game, _owner);
- if (!spr || FAILED(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC;
+ if (!spr || DID_FAIL(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC;
else _sprites[DI_DOWNRIGHT] = spr;
break;
@@ -200,21 +200,21 @@ HRESULT CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpr
}
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in SPRITESET definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (cmd == PARSERR_GENERIC) {
Game->LOG(0, "Error loading SPRITESET definition");
if (spr) delete spr;
- return E_FAIL;
+ return STATUS_FAILED;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdSpriteSet::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CAdSpriteSet::persist(CBPersistMgr *persistMgr) {
CBObject::persist(persistMgr);
@@ -223,7 +223,7 @@ HRESULT CAdSpriteSet::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer("", &_sprites[i]);
}
- return S_OK;
+ return STATUS_OK;
}
@@ -258,7 +258,7 @@ CBSprite *CAdSpriteSet::getSprite(TDirection direction) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdSpriteSet::saveAsText(CBDynBuffer *buffer, int indent) {
+ERRORCODE CAdSpriteSet::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "SPRITESET {\n");
if (_name) buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", _name);
for (int i = 0; i < NUM_DIRECTIONS; i++) {
@@ -296,7 +296,7 @@ HRESULT CAdSpriteSet::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "}\n");
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/wintermute/Ad/AdSpriteSet.h b/engines/wintermute/Ad/AdSpriteSet.h
index 7d457048df..2329c955e1 100644
--- a/engines/wintermute/Ad/AdSpriteSet.h
+++ b/engines/wintermute/Ad/AdSpriteSet.h
@@ -38,14 +38,14 @@ namespace WinterMute {
class CAdSpriteSet : public CBObject {
public:
bool containsSprite(CBSprite *sprite);
- virtual HRESULT saveAsText(CBDynBuffer *buffer, int indent = 0);
+ virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent = 0);
CBSprite *getSprite(TDirection direction);
DECLARE_PERSISTENT(CAdSpriteSet, CBObject)
CBObject *_owner;
CAdSpriteSet(CBGame *inGame, CBObject *owner = NULL);
virtual ~CAdSpriteSet();
- HRESULT loadFile(const char *filename, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
- HRESULT loadBuffer(byte *buffer, bool complete = true, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
+ ERRORCODE loadFile(const char *filename, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
+ ERRORCODE loadBuffer(byte *buffer, bool complete = true, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
CBSprite *_sprites[NUM_DIRECTIONS];
};
diff --git a/engines/wintermute/Ad/AdTalkDef.cpp b/engines/wintermute/Ad/AdTalkDef.cpp
index 8c48942de5..0f16241e99 100644
--- a/engines/wintermute/Ad/AdTalkDef.cpp
+++ b/engines/wintermute/Ad/AdTalkDef.cpp
@@ -69,18 +69,18 @@ CAdTalkDef::~CAdTalkDef() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdTalkDef::loadFile(const char *filename) {
+ERRORCODE CAdTalkDef::loadFile(const char *filename) {
byte *buffer = Game->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
Game->LOG(0, "CAdTalkDef::LoadFile failed for file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
- HRESULT ret;
+ ERRORCODE ret;
CBUtils::setString(&_filename, filename);
- if (FAILED(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing TALK file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing TALK file '%s'", filename);
delete [] buffer;
@@ -98,7 +98,7 @@ TOKEN_DEF(DEFAULT_SPRITE)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdTalkDef::loadBuffer(byte *buffer, bool complete) {
+ERRORCODE CAdTalkDef::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(TALK)
TOKEN_TABLE(TEMPLATE)
@@ -116,7 +116,7 @@ HRESULT CAdTalkDef::loadBuffer(byte *buffer, bool complete) {
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_TALK) {
Game->LOG(0, "'TALK' keyword expected.");
- return E_FAIL;
+ return STATUS_FAILED;
}
buffer = params;
}
@@ -124,12 +124,12 @@ HRESULT CAdTalkDef::loadBuffer(byte *buffer, bool complete) {
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
- if (FAILED(loadFile((char *)params))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(loadFile((char *)params))) cmd = PARSERR_GENERIC;
break;
case TOKEN_ACTION: {
CAdTalkNode *Node = new CAdTalkNode(Game);
- if (Node && SUCCEEDED(Node->loadBuffer(params, false))) _nodes.Add(Node);
+ if (Node && DID_SUCCEED(Node->loadBuffer(params, false))) _nodes.Add(Node);
else {
delete Node;
Node = NULL;
@@ -149,7 +149,7 @@ HRESULT CAdTalkDef::loadBuffer(byte *buffer, bool complete) {
case TOKEN_DEFAULT_SPRITESET: {
delete _defaultSpriteSet;
_defaultSpriteSet = new CAdSpriteSet(Game);
- if (!_defaultSpriteSet || FAILED(_defaultSpriteSet->loadBuffer(params, false))) {
+ if (!_defaultSpriteSet || DID_FAIL(_defaultSpriteSet->loadBuffer(params, false))) {
delete _defaultSpriteSet;
_defaultSpriteSet = NULL;
cmd = PARSERR_GENERIC;
@@ -165,12 +165,12 @@ HRESULT CAdTalkDef::loadBuffer(byte *buffer, bool complete) {
}
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in TALK definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (cmd == PARSERR_GENERIC) {
Game->LOG(0, "Error loading TALK definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
delete _defaultSprite;
@@ -180,21 +180,21 @@ HRESULT CAdTalkDef::loadBuffer(byte *buffer, bool complete) {
if (_defaultSpriteFilename) {
_defaultSprite = new CBSprite(Game);
- if (!_defaultSprite || FAILED(_defaultSprite->loadFile(_defaultSpriteFilename))) return E_FAIL;
+ if (!_defaultSprite || DID_FAIL(_defaultSprite->loadFile(_defaultSpriteFilename))) return STATUS_FAILED;
}
if (_defaultSpriteSetFilename) {
_defaultSpriteSet = new CAdSpriteSet(Game);
- if (!_defaultSpriteSet || FAILED(_defaultSpriteSet->loadFile(_defaultSpriteSetFilename))) return E_FAIL;
+ if (!_defaultSpriteSet || DID_FAIL(_defaultSpriteSet->loadFile(_defaultSpriteSetFilename))) return STATUS_FAILED;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdTalkDef::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CAdTalkDef::persist(CBPersistMgr *persistMgr) {
CBObject::persist(persistMgr);
@@ -205,12 +205,12 @@ HRESULT CAdTalkDef::persist(CBPersistMgr *persistMgr) {
_nodes.persist(persistMgr);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdTalkDef::saveAsText(CBDynBuffer *buffer, int indent) {
+ERRORCODE CAdTalkDef::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "TALK {\n");
if (_defaultSpriteFilename) buffer->putTextIndent(indent + 2, "DEFAULT_SPRITE=\"%s\"\n", _defaultSpriteFilename);
@@ -225,27 +225,27 @@ HRESULT CAdTalkDef::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "}\n");
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdTalkDef::loadDefaultSprite() {
+ERRORCODE CAdTalkDef::loadDefaultSprite() {
if (_defaultSpriteFilename && !_defaultSprite) {
_defaultSprite = new CBSprite(Game);
- if (!_defaultSprite || FAILED(_defaultSprite->loadFile(_defaultSpriteFilename))) {
+ if (!_defaultSprite || DID_FAIL(_defaultSprite->loadFile(_defaultSpriteFilename))) {
delete _defaultSprite;
_defaultSprite = NULL;
- return E_FAIL;
- } else return S_OK;
+ return STATUS_FAILED;
+ } else return STATUS_OK;
} else if (_defaultSpriteSetFilename && !_defaultSpriteSet) {
_defaultSpriteSet = new CAdSpriteSet(Game);
- if (!_defaultSpriteSet || FAILED(_defaultSpriteSet->loadFile(_defaultSpriteSetFilename))) {
+ if (!_defaultSpriteSet || DID_FAIL(_defaultSpriteSet->loadFile(_defaultSpriteSetFilename))) {
delete _defaultSpriteSet;
_defaultSpriteSet = NULL;
- return E_FAIL;
- } else return S_OK;
- } else return S_OK;
+ return STATUS_FAILED;
+ } else return STATUS_OK;
+ } else return STATUS_OK;
}
diff --git a/engines/wintermute/Ad/AdTalkDef.h b/engines/wintermute/Ad/AdTalkDef.h
index 91d1c218e2..1a0cc4d7d8 100644
--- a/engines/wintermute/Ad/AdTalkDef.h
+++ b/engines/wintermute/Ad/AdTalkDef.h
@@ -40,17 +40,17 @@ public:
char *_defaultSpriteSetFilename;
CAdSpriteSet *_defaultSpriteSet;
CBSprite *getDefaultSprite(TDirection Dir);
- HRESULT loadDefaultSprite();
+ ERRORCODE loadDefaultSprite();
DECLARE_PERSISTENT(CAdTalkDef, CBObject)
CAdTalkDef(CBGame *inGame);
virtual ~CAdTalkDef();
- HRESULT loadFile(const char *filename);
- HRESULT loadBuffer(byte *buffer, bool complete = true);
+ ERRORCODE loadFile(const char *filename);
+ ERRORCODE loadBuffer(byte *buffer, bool complete = true);
CBArray<CAdTalkNode *, CAdTalkNode *> _nodes;
char *_defaultSpriteFilename;
CBSprite *_defaultSprite;
- virtual HRESULT saveAsText(CBDynBuffer *buffer, int indent = 0);
+ virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent = 0);
};
} // end of namespace WinterMute
diff --git a/engines/wintermute/Ad/AdTalkHolder.cpp b/engines/wintermute/Ad/AdTalkHolder.cpp
index 5516117004..5e25431d1a 100644
--- a/engines/wintermute/Ad/AdTalkHolder.cpp
+++ b/engines/wintermute/Ad/AdTalkHolder.cpp
@@ -73,8 +73,8 @@ CBSprite *CAdTalkHolder::getTalkStance(const char *stance) {
delete _animSprite;
_animSprite = new CBSprite(Game, this);
if (_animSprite) {
- HRESULT res = _animSprite->loadFile(_forcedTalkAnimName);
- if (FAILED(res)) {
+ ERRORCODE res = _animSprite->loadFile(_forcedTalkAnimName);
+ if (DID_FAIL(res)) {
Game->LOG(res, "CAdTalkHolder::GetTalkStance: error loading talk sprite (object:\"%s\" sprite:\"%s\")", _name, _forcedTalkAnimName);
delete _animSprite;
_animSprite = NULL;
@@ -119,7 +119,7 @@ CBSprite *CAdTalkHolder::getTalkStance(const char *stance) {
//////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdTalkHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CAdTalkHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// SetSprite
//////////////////////////////////////////////////////////////////////////
@@ -141,7 +141,7 @@ HRESULT CAdTalkHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack
} else {
const char *filename = val->getString();
CBSprite *spr = new CBSprite(Game, this);
- if (!spr || FAILED(spr->loadFile(filename))) {
+ if (!spr || DID_FAIL(spr->loadFile(filename))) {
script->runtimeError("SetSprite method failed for file '%s'", filename);
stack->pushBool(false);
} else {
@@ -150,7 +150,7 @@ HRESULT CAdTalkHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack
stack->pushBool(true);
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -161,7 +161,7 @@ HRESULT CAdTalkHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack
if (!_sprite || !_sprite->_filename) stack->pushNULL();
else stack->pushString(_sprite->_filename);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -172,7 +172,7 @@ HRESULT CAdTalkHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack
if (!_sprite) stack->pushNULL();
else stack->pushNative(_sprite, true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -185,7 +185,7 @@ HRESULT CAdTalkHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack
bool Ex = stack->pop()->getBool();
CBSprite *spr = new CBSprite(Game, this);
- if (!spr || FAILED(spr->loadFile(filename))) {
+ if (!spr || DID_FAIL(spr->loadFile(filename))) {
stack->pushBool(false);
script->runtimeError("AddTalkSprite method failed for file '%s'", filename);
} else {
@@ -193,7 +193,7 @@ HRESULT CAdTalkHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack
else _talkSprites.Add(spr);
stack->pushBool(true);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -241,7 +241,7 @@ HRESULT CAdTalkHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack
if (setTemp2)
_tempSprite2 = _sprite;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -256,7 +256,7 @@ HRESULT CAdTalkHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack
bool setTemp2 = false;
CBSprite *spr = new CBSprite(Game, this);
- if (!spr || FAILED(spr->loadFile(filename))) {
+ if (!spr || DID_FAIL(spr->loadFile(filename))) {
stack->pushBool(false);
script->runtimeError("SetTalkSprite method failed for file '%s'", filename);
} else {
@@ -292,7 +292,7 @@ HRESULT CAdTalkHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack
if (setTemp2)
_tempSprite2 = spr;
}
- return S_OK;
+ return STATUS_OK;
}
else return CAdObject::scCallMethod(script, stack, thisStack, name);
@@ -316,14 +316,14 @@ CScValue *CAdTalkHolder::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdTalkHolder::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CAdTalkHolder::scSetProperty(const char *name, CScValue *value) {
/*
//////////////////////////////////////////////////////////////////////////
// Item
//////////////////////////////////////////////////////////////////////////
if(strcmp(name, "Item")==0){
SetItem(value->getString());
- return S_OK;
+ return STATUS_OK;
}
else*/ return CAdObject::scSetProperty(name, value);
@@ -337,7 +337,7 @@ const char *CAdTalkHolder::scToString() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdTalkHolder::saveAsText(CBDynBuffer *buffer, int indent) {
+ERRORCODE CAdTalkHolder::saveAsText(CBDynBuffer *buffer, int indent) {
for (int i = 0; i < _talkSprites.GetSize(); i++) {
if (_talkSprites[i]->_filename)
buffer->putTextIndent(indent + 2, "TALK=\"%s\"\n", _talkSprites[i]->_filename);
@@ -348,19 +348,19 @@ HRESULT CAdTalkHolder::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent + 2, "TALK_SPECIAL=\"%s\"\n", _talkSpritesEx[i]->_filename);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdTalkHolder::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CAdTalkHolder::persist(CBPersistMgr *persistMgr) {
CAdObject::persist(persistMgr);
persistMgr->transfer(TMEMBER(_sprite));
_talkSprites.persist(persistMgr);
_talkSpritesEx.persist(persistMgr);
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Ad/AdTalkHolder.h b/engines/wintermute/Ad/AdTalkHolder.h
index d2d51a7213..ab3904a1cb 100644
--- a/engines/wintermute/Ad/AdTalkHolder.h
+++ b/engines/wintermute/Ad/AdTalkHolder.h
@@ -37,7 +37,7 @@ class CAdTalkHolder : public CAdObject {
public:
DECLARE_PERSISTENT(CAdTalkHolder, CAdObject)
virtual CBSprite *getTalkStance(const char *stance);
- virtual HRESULT saveAsText(CBDynBuffer *buffer, int indent);
+ virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent);
CBSprite *_sprite;
CBArray<CBSprite *, CBSprite *> _talkSprites;
CBArray<CBSprite *, CBSprite *> _talkSpritesEx;
@@ -46,8 +46,8 @@ public:
// scripting interface
virtual CScValue *scGetProperty(const char *name);
- virtual HRESULT scSetProperty(const char *name, CScValue *value);
- virtual HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ERRORCODE scSetProperty(const char *name, CScValue *value);
+ virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
virtual const char *scToString();
};
diff --git a/engines/wintermute/Ad/AdTalkNode.cpp b/engines/wintermute/Ad/AdTalkNode.cpp
index b398f84cfe..7f4198b0f1 100644
--- a/engines/wintermute/Ad/AdTalkNode.cpp
+++ b/engines/wintermute/Ad/AdTalkNode.cpp
@@ -80,7 +80,7 @@ TOKEN_DEF(PRECACHE)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdTalkNode::loadBuffer(byte *buffer, bool complete) {
+ERRORCODE CAdTalkNode::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(ACTION)
TOKEN_TABLE(SPRITESET_FILE)
@@ -100,7 +100,7 @@ HRESULT CAdTalkNode::loadBuffer(byte *buffer, bool complete) {
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_ACTION) {
Game->LOG(0, "'ACTION' keyword expected.");
- return E_FAIL;
+ return STATUS_FAILED;
}
buffer = params;
}
@@ -122,7 +122,7 @@ HRESULT CAdTalkNode::loadBuffer(byte *buffer, bool complete) {
case TOKEN_SPRITESET: {
delete _spriteSet;
_spriteSet = new CAdSpriteSet(Game);
- if (!_spriteSet || FAILED(_spriteSet->loadBuffer(params, false))) {
+ if (!_spriteSet || DID_FAIL(_spriteSet->loadBuffer(params, false))) {
delete _spriteSet;
_spriteSet = NULL;
cmd = PARSERR_GENERIC;
@@ -153,12 +153,12 @@ HRESULT CAdTalkNode::loadBuffer(byte *buffer, bool complete) {
}
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in ACTION definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (cmd == PARSERR_GENERIC) {
Game->LOG(0, "Error loading ACTION definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (_endTime == 0)
@@ -169,24 +169,24 @@ HRESULT CAdTalkNode::loadBuffer(byte *buffer, bool complete) {
if (_preCache && _spriteFilename) {
delete _sprite;
_sprite = new CBSprite(Game);
- if (!_sprite || FAILED(_sprite->loadFile(_spriteFilename)))
- return E_FAIL;
+ if (!_sprite || DID_FAIL(_sprite->loadFile(_spriteFilename)))
+ return STATUS_FAILED;
}
if (_preCache && _spriteSetFilename) {
delete _spriteSet;
_spriteSet = new CAdSpriteSet(Game);
- if (!_spriteSet || FAILED(_spriteSet->loadFile(_spriteSetFilename)))
- return E_FAIL;
+ if (!_spriteSet || DID_FAIL(_spriteSet->loadFile(_spriteSetFilename)))
+ return STATUS_FAILED;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdTalkNode::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CAdTalkNode::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(_comment));
persistMgr->transfer(TMEMBER(_startTime));
persistMgr->transfer(TMEMBER(_endTime));
@@ -196,12 +196,12 @@ HRESULT CAdTalkNode::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(_spriteSet));
persistMgr->transfer(TMEMBER(_spriteSetFilename));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdTalkNode::saveAsText(CBDynBuffer *buffer, int indent) {
+ERRORCODE CAdTalkNode::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "ACTION {\n");
if (_comment) buffer->putTextIndent(indent + 2, "COMMENT=\"%s\"\n", _comment);
buffer->putTextIndent(indent + 2, "START_TIME=%d\n", _startTime);
@@ -215,31 +215,31 @@ HRESULT CAdTalkNode::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "}\n");
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdTalkNode::loadSprite() {
+ERRORCODE CAdTalkNode::loadSprite() {
if (_spriteFilename && !_sprite) {
_sprite = new CBSprite(Game);
- if (!_sprite || FAILED(_sprite->loadFile(_spriteFilename))) {
+ if (!_sprite || DID_FAIL(_sprite->loadFile(_spriteFilename))) {
delete _sprite;
_sprite = NULL;
- return E_FAIL;
- } else return S_OK;
+ return STATUS_FAILED;
+ } else return STATUS_OK;
}
else if (_spriteSetFilename && !_spriteSet) {
_spriteSet = new CAdSpriteSet(Game);
- if (!_spriteSet || FAILED(_spriteSet->loadFile(_spriteSetFilename))) {
+ if (!_spriteSet || DID_FAIL(_spriteSet->loadFile(_spriteSetFilename))) {
delete _spriteSet;
_spriteSet = NULL;
- return E_FAIL;
- } else return S_OK;
+ return STATUS_FAILED;
+ } else return STATUS_OK;
}
- else return S_OK;
+ else return STATUS_OK;
}
diff --git a/engines/wintermute/Ad/AdTalkNode.h b/engines/wintermute/Ad/AdTalkNode.h
index 57cce1deb4..3d763ea0f0 100644
--- a/engines/wintermute/Ad/AdTalkNode.h
+++ b/engines/wintermute/Ad/AdTalkNode.h
@@ -41,13 +41,13 @@ public:
CAdSpriteSet *_spriteSet;
CBSprite *getSprite(TDirection dir);
bool isInTimeInterval(uint32 time, TDirection dir);
- HRESULT loadSprite();
+ ERRORCODE loadSprite();
DECLARE_PERSISTENT(CAdTalkNode, CBBase)
CAdTalkNode(CBGame *inGame);
virtual ~CAdTalkNode();
- HRESULT loadBuffer(byte *buffer, bool complete = true);
- virtual HRESULT saveAsText(CBDynBuffer *buffer, int indent = 0);
+ ERRORCODE loadBuffer(byte *buffer, bool complete = true);
+ virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent = 0);
char *_spriteFilename;
CBSprite *_sprite;
uint32 _startTime;
diff --git a/engines/wintermute/Ad/AdWaypointGroup.cpp b/engines/wintermute/Ad/AdWaypointGroup.cpp
index b845f4e02e..e9e18e5101 100644
--- a/engines/wintermute/Ad/AdWaypointGroup.cpp
+++ b/engines/wintermute/Ad/AdWaypointGroup.cpp
@@ -64,19 +64,19 @@ void CAdWaypointGroup::cleanup() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdWaypointGroup::loadFile(const char *filename) {
+ERRORCODE CAdWaypointGroup::loadFile(const char *filename) {
byte *buffer = Game->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
Game->LOG(0, "CAdWaypointGroup::LoadFile failed for file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
- HRESULT ret;
+ ERRORCODE ret;
_filename = new char [strlen(filename) + 1];
strcpy(_filename, filename);
- if (FAILED(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing WAYPOINTS file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing WAYPOINTS file '%s'", filename);
delete [] buffer;
@@ -96,7 +96,7 @@ TOKEN_DEF(PROPERTY)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdWaypointGroup::loadBuffer(byte *buffer, bool complete) {
+ERRORCODE CAdWaypointGroup::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(WAYPOINTS)
TOKEN_TABLE(TEMPLATE)
@@ -115,7 +115,7 @@ HRESULT CAdWaypointGroup::loadBuffer(byte *buffer, bool complete) {
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_WAYPOINTS) {
Game->LOG(0, "'WAYPOINTS' keyword expected.");
- return E_FAIL;
+ return STATUS_FAILED;
}
buffer = params;
}
@@ -123,7 +123,7 @@ HRESULT CAdWaypointGroup::loadBuffer(byte *buffer, bool complete) {
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
- if (FAILED(loadFile((char *)params))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(loadFile((char *)params))) cmd = PARSERR_GENERIC;
break;
case TOKEN_NAME:
@@ -156,15 +156,15 @@ HRESULT CAdWaypointGroup::loadBuffer(byte *buffer, bool complete) {
}
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in WAYPOINTS definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdWaypointGroup::saveAsText(CBDynBuffer *buffer, int indent) {
+ERRORCODE CAdWaypointGroup::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "WAYPOINTS {\n");
buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", _name);
buffer->putTextIndent(indent + 2, "EDITOR_SELECTED=%s\n", _editorSelected ? "TRUE" : "FALSE");
@@ -180,12 +180,12 @@ HRESULT CAdWaypointGroup::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "}\n");
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdWaypointGroup::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CAdWaypointGroup::persist(CBPersistMgr *persistMgr) {
CBObject::persist(persistMgr);
@@ -196,7 +196,7 @@ HRESULT CAdWaypointGroup::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(_lastMimicY));
_points.persist(persistMgr);
- return S_OK;
+ return STATUS_OK;
}
@@ -225,13 +225,13 @@ CScValue *CAdWaypointGroup::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdWaypointGroup::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CAdWaypointGroup::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
// Active
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "Active") == 0) {
_active = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
else return CBObject::scSetProperty(name, value);
@@ -239,8 +239,8 @@ HRESULT CAdWaypointGroup::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CAdWaypointGroup::mimic(CAdWaypointGroup *wpt, float scale, int argX, int argY) {
- if (scale == _lastMimicScale && argX == _lastMimicX && argY == _lastMimicY) return S_OK;
+ERRORCODE CAdWaypointGroup::mimic(CAdWaypointGroup *wpt, float scale, int argX, int argY) {
+ if (scale == _lastMimicScale && argX == _lastMimicX && argY == _lastMimicY) return STATUS_OK;
cleanup();
@@ -255,7 +255,7 @@ HRESULT CAdWaypointGroup::mimic(CAdWaypointGroup *wpt, float scale, int argX, in
_lastMimicX = argX;
_lastMimicY = argY;
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Ad/AdWaypointGroup.h b/engines/wintermute/Ad/AdWaypointGroup.h
index 6b4d65f0dd..7e06ef661d 100644
--- a/engines/wintermute/Ad/AdWaypointGroup.h
+++ b/engines/wintermute/Ad/AdWaypointGroup.h
@@ -39,18 +39,18 @@ public:
int _lastMimicX;
int _lastMimicY;
void cleanup();
- HRESULT mimic(CAdWaypointGroup *wpt, float scale = 100.0f, int x = 0, int y = 0);
+ ERRORCODE mimic(CAdWaypointGroup *wpt, float scale = 100.0f, int x = 0, int y = 0);
DECLARE_PERSISTENT(CAdWaypointGroup, CBObject)
- virtual HRESULT saveAsText(CBDynBuffer *buffer, int indent);
+ virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent);
bool _active;
CAdWaypointGroup(CBGame *inGame);
- HRESULT loadFile(const char *filename);
- HRESULT loadBuffer(byte *buffer, bool complete = true);
+ ERRORCODE loadFile(const char *filename);
+ ERRORCODE loadBuffer(byte *buffer, bool complete = true);
virtual ~CAdWaypointGroup();
CBArray<CBPoint *, CBPoint *> _points;
int _editorSelectedPoint;
virtual CScValue *scGetProperty(const char *name);
- virtual HRESULT scSetProperty(const char *name, CScValue *value);
+ virtual ERRORCODE scSetProperty(const char *name, CScValue *value);
};
} // end of namespace WinterMute
diff --git a/engines/wintermute/Base/BBase.cpp b/engines/wintermute/Base/BBase.cpp
index f101eea69f..a43a9d78db 100644
--- a/engines/wintermute/Base/BBase.cpp
+++ b/engines/wintermute/Base/BBase.cpp
@@ -65,15 +65,15 @@ const char *CBBase::getEditorProp(const char *propName, const char *initVal) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBBase::setEditorProp(const char *propName, const char *propValue) {
- if (propName == NULL) return E_FAIL;
+ERRORCODE CBBase::setEditorProp(const char *propName, const char *propValue) {
+ if (propName == NULL) return STATUS_FAILED;
if (propValue == NULL) {
_editorProps.erase(propName);
} else {
_editorProps[propName] = propValue;
}
- return S_OK;
+ return STATUS_OK;
}
@@ -84,7 +84,7 @@ TOKEN_DEF(NAME)
TOKEN_DEF(VALUE)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-HRESULT CBBase::parseEditorProperty(byte *buffer, bool complete) {
+ERRORCODE CBBase::parseEditorProperty(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(EDITOR_PROPERTY)
TOKEN_TABLE(NAME)
@@ -93,7 +93,7 @@ HRESULT CBBase::parseEditorProperty(byte *buffer, bool complete) {
if (!Game->_editorMode)
- return S_OK;
+ return STATUS_OK;
byte *params;
@@ -103,7 +103,7 @@ HRESULT CBBase::parseEditorProperty(byte *buffer, bool complete) {
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_EDITOR_PROPERTY) {
Game->LOG(0, "'EDITOR_PROPERTY' keyword expected.");
- return E_FAIL;
+ return STATUS_FAILED;
}
buffer = params;
}
@@ -135,7 +135,7 @@ HRESULT CBBase::parseEditorProperty(byte *buffer, bool complete) {
propName = NULL;
propValue = NULL;
Game->LOG(0, "Syntax error in EDITOR_PROPERTY definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (cmd == PARSERR_GENERIC || propName == NULL || propValue == NULL) {
delete[] propName;
@@ -143,7 +143,7 @@ HRESULT CBBase::parseEditorProperty(byte *buffer, bool complete) {
propName = NULL;
propValue = NULL;
Game->LOG(0, "Error loading EDITOR_PROPERTY definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
@@ -154,12 +154,12 @@ HRESULT CBBase::parseEditorProperty(byte *buffer, bool complete) {
propName = NULL;
propValue = NULL;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBBase::saveAsText(CBDynBuffer *buffer, int indent) {
+ERRORCODE CBBase::saveAsText(CBDynBuffer *buffer, int indent) {
_editorPropsIter = _editorProps.begin();
while (_editorPropsIter != _editorProps.end()) {
buffer->putTextIndent(indent, "EDITOR_PROPERTY\n");
@@ -172,7 +172,7 @@ HRESULT CBBase::saveAsText(CBDynBuffer *buffer, int indent) {
_editorPropsIter++;
}
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Base/BBase.h b/engines/wintermute/Base/BBase.h
index 73eabb5d62..d505ec0b1d 100644
--- a/engines/wintermute/Base/BBase.h
+++ b/engines/wintermute/Base/BBase.h
@@ -43,11 +43,11 @@ class CBDynBuffer;
class CBBase {
public:
bool _persistable;
- HRESULT setEditorProp(const char *propName, const char *propValue);
+ ERRORCODE setEditorProp(const char *propName, const char *propValue);
const char *getEditorProp(const char *propName, const char *initVal = NULL);
CBBase(TDynamicConstructor, TDynamicConstructor) {};
- HRESULT parseEditorProperty(byte *buffer, bool complete = true);
- virtual HRESULT saveAsText(CBDynBuffer *buffer, int indent = 0);
+ ERRORCODE parseEditorProperty(byte *buffer, bool complete = true);
+ virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent = 0);
CBBase();
CBGame *Game;
CBBase(CBGame *GameOwner);
diff --git a/engines/wintermute/Base/BDebugger.cpp b/engines/wintermute/Base/BDebugger.cpp
index e720f8430d..1d3f0c4826 100644
--- a/engines/wintermute/Base/BDebugger.cpp
+++ b/engines/wintermute/Base/BDebugger.cpp
@@ -41,85 +41,85 @@ CBDebugger::~CBDebugger(void) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBDebugger::initialize() {
- return S_OK;
+ERRORCODE CBDebugger::initialize() {
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBDebugger::shutdown() {
- return S_OK;
+ERRORCODE CBDebugger::shutdown() {
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBDebugger::onGameInit() {
- return S_OK;
+ERRORCODE CBDebugger::onGameInit() {
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBDebugger::onGameShutdown() {
- return S_OK;
+ERRORCODE CBDebugger::onGameShutdown() {
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBDebugger::onGameTick() {
- return S_OK;
+ERRORCODE CBDebugger::onGameTick() {
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBDebugger::onLog(unsigned int errorCode, const char *text) {
- return S_OK;
+ERRORCODE CBDebugger::onLog(unsigned int errorCode, const char *text) {
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBDebugger::onScriptInit(CScScript *script) {
- return S_OK;
+ERRORCODE CBDebugger::onScriptInit(CScScript *script) {
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBDebugger::onScriptEventThreadInit(CScScript *script, CScScript *parentScript, const char *name) {
- return S_OK;
+ERRORCODE CBDebugger::onScriptEventThreadInit(CScScript *script, CScScript *parentScript, const char *name) {
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBDebugger::onScriptMethodThreadInit(CScScript *script, CScScript *parentScript, const char *name) {
- return S_OK;
+ERRORCODE CBDebugger::onScriptMethodThreadInit(CScScript *script, CScScript *parentScript, const char *name) {
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBDebugger::onScriptShutdown(CScScript *script) {
- return S_OK;
+ERRORCODE CBDebugger::onScriptShutdown(CScScript *script) {
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBDebugger::onScriptChangeLine(CScScript *script, int Line) {
- return S_OK;
+ERRORCODE CBDebugger::onScriptChangeLine(CScScript *script, int Line) {
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBDebugger::onScriptChangeScope(CScScript *script, CScValue *scope) {
- return S_OK;
+ERRORCODE CBDebugger::onScriptChangeScope(CScScript *script, CScValue *scope) {
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBDebugger::onScriptShutdownScope(CScScript *script, CScValue *scope) {
- return S_OK;
+ERRORCODE CBDebugger::onScriptShutdownScope(CScScript *script, CScValue *scope) {
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBDebugger::onVariableInit(EWmeDebuggerVariableType type, CScScript *script, CScValue *scope, CScValue *var, const char *variableName) {
- return S_OK;
+ERRORCODE CBDebugger::onVariableInit(EWmeDebuggerVariableType type, CScScript *script, CScValue *scope, CScValue *var, const char *variableName) {
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBDebugger::onVariableChangeValue(CScValue *var, CScValue *value) {
- return S_OK;
+ERRORCODE CBDebugger::onVariableChangeValue(CScValue *var, CScValue *value) {
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBDebugger::onScriptHitBreakpoint(CScScript *script) {
- return S_OK;
+ERRORCODE CBDebugger::onScriptHitBreakpoint(CScScript *script) {
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/wintermute/Base/BDebugger.h b/engines/wintermute/Base/BDebugger.h
index 79f3fba816..a3da66cc9f 100644
--- a/engines/wintermute/Base/BDebugger.h
+++ b/engines/wintermute/Base/BDebugger.h
@@ -45,26 +45,26 @@ public:
// initialization
bool _enabled;
- HRESULT initialize();
- HRESULT shutdown();
+ ERRORCODE initialize();
+ ERRORCODE shutdown();
// internal interface
- HRESULT onGameInit();
- HRESULT onGameShutdown();
- HRESULT onGameTick();
- HRESULT onLog(unsigned int errorCode, const char *text);
- HRESULT onScriptInit(CScScript *script);
- HRESULT onScriptEventThreadInit(CScScript *script, CScScript *parentScript, const char *name);
- HRESULT onScriptMethodThreadInit(CScScript *script, CScScript *parentScript, const char *name);
-
- HRESULT onScriptShutdown(CScScript *script);
- HRESULT onScriptChangeLine(CScScript *script, int line);
- HRESULT onScriptChangeScope(CScScript *script, CScValue *scope);
- HRESULT onScriptShutdownScope(CScScript *script, CScValue *scope);
- HRESULT onVariableInit(EWmeDebuggerVariableType type, CScScript *script, CScValue *scope, CScValue *var, const char *variableName);
- HRESULT onVariableChangeValue(CScValue *var, CScValue *value);
-
- HRESULT onScriptHitBreakpoint(CScScript *script);
+ ERRORCODE onGameInit();
+ ERRORCODE onGameShutdown();
+ ERRORCODE onGameTick();
+ ERRORCODE onLog(unsigned int errorCode, const char *text);
+ ERRORCODE onScriptInit(CScScript *script);
+ ERRORCODE onScriptEventThreadInit(CScScript *script, CScScript *parentScript, const char *name);
+ ERRORCODE onScriptMethodThreadInit(CScScript *script, CScScript *parentScript, const char *name);
+
+ ERRORCODE onScriptShutdown(CScScript *script);
+ ERRORCODE onScriptChangeLine(CScScript *script, int line);
+ ERRORCODE onScriptChangeScope(CScScript *script, CScValue *scope);
+ ERRORCODE onScriptShutdownScope(CScScript *script, CScValue *scope);
+ ERRORCODE onVariableInit(EWmeDebuggerVariableType type, CScScript *script, CScValue *scope, CScValue *var, const char *variableName);
+ ERRORCODE onVariableChangeValue(CScValue *var, CScValue *value);
+
+ ERRORCODE onScriptHitBreakpoint(CScScript *script);
// IWmeDebugServer interface
virtual bool attachClient(IWmeDebugClient *client);
diff --git a/engines/wintermute/Base/BDynBuffer.cpp b/engines/wintermute/Base/BDynBuffer.cpp
index 25bf9be93d..d0d4cfeafb 100644
--- a/engines/wintermute/Base/BDynBuffer.cpp
+++ b/engines/wintermute/Base/BDynBuffer.cpp
@@ -69,7 +69,7 @@ uint32 CBDynBuffer::getSize() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBDynBuffer::init(uint32 initSize) {
+ERRORCODE CBDynBuffer::init(uint32 initSize) {
cleanup();
if (initSize == 0) initSize = _initSize;
@@ -77,18 +77,18 @@ HRESULT CBDynBuffer::init(uint32 initSize) {
_buffer = (byte *)malloc(initSize);
if (!_buffer) {
Game->LOG(0, "CBDynBuffer::Init - Error allocating %d bytes", initSize);
- return E_FAIL;
+ return STATUS_FAILED;
}
_realSize = initSize;
_initialized = true;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBDynBuffer::putBytes(byte *buffer, uint32 size) {
+ERRORCODE CBDynBuffer::putBytes(byte *buffer, uint32 size) {
if (!_initialized) init();
while (_offset + size > _realSize) {
@@ -96,7 +96,7 @@ HRESULT CBDynBuffer::putBytes(byte *buffer, uint32 size) {
_buffer = (byte *)realloc(_buffer, _realSize);
if (!_buffer) {
Game->LOG(0, "CBDynBuffer::PutBytes - Error reallocating buffer to %d bytes", _realSize);
- return E_FAIL;
+ return STATUS_FAILED;
}
}
@@ -104,23 +104,23 @@ HRESULT CBDynBuffer::putBytes(byte *buffer, uint32 size) {
_offset += size;
_size += size;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBDynBuffer::getBytes(byte *buffer, uint32 size) {
+ERRORCODE CBDynBuffer::getBytes(byte *buffer, uint32 size) {
if (!_initialized) init();
if (_offset + size > _size) {
Game->LOG(0, "CBDynBuffer::GetBytes - Buffer underflow");
- return E_FAIL;
+ return STATUS_FAILED;
}
memcpy(buffer, _buffer + _offset, size);
_offset += size;
- return S_OK;
+ return STATUS_OK;
}
diff --git a/engines/wintermute/Base/BDynBuffer.h b/engines/wintermute/Base/BDynBuffer.h
index 1fd8fa6748..c29e6ac275 100644
--- a/engines/wintermute/Base/BDynBuffer.h
+++ b/engines/wintermute/Base/BDynBuffer.h
@@ -43,10 +43,10 @@ public:
void putDWORD(uint32 val);
char *getString();
void putString(const char *val);
- HRESULT getBytes(byte *buffer, uint32 size);
- HRESULT putBytes(byte *buffer, uint32 size);
+ ERRORCODE getBytes(byte *buffer, uint32 size);
+ ERRORCODE putBytes(byte *buffer, uint32 size);
uint32 getSize();
- HRESULT init(uint32 initSize = 0);
+ ERRORCODE init(uint32 initSize = 0);
void cleanup();
uint32 _size;
byte *_buffer;
diff --git a/engines/wintermute/Base/BFader.cpp b/engines/wintermute/Base/BFader.cpp
index ef0208c44d..9538e4b398 100644
--- a/engines/wintermute/Base/BFader.cpp
+++ b/engines/wintermute/Base/BFader.cpp
@@ -60,8 +60,8 @@ CBFader::~CBFader() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFader::update() {
- if (!_active) return S_OK;
+ERRORCODE CBFader::update() {
+ if (!_active) return STATUS_OK;
int alphaDelta = _targetAlpha - _sourceAlpha;
@@ -79,37 +79,37 @@ HRESULT CBFader::update() {
_ready = time >= _duration;
if (_ready && _currentAlpha == 0x00) _active = false;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFader::display() {
- if (!_active) return S_OK;
+ERRORCODE CBFader::display() {
+ if (!_active) return STATUS_OK;
- if (_currentAlpha > 0x00) return Game->_renderer->fadeToColor(DRGBA(_red, _green, _blue, _currentAlpha));
- else return S_OK;
+ if (_currentAlpha > 0x00) return Game->_renderer->fadeToColor(BYTETORGBA(_red, _green, _blue, _currentAlpha));
+ else return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFader::deactivate() {
+ERRORCODE CBFader::deactivate() {
_active = false;
_ready = true;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFader::fadeIn(uint32 sourceColor, uint32 duration, bool system) {
+ERRORCODE CBFader::fadeIn(uint32 sourceColor, uint32 duration, bool system) {
_ready = false;
_active = true;
- _red = D3DCOLGetR(sourceColor);
- _green = D3DCOLGetG(sourceColor);
- _blue = D3DCOLGetB(sourceColor);
+ _red = RGBCOLGetR(sourceColor);
+ _green = RGBCOLGetG(sourceColor);
+ _blue = RGBCOLGetB(sourceColor);
- _sourceAlpha = D3DCOLGetA(sourceColor);
+ _sourceAlpha = RGBCOLGetA(sourceColor);
_targetAlpha = 0;
_duration = duration;
@@ -118,22 +118,22 @@ HRESULT CBFader::fadeIn(uint32 sourceColor, uint32 duration, bool system) {
if (_system) _startTime = CBPlatform::getTime();
else _startTime = Game->_timer;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFader::fadeOut(uint32 targetColor, uint32 duration, bool system) {
+ERRORCODE CBFader::fadeOut(uint32 targetColor, uint32 duration, bool system) {
_ready = false;
_active = true;
- _red = D3DCOLGetR(targetColor);
- _green = D3DCOLGetG(targetColor);
- _blue = D3DCOLGetB(targetColor);
+ _red = RGBCOLGetR(targetColor);
+ _green = RGBCOLGetG(targetColor);
+ _blue = RGBCOLGetB(targetColor);
//_sourceAlpha = 0;
_sourceAlpha = _currentAlpha;
- _targetAlpha = D3DCOLGetA(targetColor);
+ _targetAlpha = RGBCOLGetA(targetColor);
_duration = duration;
_system = system;
@@ -142,19 +142,19 @@ HRESULT CBFader::fadeOut(uint32 targetColor, uint32 duration, bool system) {
else _startTime = Game->_timer;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
uint32 CBFader::getCurrentColor() {
- return DRGBA(_red, _green, _blue, _currentAlpha);
+ return BYTETORGBA(_red, _green, _blue, _currentAlpha);
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFader::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CBFader::persist(CBPersistMgr *persistMgr) {
CBObject::persist(persistMgr);
persistMgr->transfer(TMEMBER(_active));
@@ -170,7 +170,7 @@ HRESULT CBFader::persist(CBPersistMgr *persistMgr) {
if (_system && !persistMgr->_saving) _startTime = 0;
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Base/BFader.h b/engines/wintermute/Base/BFader.h
index b42feae43f..623bd220bc 100644
--- a/engines/wintermute/Base/BFader.h
+++ b/engines/wintermute/Base/BFader.h
@@ -38,11 +38,11 @@ class CBFader : public CBObject {
public:
bool _system;
uint32 getCurrentColor();
- HRESULT fadeOut(uint32 targetColor, uint32 duration, bool system = false);
- HRESULT fadeIn(uint32 sourceColor, uint32 duration, bool system = false);
- HRESULT deactivate();
- HRESULT display();
- HRESULT update();
+ ERRORCODE fadeOut(uint32 targetColor, uint32 duration, bool system = false);
+ ERRORCODE fadeIn(uint32 sourceColor, uint32 duration, bool system = false);
+ ERRORCODE deactivate();
+ ERRORCODE display();
+ ERRORCODE update();
DECLARE_PERSISTENT(CBFader, CBObject)
CBFader(CBGame *inGame);
virtual ~CBFader();
diff --git a/engines/wintermute/Base/BFileManager.cpp b/engines/wintermute/Base/BFileManager.cpp
index fdb43e28f5..8c68bc9263 100644
--- a/engines/wintermute/Base/BFileManager.cpp
+++ b/engines/wintermute/Base/BFileManager.cpp
@@ -73,7 +73,7 @@ CBFileManager::~CBFileManager() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFileManager::cleanup() {
+ERRORCODE CBFileManager::cleanup() {
// delete registered paths
for (int i = 0; i < _singlePaths.GetSize(); i++)
delete [] _singlePaths[i];
@@ -107,7 +107,7 @@ HRESULT CBFileManager::cleanup() {
delete[] _basePath;
_basePath = NULL;
- return S_OK;
+ return STATUS_OK;
}
@@ -161,7 +161,7 @@ Common::SeekableReadStream *CBFileManager::loadSaveGame(const Common::String &fi
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFileManager::saveFile(const Common::String &filename, byte *Buffer, uint32 BufferSize, bool Compressed, byte *PrefixBuffer, uint32 PrefixSize) {
+ERRORCODE CBFileManager::saveFile(const Common::String &filename, byte *Buffer, uint32 BufferSize, bool Compressed, byte *PrefixBuffer, uint32 PrefixSize) {
// TODO
warning("Implement SaveFile");
@@ -179,7 +179,7 @@ HRESULT CBFileManager::saveFile(const Common::String &filename, byte *Buffer, ui
FILE *f = fopen(filename, "wb");
if (!f) {
Game->LOG(0, "Error opening file '%s' for writing.", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
if (PrefixBuffer && PrefixSize) {
@@ -219,30 +219,30 @@ HRESULT CBFileManager::saveFile(const Common::String &filename, byte *Buffer, ui
fclose(f);
#endif
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFileManager::requestCD(int cd, char *packageFile, const char *filename) {
+ERRORCODE CBFileManager::requestCD(int cd, char *packageFile, const char *filename) {
// unmount all non-local packages
for (int i = 0; i < _packages.GetSize(); i++) {
if (_packages[i]->_cD > 0) _packages[i]->close();
}
- return E_FAIL;
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFileManager::addPath(TPathType type, const Common::String &path) {
- if (path.c_str() == NULL || strlen(path.c_str()) < 1) return E_FAIL;
+ERRORCODE CBFileManager::addPath(TPathType type, const Common::String &path) {
+ if (path.c_str() == NULL || strlen(path.c_str()) < 1) return STATUS_FAILED;
bool slashed = (path[path.size() - 1] == '\\' || path[path.size() - 1] == '/');
char *buffer = new char [strlen(path.c_str()) + 1 + (slashed ? 0 : 1)];
- if (buffer == NULL) return E_FAIL;
+ if (buffer == NULL) return STATUS_FAILED;
strcpy(buffer, path.c_str());
if (!slashed) strcat(buffer, "\\");
@@ -257,11 +257,11 @@ HRESULT CBFileManager::addPath(TPathType type, const Common::String &path) {
break;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFileManager::reloadPaths() {
+ERRORCODE CBFileManager::reloadPaths() {
// delete registered paths
for (int i = 0; i < _singlePaths.GetSize(); i++)
delete [] _singlePaths[i];
@@ -277,7 +277,7 @@ HRESULT CBFileManager::reloadPaths() {
#define TEMP_BUFFER_SIZE 32768
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFileManager::initPaths() {
+ERRORCODE CBFileManager::initPaths() {
restoreCurrentDir();
AnsiString pathList;
@@ -341,12 +341,12 @@ HRESULT CBFileManager::initPaths() {
}
addPath(PATH_PACKAGE, "data");
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFileManager::registerPackages() {
+ERRORCODE CBFileManager::registerPackages() {
restoreCurrentDir();
Game->LOG(0, "Scanning packages...");
@@ -390,17 +390,17 @@ HRESULT CBFileManager::registerPackages() {
Game->LOG(0, " Registered %d files in %d package(s)", _files.size(), _packages.GetSize());
warning(" Registered %d files in %d package(s)", _files.size(), _packages.GetSize());
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFileManager::registerPackage(const Common::String &filename , bool searchSignature) {
+ERRORCODE CBFileManager::registerPackage(const Common::String &filename , bool searchSignature) {
// FILE *f = fopen(filename, "rb");
Common::File *package = new Common::File();
package->open(filename);
if (!package->isOpen()) {
Game->LOG(0, " Error opening package file '%s'. Ignoring.", filename.c_str());
- return S_OK;
+ return STATUS_OK;
}
uint32 absoluteOffset = 0;
@@ -410,7 +410,7 @@ HRESULT CBFileManager::registerPackage(const Common::String &filename , bool sea
uint32 Offset;
if (!findPackageSignature(package, &Offset)) {
delete package;
- return S_OK;
+ return STATUS_OK;
} else {
package->seek(Offset, SEEK_SET);
absoluteOffset = Offset;
@@ -424,7 +424,7 @@ HRESULT CBFileManager::registerPackage(const Common::String &filename , bool sea
if (hdr.Magic1 != PACKAGE_MAGIC_1 || hdr.Magic2 != PACKAGE_MAGIC_2 || hdr.PackageVersion > PACKAGE_VERSION) {
Game->LOG(0, " Invalid header in package file '%s'. Ignoring.", filename.c_str());
delete package;
- return S_OK;
+ return STATUS_OK;
}
if (hdr.PackageVersion != PACKAGE_VERSION) {
@@ -441,7 +441,7 @@ HRESULT CBFileManager::registerPackage(const Common::String &filename , bool sea
for (uint32 i = 0; i < hdr.NumDirs; i++) {
CBPackage *pkg = new CBPackage(Game);
- if (!pkg) return E_FAIL;
+ if (!pkg) return STATUS_FAILED;
pkg->_boundToExe = boundToExe;
@@ -517,10 +517,10 @@ HRESULT CBFileManager::registerPackage(const Common::String &filename , bool sea
delete package;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFileManager::registerPackage(const char *Path, const char *name, bool SearchSignature) {
+ERRORCODE CBFileManager::registerPackage(const char *Path, const char *name, bool SearchSignature) {
// TODO
error("Implement RegisterPackage, this is the old one");
#if 0
@@ -530,7 +530,7 @@ HRESULT CBFileManager::registerPackage(const char *Path, const char *name, bool
FILE *f = fopen(filename, "rb");
if (!f) {
Game->LOG(0, " Error opening package file '%s'. Ignoring.", filename);
- return S_OK;
+ return STATUS_OK;
}
uint32 AbsoluteOffset = 0;
@@ -540,7 +540,7 @@ HRESULT CBFileManager::registerPackage(const char *Path, const char *name, bool
uint32 Offset;
if (!FindPackageSignature(f, &Offset)) {
fclose(f);
- return S_OK;
+ return STATUS_OK;
} else {
fseek(f, Offset, SEEK_SET);
AbsoluteOffset = Offset;
@@ -553,7 +553,7 @@ HRESULT CBFileManager::registerPackage(const char *Path, const char *name, bool
if (hdr.Magic1 != PACKAGE_MAGIC_1 || hdr.Magic2 != PACKAGE_MAGIC_2 || hdr.PackageVersion > PACKAGE_VERSION) {
Game->LOG(0, " Invalid header in package file '%s'. Ignoring.", filename);
fclose(f);
- return S_OK;
+ return STATUS_OK;
}
if (hdr.PackageVersion != PACKAGE_VERSION) {
@@ -570,7 +570,7 @@ HRESULT CBFileManager::registerPackage(const char *Path, const char *name, bool
for (int i = 0; i < hdr.NumDirs; i++) {
CBPackage *pkg = new CBPackage(Game);
- if (!pkg) return E_FAIL;
+ if (!pkg) return STATUS_FAILED;
pkg->_boundToExe = BoundToExe;
@@ -649,7 +649,7 @@ HRESULT CBFileManager::registerPackage(const char *Path, const char *name, bool
fclose(f);
#endif
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -792,15 +792,15 @@ Common::SeekableReadStream *CBFileManager::openFile(const Common::String &filena
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFileManager::closeFile(Common::SeekableReadStream *File) {
+ERRORCODE CBFileManager::closeFile(Common::SeekableReadStream *File) {
for (int i = 0; i < _openFiles.GetSize(); i++) {
if (_openFiles[i] == File) {
delete _openFiles[i];
_openFiles.RemoveAt(i);
- return S_OK;
+ return STATUS_OK;
}
}
- return E_FAIL;
+ return STATUS_FAILED;
}
@@ -812,7 +812,7 @@ Common::SeekableReadStream *CBFileManager::openFileRaw(const Common::String &fil
if (scumm_strnicmp(filename.c_str(), "savegame:", 9) == 0) {
CBSaveThumbFile *SaveThumbFile = new CBSaveThumbFile(Game);
- if (SUCCEEDED(SaveThumbFile->open(filename))) {
+ if (DID_SUCCEED(SaveThumbFile->open(filename))) {
ret = SaveThumbFile->getMemStream();
}
delete SaveThumbFile;
@@ -836,19 +836,19 @@ Common::SeekableReadStream *CBFileManager::openFileRaw(const Common::String &fil
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFileManager::restoreCurrentDir() {
- if (!_basePath) return S_OK;
+ERRORCODE CBFileManager::restoreCurrentDir() {
+ if (!_basePath) return STATUS_OK;
else {
- /*if (!chdir(_basePath)) return S_OK;
- else return E_FAIL;*/
+ /*if (!chdir(_basePath)) return STATUS_OK;
+ else return STATUS_FAILED;*/
warning("CBFileManager::RestoreCurrentDir - ignored");
- return S_OK;
+ return STATUS_OK;
}
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFileManager::setBasePath(const Common::String &path) {
+ERRORCODE CBFileManager::setBasePath(const Common::String &path) {
cleanup();
if (path.c_str()) {
@@ -859,7 +859,7 @@ HRESULT CBFileManager::setBasePath(const Common::String &path) {
initPaths();
registerPackages();
- return S_OK;
+ return STATUS_OK;
}
diff --git a/engines/wintermute/Base/BFileManager.h b/engines/wintermute/Base/BFileManager.h
index 2c7415642f..2b54679b29 100644
--- a/engines/wintermute/Base/BFileManager.h
+++ b/engines/wintermute/Base/BFileManager.h
@@ -43,28 +43,28 @@ class CBFile;
class CBFileManager: CBBase {
public:
bool findPackageSignature(Common::File *f, uint32 *offset);
- HRESULT cleanup();
- HRESULT setBasePath(const Common::String &path);
- HRESULT restoreCurrentDir();
+ ERRORCODE cleanup();
+ ERRORCODE setBasePath(const Common::String &path);
+ ERRORCODE restoreCurrentDir();
char *_basePath;
bool getFullPath(const Common::String &filename, char *fullname);
Common::SeekableReadStream *openFileRaw(const Common::String &filename);
- HRESULT closeFile(Common::SeekableReadStream *File);
+ ERRORCODE closeFile(Common::SeekableReadStream *File);
bool hasFile(const Common::String &filename);
Common::SeekableReadStream *openFile(const Common::String &filename, bool absPathWarning = true, bool keepTrackOf = true);
CBFileEntry *getPackageEntry(const Common::String &filename);
Common::File *openSingleFile(const Common::String &name);
Common::File *openPackage(const Common::String &name);
- HRESULT registerPackages();
- HRESULT initPaths();
- HRESULT reloadPaths();
+ ERRORCODE registerPackages();
+ ERRORCODE initPaths();
+ ERRORCODE reloadPaths();
typedef enum {
PATH_PACKAGE, PATH_SINGLE
} TPathType;
- HRESULT addPath(TPathType type, const Common::String &path);
- HRESULT requestCD(int cd, char *packageFile, const char *filename);
+ ERRORCODE addPath(TPathType type, const Common::String &path);
+ ERRORCODE requestCD(int cd, char *packageFile, const char *filename);
Common::SeekableReadStream *loadSaveGame(const Common::String &filename);
- HRESULT saveFile(const Common::String &filename, byte *buffer, uint32 bufferSize, bool compressed = false, byte *prefixBuffer = NULL, uint32 prefixSize = 0);
+ ERRORCODE saveFile(const Common::String &filename, byte *buffer, uint32 bufferSize, bool compressed = false, byte *prefixBuffer = NULL, uint32 prefixSize = 0);
byte *readWholeFile(const Common::String &filename, uint32 *size = NULL, bool mustExist = true);
CBFileManager(CBGame *inGame = NULL);
virtual ~CBFileManager();
@@ -75,8 +75,8 @@ public:
Common::HashMap<Common::String, CBFileEntry *> _files;
private:
- HRESULT registerPackage(const char *path, const char *name, bool searchSignature = false);
- HRESULT registerPackage(const Common::String &filename, bool searchSignature = false);
+ ERRORCODE registerPackage(const char *path, const char *name, bool searchSignature = false);
+ ERRORCODE registerPackage(const Common::String &filename, bool searchSignature = false);
Common::HashMap<Common::String, CBFileEntry *>::iterator _filesIter;
bool isValidPackage(const AnsiString &fileName) const;
diff --git a/engines/wintermute/Base/BFont.cpp b/engines/wintermute/Base/BFont.cpp
index d394f3e21b..1849401e53 100644
--- a/engines/wintermute/Base/BFont.cpp
+++ b/engines/wintermute/Base/BFont.cpp
@@ -71,20 +71,20 @@ int CBFont::getTextWidth(byte *text, int maxLength) {
/*
//////////////////////////////////////////////////////////////////////
-HRESULT CBFont::loadFile(const char * Filename)
+ERRORCODE CBFont::loadFile(const char * Filename)
{
BYTE* Buffer = Game->_fileManager->readWholeFile(filename);
if(Buffer==NULL){
Game->LOG(0, "CBFont::LoadFile failed for file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
- HRESULT ret;
+ ERRORCODE ret;
_filename = new char [strlen(filename)+1];
strcpy(_filename, filename);
- if(FAILED(ret = loadBuffer(Buffer))) Game->LOG(0, "Error parsing FONT file '%s'", filename);
+ if(DID_FAIL(ret = loadBuffer(Buffer))) Game->LOG(0, "Error parsing FONT file '%s'", filename);
delete [] Buffer;
@@ -96,7 +96,7 @@ TOKEN_DEF_START
TOKEN_DEF (FONT)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////
-HRESULT CBFont::loadBuffer(byte * Buffer)
+ERRORCODE CBFont::loadBuffer(byte * Buffer)
{
TOKEN_TABLE_START(commands)
TOKEN_TABLE (FONT)
@@ -108,7 +108,7 @@ HRESULT CBFont::loadBuffer(byte * Buffer)
if(parser.GetCommand ((char**)&Buffer, commands, (char**)&params)!=TOKEN_FONT){
Game->LOG(0, "'FONT' keyword expected.");
- return E_FAIL;
+ return STATUS_FAILED;
}
Buffer = (byte *)params;
@@ -130,10 +130,10 @@ HRESULT CBFont::loadBuffer(byte * Buffer)
}
if (cmd == PARSERR_TOKENNOTFOUND){
Game->LOG(0, "Syntax error in FONT definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
- return S_OK;
+ return STATUS_OK;
}
*/
@@ -144,10 +144,10 @@ int CBFont::getLetterHeight() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFont::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CBFont::persist(CBPersistMgr *persistMgr) {
CBObject::persist(persistMgr);
- return S_OK;
+ return STATUS_OK;
}
@@ -156,7 +156,7 @@ CBFont *CBFont::createFromFile(CBGame *Game, const char *filename) {
if (isTrueType(Game, filename)) {
CBFontTT *font = new CBFontTT(Game);
if (font) {
- if (FAILED(font->loadFile(filename))) {
+ if (DID_FAIL(font->loadFile(filename))) {
delete font;
return NULL;
}
@@ -165,7 +165,7 @@ CBFont *CBFont::createFromFile(CBGame *Game, const char *filename) {
} else {
CBFontBitmap *font = new CBFontBitmap(Game);
if (font) {
- if (FAILED(font->loadFile(filename))) {
+ if (DID_FAIL(font->loadFile(filename))) {
delete font;
return NULL;
}
diff --git a/engines/wintermute/Base/BFont.h b/engines/wintermute/Base/BFont.h
index 0c7e1950b1..ac5a79299d 100644
--- a/engines/wintermute/Base/BFont.h
+++ b/engines/wintermute/Base/BFont.h
@@ -51,8 +51,8 @@ public:
static CBFont *createFromFile(CBGame *game, const char *filename);
private:
- //HRESULT loadBuffer(byte * Buffer);
- //HRESULT loadFile(const char* Filename);
+ //ERRORCODE loadBuffer(byte * Buffer);
+ //ERRORCODE loadFile(const char* Filename);
static bool isTrueType(CBGame *game, const char *filename);
};
diff --git a/engines/wintermute/Base/BFontBitmap.cpp b/engines/wintermute/Base/BFontBitmap.cpp
index 4e01134a9a..c2b7cfef1a 100644
--- a/engines/wintermute/Base/BFontBitmap.cpp
+++ b/engines/wintermute/Base/BFontBitmap.cpp
@@ -243,19 +243,19 @@ void CBFontBitmap::drawChar(byte c, int x, int y) {
//////////////////////////////////////////////////////////////////////
-HRESULT CBFontBitmap::loadFile(const char *filename) {
+ERRORCODE CBFontBitmap::loadFile(const char *filename) {
byte *buffer = Game->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
Game->LOG(0, "CBFontBitmap::LoadFile failed for file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
- HRESULT ret;
+ ERRORCODE ret;
_filename = new char [strlen(filename) + 1];
strcpy(_filename, filename);
- if (FAILED(ret = loadBuffer(buffer))) Game->LOG(0, "Error parsing FONT file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer))) Game->LOG(0, "Error parsing FONT file '%s'", filename);
delete [] buffer;
@@ -282,7 +282,7 @@ TOKEN_DEF(WIDTHS_FRAME)
TOKEN_DEF(PAINT_WHOLE_CELL)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////
-HRESULT CBFontBitmap::loadBuffer(byte *buffer) {
+ERRORCODE CBFontBitmap::loadBuffer(byte *buffer) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(FONTEXT_FIX)
TOKEN_TABLE(FONT)
@@ -308,7 +308,7 @@ HRESULT CBFontBitmap::loadBuffer(byte *buffer) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_FONT) {
Game->LOG(0, "'FONT' keyword expected.");
- return E_FAIL;
+ return STATUS_FAILED;
}
buffer = (byte *)params;
@@ -396,13 +396,13 @@ HRESULT CBFontBitmap::loadBuffer(byte *buffer) {
}
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in FONT definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (spriteFile != NULL) {
delete _sprite;
_sprite = new CBSprite(Game, this);
- if (!_sprite || FAILED(_sprite->loadFile(spriteFile))) {
+ if (!_sprite || DID_FAIL(_sprite->loadFile(spriteFile))) {
delete _sprite;
_sprite = NULL;
}
@@ -417,7 +417,7 @@ HRESULT CBFontBitmap::loadBuffer(byte *buffer) {
if (((_subframe == NULL || _subframe->_surface == NULL) && _sprite == NULL) || _numColumns == 0 || _tileWidth == 0 || _tileHeight == 0) {
Game->LOG(0, "Incomplete font definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (autoWidth) {
@@ -449,12 +449,12 @@ HRESULT CBFontBitmap::loadBuffer(byte *buffer) {
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFontBitmap::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CBFontBitmap::persist(CBPersistMgr *persistMgr) {
CBFont::persist(persistMgr);
persistMgr->transfer(TMEMBER(_numColumns));
@@ -475,7 +475,7 @@ HRESULT CBFontBitmap::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(_wholeCell));
- return S_OK;
+ return STATUS_OK;
}
@@ -487,7 +487,7 @@ int CBFontBitmap::getCharWidth(byte index) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFontBitmap::getWidths() {
+ERRORCODE CBFontBitmap::getWidths() {
CBSurface *surf = NULL;
if (_sprite) {
@@ -498,7 +498,7 @@ HRESULT CBFontBitmap::getWidths() {
}
}
if (surf == NULL && _subframe) surf = _subframe->_surface;
- if (!surf || FAILED(surf->startPixelOp())) return E_FAIL;
+ if (!surf || DID_FAIL(surf->startPixelOp())) return STATUS_FAILED;
for (int i = 0; i < NUM_CHARACTERS; i++) {
@@ -529,7 +529,7 @@ HRESULT CBFontBitmap::getWidths() {
Game->LOG(0, "%02d %02d %02d %02d %02d %02d %02d %02d %02d %02d %02d %02d %02d %02d %02d %02d", _widths[j*16+0], _widths[j*16+1], _widths[j*16+2], _widths[j*16+3], _widths[j*16+4], _widths[j*16+5], _widths[j*16+6], _widths[j*16+7], _widths[j*16+8], _widths[j*16+9], _widths[j*16+10], _widths[j*16+11], _widths[j*16+12], _widths[j*16+13], _widths[j*16+14], _widths[j*16+15]);
}
*/
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/wintermute/Base/BFontBitmap.h b/engines/wintermute/Base/BFontBitmap.h
index aba1690db5..3cd0d91e77 100644
--- a/engines/wintermute/Base/BFontBitmap.h
+++ b/engines/wintermute/Base/BFontBitmap.h
@@ -37,8 +37,8 @@ class CBSubFrame;
class CBFontBitmap : public CBFont {
public:
DECLARE_PERSISTENT(CBFontBitmap, CBFont)
- HRESULT loadBuffer(byte *Buffer);
- HRESULT loadFile(const char *filename);
+ ERRORCODE loadBuffer(byte *Buffer);
+ ERRORCODE loadFile(const char *filename);
virtual int getTextWidth(byte *text, int maxLength = -1);
virtual int getTextHeight(byte *text, int width);
virtual void drawText(byte *text, int x, int y, int width, TTextAlign align = TAL_LEFT, int max_height = -1, int maxLength = -1);
@@ -48,7 +48,7 @@ public:
virtual ~CBFontBitmap();
- HRESULT getWidths();
+ ERRORCODE getWidths();
CBSprite *_sprite;
int _widthsFrame;
bool _fontextFix;
diff --git a/engines/wintermute/Base/BFontStorage.cpp b/engines/wintermute/Base/BFontStorage.cpp
index 3749161137..7642a88bac 100644
--- a/engines/wintermute/Base/BFontStorage.cpp
+++ b/engines/wintermute/Base/BFontStorage.cpp
@@ -51,22 +51,22 @@ CBFontStorage::~CBFontStorage() {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFontStorage::cleanup(bool warn) {
+ERRORCODE CBFontStorage::cleanup(bool warn) {
for (int i = 0; i < _fonts.GetSize(); i++) {
if (warn) Game->LOG(0, "Removing orphan font '%s'", _fonts[i]->_filename);
delete _fonts[i];
}
_fonts.RemoveAll();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFontStorage::initLoop() {
+ERRORCODE CBFontStorage::initLoop() {
for (int i = 0; i < _fonts.GetSize(); i++) {
_fonts[i]->initLoop();
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -84,7 +84,7 @@ CBFont *CBFontStorage::addFont(const char *filename) {
CBFont* font = new CBFont(Game);
if (!font) return NULL;
- if (FAILED(font->loadFile(filename))) {
+ if (DID_FAIL(font->loadFile(filename))) {
delete font;
return NULL;
}
@@ -104,8 +104,8 @@ CBFont *CBFontStorage::addFont(const char *filename) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFontStorage::removeFont(CBFont *font) {
- if (!font) return E_FAIL;
+ERRORCODE CBFontStorage::removeFont(CBFont *font) {
+ if (!font) return STATUS_FAILED;
for (int i = 0; i < _fonts.GetSize(); i++) {
if (_fonts[i] == font) {
@@ -117,19 +117,19 @@ HRESULT CBFontStorage::removeFont(CBFont *font) {
break;
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFontStorage::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CBFontStorage::persist(CBPersistMgr *persistMgr) {
if (!persistMgr->_saving) cleanup(false);
persistMgr->transfer(TMEMBER(Game));
_fonts.persist(persistMgr);
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Base/BFontStorage.h b/engines/wintermute/Base/BFontStorage.h
index e5f96fd3bc..33a1bb056f 100644
--- a/engines/wintermute/Base/BFontStorage.h
+++ b/engines/wintermute/Base/BFontStorage.h
@@ -41,13 +41,13 @@ class CBFont;
class CBFontStorage : public CBBase {
public:
DECLARE_PERSISTENT(CBFontStorage, CBBase)
- HRESULT cleanup(bool warn = false);
- HRESULT removeFont(CBFont *font);
+ ERRORCODE cleanup(bool warn = false);
+ ERRORCODE removeFont(CBFont *font);
CBFont *addFont(const char *filename);
CBFontStorage(CBGame *inGame);
virtual ~CBFontStorage();
CBArray<CBFont *, CBFont *> _fonts;
- HRESULT initLoop();
+ ERRORCODE initLoop();
};
} // end of namespace WinterMute
diff --git a/engines/wintermute/Base/BFontTT.cpp b/engines/wintermute/Base/BFontTT.cpp
index 353620bc24..8f665a51fd 100644
--- a/engines/wintermute/Base/BFontTT.cpp
+++ b/engines/wintermute/Base/BFontTT.cpp
@@ -223,7 +223,7 @@ void CBFontTT::drawText(byte *text, int x, int y, int width, TTextAlign align, i
uint32 color = _layers[i]->_color;
uint32 origForceAlpha = _renderer->_forceAlphaColor;
if (_renderer->_forceAlphaColor != 0) {
- color = DRGBA(D3DCOLGetR(color), D3DCOLGetG(color), D3DCOLGetB(color), D3DCOLGetA(_renderer->_forceAlphaColor));
+ color = BYTETORGBA(RGBCOLGetR(color), RGBCOLGetG(color), RGBCOLGetB(color), RGBCOLGetA(_renderer->_forceAlphaColor));
_renderer->_forceAlphaColor = 0;
}
surface->displayTransOffset(x, y - textOffset, rc, color, BLEND_NORMAL, false, false, _layers[i]->_offsetX, _layers[i]->_offsetY);
@@ -257,7 +257,7 @@ CBSurface *CBFontTT::renderTextToTexture(const WideString &text, int width, TTex
hasWarned = true;
warning("CBFontTT::RenderTextToTexture - Not fully ported yet");
}
- warning("%s %d %d %d %d", text.c_str(), D3DCOLGetR(_layers[0]->_color), D3DCOLGetG(_layers[0]->_color), D3DCOLGetB(_layers[0]->_color), D3DCOLGetA(_layers[0]->_color));
+ warning("%s %d %d %d %d", text.c_str(), RGBCOLGetR(_layers[0]->_color), RGBCOLGetG(_layers[0]->_color), RGBCOLGetB(_layers[0]->_color), RGBCOLGetA(_layers[0]->_color));
// void drawString(Surface *dst, const Common::String &str, int x, int y, int w, uint32 color, TextAlign align = kTextAlignLeft, int deltax = 0, bool useEllipsis = true) const;
Graphics::Surface *surface = new Graphics::Surface();
surface->create((uint16)width, (uint16)(_lineHeight * lines.size()), Graphics::PixelFormat(2, 5, 5, 5, 1, 10, 5, 0, 15));
@@ -360,7 +360,7 @@ CBSurface *CBFontTT::renderTextToTexture(const WideString &text, int width, TTex
}
CBSurfaceSDL *wmeSurface = new CBSurfaceSDL(Game);
- if (SUCCEEDED(wmeSurface->CreateFromSDLSurface(surface))) {
+ if (DID_SUCCEED(wmeSurface->CreateFromSDLSurface(surface))) {
SDL_FreeSurface(surface);
return wmeSurface;
} else {
@@ -403,19 +403,19 @@ int CBFontTT::getLetterHeight() {
//////////////////////////////////////////////////////////////////////
-HRESULT CBFontTT::loadFile(const char *filename) {
+ERRORCODE CBFontTT::loadFile(const char *filename) {
byte *buffer = Game->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
Game->LOG(0, "CBFontTT::LoadFile failed for file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
- HRESULT ret;
+ ERRORCODE ret;
_filename = new char [strlen(filename) + 1];
strcpy(_filename, filename);
- if (FAILED(ret = loadBuffer(buffer))) Game->LOG(0, "Error parsing TTFONT file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer))) Game->LOG(0, "Error parsing TTFONT file '%s'", filename);
delete [] buffer;
@@ -440,7 +440,7 @@ TOKEN_DEF(OFFSET_X)
TOKEN_DEF(OFFSET_Y)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////
-HRESULT CBFontTT::loadBuffer(byte *buffer) {
+ERRORCODE CBFontTT::loadBuffer(byte *buffer) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(TTFONT)
TOKEN_TABLE(SIZE)
@@ -462,7 +462,7 @@ HRESULT CBFontTT::loadBuffer(byte *buffer) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_TTFONT) {
Game->LOG(0, "'TTFONT' keyword expected.");
- return E_FAIL;
+ return STATUS_FAILED;
}
buffer = (byte *)params;
@@ -505,20 +505,20 @@ HRESULT CBFontTT::loadBuffer(byte *buffer) {
case TOKEN_COLOR: {
int r, g, b;
parser.scanStr(params, "%d,%d,%d", &r, &g, &b);
- BaseColor = DRGBA(r, g, b, D3DCOLGetA(BaseColor));
+ BaseColor = BYTETORGBA(r, g, b, RGBCOLGetA(BaseColor));
}
break;
case TOKEN_ALPHA: {
int a;
parser.scanStr(params, "%d", &a);
- BaseColor = DRGBA(D3DCOLGetR(BaseColor), D3DCOLGetG(BaseColor), D3DCOLGetB(BaseColor), a);
+ BaseColor = BYTETORGBA(RGBCOLGetR(BaseColor), RGBCOLGetG(BaseColor), RGBCOLGetB(BaseColor), a);
}
break;
case TOKEN_LAYER: {
CBTTFontLayer *Layer = new CBTTFontLayer;
- if (Layer && SUCCEEDED(parseLayer(Layer, (byte *)params))) _layers.Add(Layer);
+ if (Layer && DID_SUCCEED(parseLayer(Layer, (byte *)params))) _layers.Add(Layer);
else {
delete Layer;
Layer = NULL;
@@ -531,7 +531,7 @@ HRESULT CBFontTT::loadBuffer(byte *buffer) {
}
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in TTFONT definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
// create at least one layer
@@ -548,7 +548,7 @@ HRESULT CBFontTT::loadBuffer(byte *buffer) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFontTT::parseLayer(CBTTFontLayer *layer, byte *buffer) {
+ERRORCODE CBFontTT::parseLayer(CBTTFontLayer *layer, byte *buffer) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(OFFSET_X)
TOKEN_TABLE(OFFSET_Y)
@@ -573,25 +573,25 @@ HRESULT CBFontTT::parseLayer(CBTTFontLayer *layer, byte *buffer) {
case TOKEN_COLOR: {
int r, g, b;
parser.scanStr(params, "%d,%d,%d", &r, &g, &b);
- layer->_color = DRGBA(r, g, b, D3DCOLGetA(layer->_color));
+ layer->_color = BYTETORGBA(r, g, b, RGBCOLGetA(layer->_color));
}
break;
case TOKEN_ALPHA: {
int a;
parser.scanStr(params, "%d", &a);
- layer->_color = DRGBA(D3DCOLGetR(layer->_color), D3DCOLGetG(layer->_color), D3DCOLGetB(layer->_color), a);
+ layer->_color = BYTETORGBA(RGBCOLGetR(layer->_color), RGBCOLGetG(layer->_color), RGBCOLGetB(layer->_color), a);
}
break;
}
}
- if (cmd != PARSERR_EOF) return E_FAIL;
- else return S_OK;
+ if (cmd != PARSERR_EOF) return STATUS_FAILED;
+ else return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFontTT::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CBFontTT::persist(CBPersistMgr *persistMgr) {
CBFont::persist(persistMgr);
persistMgr->transfer(TMEMBER(_isBold));
@@ -623,7 +623,7 @@ HRESULT CBFontTT::persist(CBPersistMgr *persistMgr) {
_fallbackFont = _font = _deletableFont = NULL;
}
- return S_OK;
+ return STATUS_OK;
}
@@ -633,8 +633,8 @@ void CBFontTT::afterLoad() {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFontTT::initFont() {
- if (!_fontFile) return E_FAIL;
+ERRORCODE CBFontTT::initFont() {
+ if (!_fontFile) return STATUS_FAILED;
Common::SeekableReadStream *file = Game->_fileManager->openFile(_fontFile);
if (!file) {
@@ -643,7 +643,7 @@ HRESULT CBFontTT::initFont() {
file = Game->_fileManager->openFile(fontFileName.c_str(), false);
if (!file) {
Game->LOG(0, "Error loading TrueType font '%s'", _fontFile);
- //return E_FAIL;
+ //return STATUS_FAILED;
}
}
@@ -658,7 +658,7 @@ HRESULT CBFontTT::initFont() {
warning("BFontTT::InitFont - Couldn't load %s", _fontFile);
}
_lineHeight = _font->getFontHeight();
- return S_OK;
+ return STATUS_OK;
#if 0
FT_Error error;
@@ -682,14 +682,14 @@ HRESULT CBFontTT::initFont() {
if (error) {
SAFE_DELETE_ARRAY(_fTStream);
Game->_fileManager->closeFile(file);
- return E_FAIL;
+ return STATUS_FAILED;
}
error = FT_Set_Char_Size(_fTFace, 0, (FT_F26Dot6)(_fontHeight * 64), (FT_UInt)horDpi, (FT_UInt)vertDpi);
if (error) {
FT_Done_Face(_fTFace);
_fTFace = NULL;
- return E_FAIL;
+ return STATUS_FAILED;
}
// http://en.wikipedia.org/wiki/E_(typography)
@@ -717,7 +717,7 @@ HRESULT CBFontTT::initFont() {
_glyphCache->Initialize();
#endif
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/wintermute/Base/BFontTT.h b/engines/wintermute/Base/BFontTT.h
index a2157cb216..c585ca2070 100644
--- a/engines/wintermute/Base/BFontTT.h
+++ b/engines/wintermute/Base/BFontTT.h
@@ -80,11 +80,11 @@ public:
_color = 0x00000000;
}
- HRESULT persist(CBPersistMgr *persistMgr) {
+ ERRORCODE persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(_offsetX));
persistMgr->transfer(TMEMBER(_offsetY));
persistMgr->transfer(TMEMBER(_color));
- return S_OK;
+ return STATUS_OK;
}
int _offsetX;
@@ -123,8 +123,8 @@ public:
virtual void drawText(byte *text, int x, int y, int width, TTextAlign align = TAL_LEFT, int max_height = -1, int maxLength = -1);
virtual int getLetterHeight();
- HRESULT loadBuffer(byte *buffer);
- HRESULT loadFile(const char *filename);
+ ERRORCODE loadBuffer(byte *buffer);
+ ERRORCODE loadFile(const char *filename);
float getLineHeight() const {
return _lineHeight;
@@ -134,7 +134,7 @@ public:
void initLoop();
private:
- HRESULT parseLayer(CBTTFontLayer *layer, byte *buffer);
+ ERRORCODE parseLayer(CBTTFontLayer *layer, byte *buffer);
void wrapText(const WideString &text, int maxWidth, int maxHeight, TextLineList &lines);
void measureText(const WideString &text, int maxWidth, int maxHeight, int &textWidth, int &textHeight);
@@ -145,7 +145,7 @@ private:
CBCachedTTFontText *_cachedTexts[NUM_CACHED_TEXTS];
- HRESULT initFont();
+ ERRORCODE initFont();
Graphics::Font *_deletableFont;
const Graphics::Font *_font;
diff --git a/engines/wintermute/Base/BFrame.cpp b/engines/wintermute/Base/BFrame.cpp
index ebb5fe0e6c..9f0c89c39c 100644
--- a/engines/wintermute/Base/BFrame.cpp
+++ b/engines/wintermute/Base/BFrame.cpp
@@ -75,19 +75,19 @@ CBFrame::~CBFrame() {
//////////////////////////////////////////////////////////////////////
-HRESULT CBFrame::draw(int x, int y, CBObject *registerOwner, float zoomX, float zoomY, bool precise, uint32 alpha, bool allFrames, float rotate, TSpriteBlendMode blendMode) {
- HRESULT res;
+ERRORCODE CBFrame::draw(int x, int y, CBObject *registerOwner, float zoomX, float zoomY, bool precise, uint32 alpha, bool allFrames, float rotate, TSpriteBlendMode blendMode) {
+ ERRORCODE res;
for (int i = 0; i < _subframes.GetSize(); i++) {
res = _subframes[i]->draw(x, y, registerOwner, zoomX, zoomY, precise, alpha, rotate, blendMode);
- if (FAILED(res)) return res;
+ if (DID_FAIL(res)) return res;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFrame::oneTimeDisplay(CBObject *owner, bool muted) {
+ERRORCODE CBFrame::oneTimeDisplay(CBObject *owner, bool muted) {
if (_sound && !muted) {
if (owner) owner->updateOneSound(_sound);
_sound->play();
@@ -102,7 +102,7 @@ HRESULT CBFrame::oneTimeDisplay(CBObject *owner, bool muted) {
owner->applyEvent(_applyEvent[i]);
}
}
- return S_OK;
+ return STATUS_OK;
}
@@ -131,7 +131,7 @@ TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF(KILL_SOUND)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////
-HRESULT CBFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) {
+ERRORCODE CBFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(DELAY)
TOKEN_TABLE(IMAGE)
@@ -238,7 +238,7 @@ HRESULT CBFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) {
case TOKEN_SUBFRAME: {
CBSubFrame *subframe = new CBSubFrame(Game);
- if (!subframe || FAILED(subframe->loadBuffer((byte *)params, lifeTime, keepLoaded))) {
+ if (!subframe || DID_FAIL(subframe->loadBuffer((byte *)params, lifeTime, keepLoaded))) {
delete subframe;
cmd = PARSERR_GENERIC;
} else _subframes.Add(subframe);
@@ -251,7 +251,7 @@ HRESULT CBFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) {
_sound = NULL;
}
_sound = new CBSound(Game);
- if (!_sound || FAILED(_sound->setSound(params, SOUND_SFX, false))) {
+ if (!_sound || DID_FAIL(_sound->setSound(params, SOUND_SFX, false))) {
if (Game->_soundMgr->_soundAvailable) Game->LOG(0, "Error loading sound '%s'.", params);
delete _sound;
_sound = NULL;
@@ -281,12 +281,12 @@ HRESULT CBFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) {
}
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in FRAME definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (cmd == PARSERR_GENERIC) {
Game->LOG(0, "Error loading FRAME definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
@@ -298,11 +298,11 @@ HRESULT CBFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) {
if (!sub->_surface) {
delete sub;
Game->LOG(0, "Error loading SUBFRAME");
- return E_FAIL;
+ return STATUS_FAILED;
}
- sub->_alpha = DRGBA(ar, ag, ab, alpha);
- if (custoTrans) sub->_transparent = DRGBA(r, g, b, 0xFF);
+ sub->_alpha = BYTETORGBA(ar, ag, ab, alpha);
+ if (custoTrans) sub->_transparent = BYTETORGBA(r, g, b, 0xFF);
}
if (CBPlatform::isRectEmpty(&rect)) sub->setDefaultRect();
@@ -320,7 +320,7 @@ HRESULT CBFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) {
sub->_editorSelected = editorSelected;
_subframes.InsertAt(0, sub);
- return S_OK;
+ return STATUS_OK;
}
@@ -341,7 +341,7 @@ bool CBFrame::getBoundingRect(LPRECT rect, int x, int y, float scaleX, float sca
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFrame::saveAsText(CBDynBuffer *buffer, int indent) {
+ERRORCODE CBFrame::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "FRAME {\n");
buffer->putTextIndent(indent + 2, "DELAY = %d\n", _delay);
@@ -374,12 +374,12 @@ HRESULT CBFrame::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "}\n\n");
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFrame::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CBFrame::persist(CBPersistMgr *persistMgr) {
CBScriptable::persist(persistMgr);
_applyEvent.persist(persistMgr);
@@ -392,14 +392,14 @@ HRESULT CBFrame::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(_sound));
_subframes.persist(persistMgr);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// GetSound
@@ -409,7 +409,7 @@ HRESULT CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
if (_sound && _sound->_soundFilename) stack->pushString(_sound->_soundFilename);
else stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -423,13 +423,13 @@ HRESULT CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
if (!val->isNULL()) {
_sound = new CBSound(Game);
- if (!_sound || FAILED(_sound->setSound(val->getString(), SOUND_SFX, false))) {
+ if (!_sound || DID_FAIL(_sound->setSound(val->getString(), SOUND_SFX, false))) {
stack->pushBool(false);
delete _sound;
_sound = NULL;
} else stack->pushBool(true);
} else stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -443,7 +443,7 @@ HRESULT CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
stack->pushNULL();
} else stack->pushNative(_subframes[index], true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -468,7 +468,7 @@ HRESULT CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
}
}
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -488,7 +488,7 @@ HRESULT CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
_subframes.Add(sub);
stack->pushNative(sub, true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -512,7 +512,7 @@ HRESULT CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
else _subframes.InsertAt(index, sub);
stack->pushNative(sub, true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -525,7 +525,7 @@ HRESULT CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
script->runtimeError("Frame.GetEvent: Event index %d is out of range.", index);
stack->pushNULL();
} else stack->pushString(_applyEvent[index]);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -537,12 +537,12 @@ HRESULT CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
for (int i = 0; i < _applyEvent.GetSize(); i++) {
if (scumm_stricmp(_applyEvent[i], event) == 0) {
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
}
_applyEvent.Add(event);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -559,7 +559,7 @@ HRESULT CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
}
}
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -648,13 +648,13 @@ CScValue *CBFrame::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBFrame::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CBFrame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
// Delay
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "Delay") == 0) {
_delay = MAX(0, value->getInt());
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -662,7 +662,7 @@ HRESULT CBFrame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Keyframe") == 0) {
_keyframe = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -670,7 +670,7 @@ HRESULT CBFrame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "KillSounds") == 0) {
_killSound = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -678,7 +678,7 @@ HRESULT CBFrame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "MoveX") == 0) {
_moveX = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -686,7 +686,7 @@ HRESULT CBFrame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "MoveY") == 0) {
_moveY = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/wintermute/Base/BFrame.h b/engines/wintermute/Base/BFrame.h
index cc42b77661..55ade445e3 100644
--- a/engines/wintermute/Base/BFrame.h
+++ b/engines/wintermute/Base/BFrame.h
@@ -42,18 +42,18 @@ class CBFrame: public CBScriptable {
public:
bool _killSound;
bool _keyframe;
- HRESULT oneTimeDisplay(CBObject *owner, bool muted = false);
+ ERRORCODE oneTimeDisplay(CBObject *owner, bool muted = false);
DECLARE_PERSISTENT(CBFrame, CBScriptable)
CBSound *_sound;
bool _editorExpanded;
bool getBoundingRect(LPRECT rect, int x, int y, float scaleX = 100, float scaleY = 100);
- HRESULT saveAsText(CBDynBuffer *buffer, int indent);
+ ERRORCODE saveAsText(CBDynBuffer *buffer, int indent);
int _moveY;
int _moveX;
uint32 _delay;
CBArray<CBSubFrame *, CBSubFrame *> _subframes;
- HRESULT draw(int x, int y, CBObject *registerOwner = NULL, float zoomX = 100, float zoomY = 100, bool precise = true, uint32 Alpha = 0xFFFFFFFF, bool allFrames = false, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL);
- HRESULT loadBuffer(byte *buffer, int lifeTime, bool keepLoaded);
+ ERRORCODE draw(int x, int y, CBObject *registerOwner = NULL, float zoomX = 100, float zoomY = 100, bool precise = true, uint32 Alpha = 0xFFFFFFFF, bool allFrames = false, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL);
+ ERRORCODE loadBuffer(byte *buffer, int lifeTime, bool keepLoaded);
CBFrame(CBGame *inGame);
virtual ~CBFrame();
@@ -62,8 +62,8 @@ public:
// scripting interface
virtual CScValue *scGetProperty(const char *name);
- virtual HRESULT scSetProperty(const char *name, CScValue *value);
- virtual HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ERRORCODE scSetProperty(const char *name, CScValue *value);
+ virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
virtual const char *scToString();
};
diff --git a/engines/wintermute/Base/BGame.cpp b/engines/wintermute/Base/BGame.cpp
index 7946bf8bbc..41cc62ba3e 100644
--- a/engines/wintermute/Base/BGame.cpp
+++ b/engines/wintermute/Base/BGame.cpp
@@ -202,7 +202,7 @@ CBGame::CBGame(): CBObject(this) {
_thumbnailWidth = _thumbnailHeight = 0;
_indicatorDisplay = false;
- _indicatorColor = DRGBA(255, 0, 0, 128);
+ _indicatorColor = BYTETORGBA(255, 0, 0, 128);
_indicatorProgress = 0;
_indicatorX = -1;
_indicatorY = -1;
@@ -341,7 +341,7 @@ CBGame::~CBGame() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::cleanup() {
+ERRORCODE CBGame::cleanup() {
delete _loadingIcon;
_loadingIcon = NULL;
@@ -418,12 +418,12 @@ HRESULT CBGame::cleanup() {
delete _keyboardState;
_keyboardState = NULL;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////
-HRESULT CBGame::initialize1() {
+ERRORCODE CBGame::initialize1() {
bool loaded = false; // Not really a loop, but a goto-replacement.
while (!loaded) {
_surfaceStorage = new CBSurfaceStorage(this);
@@ -479,7 +479,7 @@ HRESULT CBGame::initialize1() {
loaded = true;
}
if (loaded == true) {
- return S_OK;
+ return STATUS_OK;
} else {
delete _mathClass;
delete _store;
@@ -492,22 +492,22 @@ HRESULT CBGame::initialize1() {
delete _fileManager;
delete _scEngine;
delete _videoPlayer;
- return E_FAIL;
+ return STATUS_FAILED;
}
}
//////////////////////////////////////////////////////////////////////
-HRESULT CBGame::initialize2() { // we know whether we are going to be accelerated
+ERRORCODE CBGame::initialize2() { // we know whether we are going to be accelerated
_renderer = new CBRenderSDL(this);
- if (_renderer == NULL) return E_FAIL;
+ if (_renderer == NULL) return STATUS_FAILED;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////
-HRESULT CBGame::initialize3() { // renderer is initialized
+ERRORCODE CBGame::initialize3() { // renderer is initialized
_posX = _renderer->_width / 2;
_posY = _renderer->_height / 2;
@@ -515,7 +515,7 @@ HRESULT CBGame::initialize3() { // renderer is initialized
if (_indicatorX == -1) _indicatorX = 0;
if (_indicatorWidth == -1) _indicatorWidth = _renderer->_width;
- return S_OK;
+ return STATUS_OK;
}
@@ -578,7 +578,7 @@ void CBGame::DEBUG_DebugDisable() {
//////////////////////////////////////////////////////////////////////
-void CBGame::LOG(HRESULT res, LPCSTR fmt, ...) {
+void CBGame::LOG(ERRORCODE res, LPCSTR fmt, ...) {
uint32 secs = g_system->getMillis() / 1000;
uint32 hours = secs / 3600;
secs = secs % 3600;
@@ -615,7 +615,7 @@ void CBGame::setEngineLogCallback(ENGINE_LOG_CALLBACK callback, void *data) {
//////////////////////////////////////////////////////////////////////
-HRESULT CBGame::initLoop() {
+ERRORCODE CBGame::initLoop() {
_viewportSP = -1;
_currentTime = CBPlatform::getTime();
@@ -668,13 +668,13 @@ HRESULT CBGame::initLoop() {
if (_fader) _fader->update();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////
-HRESULT CBGame::initInput() {
- return S_OK;
+ERRORCODE CBGame::initInput() {
+ return STATUS_OK;
}
@@ -698,19 +698,19 @@ void CBGame::getOffset(int *offsetX, int *offsetY) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::loadFile(const char *filename) {
+ERRORCODE CBGame::loadFile(const char *filename) {
byte *buffer = Game->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
Game->LOG(0, "CBGame::LoadFile failed for file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
- HRESULT ret;
+ ERRORCODE ret;
_filename = new char [strlen(filename) + 1];
strcpy(_filename, filename);
- if (FAILED(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing GAME file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing GAME file '%s'", filename);
delete [] buffer;
@@ -768,7 +768,7 @@ TOKEN_DEF(GUID)
TOKEN_DEF(COMPAT_KILL_METHOD_THREADS)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::loadBuffer(byte *buffer, bool complete) {
+ERRORCODE CBGame::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(GAME)
TOKEN_TABLE(TEMPLATE)
@@ -811,7 +811,7 @@ HRESULT CBGame::loadBuffer(byte *buffer, bool complete) {
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_GAME) {
Game->LOG(0, "'GAME' keyword expected.");
- return E_FAIL;
+ return STATUS_FAILED;
}
buffer = params;
}
@@ -819,7 +819,7 @@ HRESULT CBGame::loadBuffer(byte *buffer, bool complete) {
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
- if (FAILED(loadFile((char *)params))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(loadFile((char *)params))) cmd = PARSERR_GENERIC;
break;
case TOKEN_NAME:
@@ -848,7 +848,7 @@ HRESULT CBGame::loadBuffer(byte *buffer, bool complete) {
case TOKEN_CURSOR:
delete _cursor;
_cursor = new CBSprite(Game);
- if (!_cursor || FAILED(_cursor->loadFile((char *)params))) {
+ if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
delete _cursor;
_cursor = NULL;
cmd = PARSERR_GENERIC;
@@ -859,7 +859,7 @@ HRESULT CBGame::loadBuffer(byte *buffer, bool complete) {
delete _activeCursor;
_activeCursor = NULL;
_activeCursor = new CBSprite(Game);
- if (!_activeCursor || FAILED(_activeCursor->loadFile((char *)params))) {
+ if (!_activeCursor || DID_FAIL(_activeCursor->loadFile((char *)params))) {
delete _activeCursor;
_activeCursor = NULL;
cmd = PARSERR_GENERIC;
@@ -869,7 +869,7 @@ HRESULT CBGame::loadBuffer(byte *buffer, bool complete) {
case TOKEN_NONINTERACTIVE_CURSOR:
delete _cursorNoninteractive;
_cursorNoninteractive = new CBSprite(Game);
- if (!_cursorNoninteractive || FAILED(_cursorNoninteractive->loadFile((char *)params))) {
+ if (!_cursorNoninteractive || DID_FAIL(_cursorNoninteractive->loadFile((char *)params))) {
delete _cursorNoninteractive;
_cursorNoninteractive = NULL;
cmd = PARSERR_GENERIC;
@@ -923,7 +923,7 @@ HRESULT CBGame::loadBuffer(byte *buffer, bool complete) {
case TOKEN_INDICATOR_COLOR: {
int r, g, b, a;
parser.scanStr((char *)params, "%d,%d,%d,%d", &r, &g, &b, &a);
- _indicatorColor = DRGBA(r, g, b, a);
+ _indicatorColor = BYTETORGBA(r, g, b, a);
}
break;
@@ -974,21 +974,21 @@ HRESULT CBGame::loadBuffer(byte *buffer, bool complete) {
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in GAME definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (cmd == PARSERR_GENERIC) {
Game->LOG(0, "Error loading GAME definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// LOG
//////////////////////////////////////////////////////////////////////////
@@ -996,14 +996,14 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
stack->correctParams(1);
LOG(0, stack->pop()->getString());
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// Caption
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Caption") == 0) {
- HRESULT res = CBObject::scCallMethod(script, stack, thisStack, name);
+ ERRORCODE res = CBObject::scCallMethod(script, stack, thisStack, name);
setWindowTitle();
return res;
}
@@ -1015,7 +1015,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
stack->correctParams(1);
quickMessage(stack->pop()->getString());
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1024,12 +1024,12 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
else if (strcmp(name, "RunScript") == 0) {
Game->LOG(0, "**Warning** The 'RunScript' method is now obsolete. Use 'AttachScript' instead (same syntax)");
stack->correctParams(1);
- if (FAILED(addScript(stack->pop()->getString())))
+ if (DID_FAIL(addScript(stack->pop()->getString())))
stack->pushBool(false);
else
stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1044,12 +1044,12 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
if (Val->isNULL()) ClearOld = true;
else ClearOld = Val->getBool();
- if (FAILED(_stringTable->loadFile(filename, ClearOld)))
+ if (DID_FAIL(_stringTable->loadFile(filename, ClearOld)))
stack->pushBool(false);
else
stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1061,7 +1061,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
if (validObject((CBObject *) obj)) stack->pushBool(true);
else stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1072,7 +1072,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
resetContent();
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
@@ -1087,7 +1087,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
if (val->getType() == VAL_VARIABLE_REF) val->setNULL();
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1096,7 +1096,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
else if (strcmp(name, "LoadWindow") == 0) {
stack->correctParams(1);
CUIWindow *win = new CUIWindow(Game);
- if (win && SUCCEEDED(win->loadFile(stack->pop()->getString()))) {
+ if (win && DID_SUCCEED(win->loadFile(stack->pop()->getString()))) {
_windows.Add(win);
registerObject(win);
stack->pushNative(win, true);
@@ -1105,7 +1105,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
win = NULL;
stack->pushNULL();
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1119,7 +1119,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
_stringTable->expand(&str);
stack->pushString(str);
delete [] str;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1141,9 +1141,9 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
uint32 loopStart = (uint32)(valLoopStart->isNULL() ? 0 : valLoopStart->getInt());
- if (FAILED(playMusic(channel, filename, looping, loopStart))) stack->pushBool(false);
+ if (DID_FAIL(playMusic(channel, filename, looping, loopStart))) stack->pushBool(false);
else stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1158,9 +1158,9 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
channel = stack->pop()->getInt();
}
- if (FAILED(stopMusic(channel))) stack->pushBool(false);
+ if (DID_FAIL(stopMusic(channel))) stack->pushBool(false);
else stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1175,9 +1175,9 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
channel = stack->pop()->getInt();
}
- if (FAILED(pauseMusic(channel))) stack->pushBool(false);
+ if (DID_FAIL(pauseMusic(channel))) stack->pushBool(false);
else stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1191,9 +1191,9 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
channel = stack->pop()->getInt();
}
- if (FAILED(resumeMusic(channel))) stack->pushBool(false);
+ if (DID_FAIL(resumeMusic(channel))) stack->pushBool(false);
else stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1211,7 +1211,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
if (!_music[channel] || !_music[channel]->_soundFilename) stack->pushNULL();
else stack->pushString(_music[channel]->_soundFilename);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1227,10 +1227,10 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
uint32 time = stack->pop()->getInt();
- if (FAILED(setMusicStartTime(channel, time))) stack->pushBool(false);
+ if (DID_FAIL(setMusicStartTime(channel, time))) stack->pushBool(false);
else stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1246,7 +1246,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
if (channel < 0 || channel >= NUM_MUSIC_CHANNELS || !_music[channel]) stack->pushInt(0);
else stack->pushInt(_music[channel]->getPositionTime());
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1262,7 +1262,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
if (channel < 0 || channel >= NUM_MUSIC_CHANNELS || !_music[channel]) stack->pushBool(false);
else stack->pushBool(_music[channel]->isPlaying());
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1279,10 +1279,10 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
int volume = stack->pop()->getInt();
if (channel < 0 || channel >= NUM_MUSIC_CHANNELS || !_music[channel]) stack->pushBool(false);
else {
- if (FAILED(_music[channel]->setVolume(volume))) stack->pushBool(false);
+ if (DID_FAIL(_music[channel]->setVolume(volume))) stack->pushBool(false);
else stack->pushBool(true);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1299,7 +1299,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
if (channel < 0 || channel >= NUM_MUSIC_CHANNELS || !_music[channel]) stack->pushInt(0);
else stack->pushInt(_music[channel]->getVolume());
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1315,7 +1315,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
if (_musicCrossfadeRunning) {
script->runtimeError("Game.MusicCrossfade: Music crossfade is already in progress.");
stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
_musicCrossfadeStartTime = _liveTimer;
@@ -1327,7 +1327,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
_musicCrossfadeRunning = true;
stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1340,13 +1340,13 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
const char *filename = stack->pop()->getString();
CBSound *sound = new CBSound(Game);
- if (sound && SUCCEEDED(sound->setSound(filename, SOUND_MUSIC, true))) {
+ if (sound && DID_SUCCEED(sound->setSound(filename, SOUND_MUSIC, true))) {
length = sound->getLength();
delete sound;
sound = NULL;
}
stack->pushInt(length);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1367,7 +1367,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
CBPlatform::setCursorPos(p.x, p.y);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1386,7 +1386,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
CBPlatform::setRect(&_mouseLockRect, left, top, right, bottom);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1396,7 +1396,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
/* stack->correctParams(0);
stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
// TODO: ADDVIDEO
*/
@@ -1420,14 +1420,14 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
if (Type < (int)VID_PLAY_POS || Type > (int)VID_PLAY_CENTER)
Type = (int)VID_PLAY_STRETCH;
- if (SUCCEEDED(Game->_videoPlayer->initialize(filename, SubtitleFile))) {
- if (SUCCEEDED(Game->_videoPlayer->play((TVideoPlayback)Type, xVal, yVal, FreezeMusic))) {
+ if (DID_SUCCEED(Game->_videoPlayer->initialize(filename, SubtitleFile))) {
+ if (DID_SUCCEED(Game->_videoPlayer->play((TVideoPlayback)Type, xVal, yVal, FreezeMusic))) {
stack->pushBool(true);
script->sleep(0);
} else stack->pushBool(false);
} else stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1437,7 +1437,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
/* stack->correctParams(0);
stack->pushBool(false);
- return S_OK;*/
+ return STATUS_OK;*/
// TODO: ADDVIDEO
stack->correctParams(7);
@@ -1460,9 +1460,9 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
delete _theoraPlayer;
_theoraPlayer = new CVidTheoraPlayer(this);
- if (_theoraPlayer && SUCCEEDED(_theoraPlayer->initialize(filename, SubtitleFile))) {
+ if (_theoraPlayer && DID_SUCCEED(_theoraPlayer->initialize(filename, SubtitleFile))) {
_theoraPlayer->_dontDropFrames = !dropFrames;
- if (SUCCEEDED(_theoraPlayer->play((TVideoPlayback)type, xVal, yVal, true, freezeMusic))) {
+ if (DID_SUCCEED(_theoraPlayer->play((TVideoPlayback)type, xVal, yVal, true, freezeMusic))) {
stack->pushBool(true);
script->sleep(0);
} else stack->pushBool(false);
@@ -1472,7 +1472,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
_theoraPlayer = NULL;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1482,7 +1482,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
stack->correctParams(0);
stack->pushNULL();
_quitting = true;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1494,7 +1494,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
int val = stack->pop()->getInt();
_registry->writeInt("PrivateSettings", key, val);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1505,7 +1505,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
const char *key = stack->pop()->getString();
int initVal = stack->pop()->getInt();
stack->pushInt(_registry->readInt("PrivateSettings", key, initVal));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1517,7 +1517,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
const char *val = stack->pop()->getString();
_registry->writeString("PrivateSettings", key, val);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1529,7 +1529,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
const char *initVal = stack->pop()->getString();
AnsiString val = _registry->readString("PrivateSettings", key, initVal);
stack->pushString(val.c_str());
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1544,12 +1544,12 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
char *desc = new char[strlen(xdesc) + 1];
strcpy(desc, xdesc);
stack->pushBool(true);
- if (FAILED(SaveGame(slot, desc, quick))) {
+ if (DID_FAIL(SaveGame(slot, desc, quick))) {
stack->pop();
stack->pushBool(false);
}
delete [] desc;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1561,7 +1561,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
_loading = true;
stack->pushBool(false);
script->sleep(0);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1571,7 +1571,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
stack->correctParams(1);
int Slot = stack->pop()->getInt();
stack->pushBool(isSaveSlotUsed(Slot));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1584,7 +1584,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
desc[0] = '\0';
getSaveSlotDescription(slot, desc);
stack->pushString(desc);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1595,7 +1595,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
int slot = stack->pop()->getInt();
emptySaveSlot(slot);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1605,7 +1605,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
stack->correctParams(1);
Game->_soundMgr->setVolumePercent(SOUND_SFX, (byte)stack->pop()->getInt());
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1615,7 +1615,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
stack->correctParams(1);
Game->_soundMgr->setVolumePercent(SOUND_SPEECH, (byte)stack->pop()->getInt());
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1625,7 +1625,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
stack->correctParams(1);
Game->_soundMgr->setVolumePercent(SOUND_MUSIC, (byte)stack->pop()->getInt());
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1635,7 +1635,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
stack->correctParams(1);
Game->_soundMgr->setMasterVolumePercent((byte)stack->pop()->getInt());
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1644,7 +1644,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
else if (strcmp(name, "GetGlobalSFXVolume") == 0) {
stack->correctParams(0);
stack->pushInt(_soundMgr->getVolumePercent(SOUND_SFX));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1653,7 +1653,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
else if (strcmp(name, "GetGlobalSpeechVolume") == 0) {
stack->correctParams(0);
stack->pushInt(_soundMgr->getVolumePercent(SOUND_SPEECH));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1662,7 +1662,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
else if (strcmp(name, "GetGlobalMusicVolume") == 0) {
stack->correctParams(0);
stack->pushInt(_soundMgr->getVolumePercent(SOUND_MUSIC));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1671,7 +1671,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
else if (strcmp(name, "GetGlobalMasterVolume") == 0) {
stack->correctParams(0);
stack->pushInt(_soundMgr->getMasterVolumePercent());
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1679,10 +1679,10 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetActiveCursor") == 0) {
stack->correctParams(1);
- if (SUCCEEDED(setActiveCursor(stack->pop()->getString()))) stack->pushBool(true);
+ if (DID_SUCCEED(setActiveCursor(stack->pop()->getString()))) stack->pushBool(true);
else stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1693,7 +1693,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
if (!_activeCursor || !_activeCursor->_filename) stack->pushNULL();
else stack->pushString(_activeCursor->_filename);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1704,7 +1704,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
if (!_activeCursor) stack->pushNULL();
else stack->pushNative(_activeCursor, true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1716,7 +1716,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
_activeCursor = NULL;
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1728,7 +1728,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
if (_activeCursor) stack->pushBool(true);
else stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1745,7 +1745,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
_fileManager->closeFile(file);
stack->pushBool(true);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1761,11 +1761,11 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
bool system = (strcmp(name, "SystemFadeOut") == 0 || strcmp(name, "SystemFadeOutAsync") == 0);
- _fader->fadeOut(DRGBA(red, green, blue, alpha), duration, system);
+ _fader->fadeOut(BYTETORGBA(red, green, blue, alpha), duration, system);
if (strcmp(name, "FadeOutAsync") != 0 && strcmp(name, "SystemFadeOutAsync") != 0) script->waitFor(_fader);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1781,11 +1781,11 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
bool system = (strcmp(name, "SystemFadeIn") == 0 || strcmp(name, "SystemFadeInAsync") == 0);
- _fader->fadeIn(DRGBA(red, green, blue, alpha), duration, system);
+ _fader->fadeIn(BYTETORGBA(red, green, blue, alpha), duration, system);
if (strcmp(name, "FadeInAsync") != 0 && strcmp(name, "SystemFadeInAsync") != 0) script->waitFor(_fader);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1794,7 +1794,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
else if (strcmp(name, "GetFadeColor") == 0) {
stack->correctParams(0);
stack->pushInt(_fader->getCurrentColor());
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1819,12 +1819,12 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
bool ret = false;
CBImage *image = Game->_renderer->takeScreenshot();
if (image) {
- ret = SUCCEEDED(image->saveBMPFile(filename));
+ ret = DID_SUCCEED(image->saveBMPFile(filename));
delete image;
} else ret = false;
stack->pushBool(ret);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1839,13 +1839,13 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
bool ret = false;
CBImage *image = Game->_renderer->takeScreenshot();
if (image) {
- ret = SUCCEEDED(image->resize(sizeX, sizeY));
- if (ret) ret = SUCCEEDED(image->saveBMPFile(filename));
+ ret = DID_SUCCEED(image->resize(sizeX, sizeY));
+ if (ret) ret = DID_SUCCEED(image->saveBMPFile(filename));
delete image;
} else ret = false;
stack->pushBool(ret);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1860,7 +1860,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
registerObject(win);
if (!val->isNULL()) win->setName(val->getString());
stack->pushNative(win, true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1873,11 +1873,11 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
if (_windows[i] == obj) {
unregisterObject(_windows[i]);
stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
}
stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1886,7 +1886,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
else if (strcmp(name, "OpenDocument") == 0) {
stack->correctParams(0);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1896,7 +1896,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
stack->correctParams(0);
DEBUG_DumpClassRegistry();
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1915,7 +1915,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
CBUtils::setString(&_loadImageName, val->getString());
}
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1934,7 +1934,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
CBUtils::setString(&_saveImageName, val->getString());
}
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1942,10 +1942,10 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetWaitCursor") == 0) {
stack->correctParams(1);
- if (SUCCEEDED(setWaitCursor(stack->pop()->getString()))) stack->pushBool(true);
+ if (DID_SUCCEED(setWaitCursor(stack->pop()->getString()))) stack->pushBool(true);
else stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1958,7 +1958,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1969,7 +1969,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
if (!_cursorNoninteractive || !_cursorNoninteractive->_filename) stack->pushNULL();
else stack->pushString(_cursorNoninteractive->_filename);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1980,7 +1980,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
if (!_cursorNoninteractive) stack->pushNULL();
else stack->pushNative(_cursorNoninteractive, true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1988,8 +1988,8 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ClearScriptCache") == 0) {
stack->correctParams(0);
- stack->pushBool(SUCCEEDED(_scEngine->emptyScriptCache()));
- return S_OK;
+ stack->pushBool(DID_SUCCEED(_scEngine->emptyScriptCache()));
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2005,7 +2005,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
delete _loadingIcon;
_loadingIcon = new CBSprite(this);
- if (!_loadingIcon || FAILED(_loadingIcon->loadFile(filename))) {
+ if (!_loadingIcon || DID_FAIL(_loadingIcon->loadFile(filename))) {
delete _loadingIcon;
_loadingIcon = NULL;
} else {
@@ -2015,7 +2015,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
}
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2026,7 +2026,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
delete _loadingIcon;
_loadingIcon = NULL;
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2039,7 +2039,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
_renderer->dumpData(filename);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2054,7 +2054,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
// do nothing
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2064,13 +2064,13 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
stack->correctParams(0);
delete _cachedThumbnail;
_cachedThumbnail = new CBSaveThumbHelper(this);
- if (FAILED(_cachedThumbnail->storeThumbnail())) {
+ if (DID_FAIL(_cachedThumbnail->storeThumbnail())) {
delete _cachedThumbnail;
_cachedThumbnail = NULL;
stack->pushBool(false);
} else stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2082,7 +2082,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
_cachedThumbnail = NULL;
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2120,7 +2120,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
file = NULL;
} else stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2131,7 +2131,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
_scEngine->enableProfiling();
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2142,7 +2142,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
_scEngine->disableProfiling();
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2155,7 +2155,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
#endif
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2168,7 +2168,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
#endif
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
else return CBObject::scCallMethod(script, stack, thisStack, name);
@@ -2567,14 +2567,14 @@ CScValue *CBGame::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CBGame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
// Name
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "Name") == 0) {
setName(value->getString());
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2583,7 +2583,7 @@ HRESULT CBGame::scSetProperty(const char *name, CScValue *value) {
else if (strcmp(name, "MouseX") == 0) {
_mousePos.x = value->getInt();
resetMousePos();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2592,14 +2592,14 @@ HRESULT CBGame::scSetProperty(const char *name, CScValue *value) {
else if (strcmp(name, "MouseY") == 0) {
_mousePos.y = value->getInt();
resetMousePos();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// Caption
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Name") == 0) {
- HRESULT res = CBObject::scSetProperty(name, value);
+ ERRORCODE res = CBObject::scSetProperty(name, value);
setWindowTitle();
return res;
}
@@ -2610,7 +2610,7 @@ HRESULT CBGame::scSetProperty(const char *name, CScValue *value) {
else if (strcmp(name, "MainObject") == 0) {
CBScriptable *obj = value->getNative();
if (obj == NULL || validObject((CBObject *)obj)) _mainObject = (CBObject *)obj;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2618,7 +2618,7 @@ HRESULT CBGame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Interactive") == 0) {
setInteractive(value->getBool());
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2627,7 +2627,7 @@ HRESULT CBGame::scSetProperty(const char *name, CScValue *value) {
else if (strcmp(name, "SFXVolume") == 0) {
Game->LOG(0, "**Warning** The SFXVolume attribute is obsolete");
Game->_soundMgr->setVolumePercent(SOUND_SFX, (byte)value->getInt());
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2636,7 +2636,7 @@ HRESULT CBGame::scSetProperty(const char *name, CScValue *value) {
else if (strcmp(name, "SpeechVolume") == 0) {
Game->LOG(0, "**Warning** The SpeechVolume attribute is obsolete");
Game->_soundMgr->setVolumePercent(SOUND_SPEECH, (byte)value->getInt());
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2645,7 +2645,7 @@ HRESULT CBGame::scSetProperty(const char *name, CScValue *value) {
else if (strcmp(name, "MusicVolume") == 0) {
Game->LOG(0, "**Warning** The MusicVolume attribute is obsolete");
Game->_soundMgr->setVolumePercent(SOUND_MUSIC, (byte)value->getInt());
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2654,7 +2654,7 @@ HRESULT CBGame::scSetProperty(const char *name, CScValue *value) {
else if (strcmp(name, "MasterVolume") == 0) {
Game->LOG(0, "**Warning** The MasterVolume attribute is obsolete");
Game->_soundMgr->setMasterVolumePercent((byte)value->getInt());
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2662,7 +2662,7 @@ HRESULT CBGame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Subtitles") == 0) {
_subtitles = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2670,7 +2670,7 @@ HRESULT CBGame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SubtitlesSpeed") == 0) {
_subtitlesSpeed = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2678,7 +2678,7 @@ HRESULT CBGame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "VideoSubtitles") == 0) {
_videoSubtitles = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2689,7 +2689,7 @@ HRESULT CBGame::scSetProperty(const char *name, CScValue *value) {
if (Enc < 0) Enc = 0;
if (Enc >= NUM_TEXT_ENCODINGS) Enc = NUM_TEXT_ENCODINGS - 1;
_textEncoding = (TTextEncoding)Enc;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2697,7 +2697,7 @@ HRESULT CBGame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "TextRTL") == 0) {
_textRTL = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2706,7 +2706,7 @@ HRESULT CBGame::scSetProperty(const char *name, CScValue *value) {
else if (strcmp(name, "SoundBufferSize") == 0) {
_soundBufferSizeSec = value->getInt();
_soundBufferSizeSec = MAX(3, _soundBufferSizeSec);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2714,7 +2714,7 @@ HRESULT CBGame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SuspendedRendering") == 0) {
_suspendedRendering = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2722,7 +2722,7 @@ HRESULT CBGame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SuppressScriptErrors") == 0) {
_suppressScriptErrors = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2730,7 +2730,7 @@ HRESULT CBGame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "AutorunDisabled") == 0) {
_autorunDisabled = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2738,7 +2738,7 @@ HRESULT CBGame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "AutoSaveOnExit") == 0) {
_autoSaveOnExit = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2746,7 +2746,7 @@ HRESULT CBGame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "AutoSaveSlot") == 0) {
_autoSaveSlot = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -2754,7 +2754,7 @@ HRESULT CBGame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "CursorHidden") == 0) {
_cursorHidden = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
else return CBObject::scSetProperty(name, value);
@@ -2770,8 +2770,8 @@ const char *CBGame::scToString() {
#define QUICK_MSG_DURATION 3000
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::displayQuickMsg() {
- if (_quickMessages.GetSize() == 0 || !_systemFont) return S_OK;
+ERRORCODE CBGame::displayQuickMsg() {
+ if (_quickMessages.GetSize() == 0 || !_systemFont) return STATUS_OK;
// update
for (int i = 0; i < _quickMessages.GetSize(); i++) {
@@ -2789,7 +2789,7 @@ HRESULT CBGame::displayQuickMsg() {
_systemFont->drawText((byte *)_quickMessages[i]->getText(), 0, posY, _renderer->_width);
posY += _systemFont->getTextHeight((byte *)_quickMessages[i]->getText(), _renderer->_width);
}
- return S_OK;
+ return STATUS_OK;
}
@@ -2818,15 +2818,15 @@ void CBGame::quickMessageForm(LPSTR fmt, ...) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::registerObject(CBObject *object) {
+ERRORCODE CBGame::registerObject(CBObject *object) {
_regObjects.Add(object);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::unregisterObject(CBObject *object) {
- if (!object) return S_OK;
+ERRORCODE CBGame::unregisterObject(CBObject *object) {
+ if (!object) return STATUS_OK;
// is it a window?
for (int i = 0; i < _windows.GetSize(); i++) {
@@ -2854,11 +2854,11 @@ HRESULT CBGame::unregisterObject(CBObject *object) {
_regObjects.RemoveAt(i);
if (!_loadInProgress) CSysClassRegistry::getInstance()->enumInstances(invalidateValues, "CScValue", (void *)object);
delete object;
- return S_OK;
+ return STATUS_OK;
}
}
- return E_FAIL;
+ return STATUS_FAILED;
}
@@ -2889,7 +2889,7 @@ bool CBGame::validObject(CBObject *object) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStack, char *name) {
+ERRORCODE CBGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStack, char *name) {
CScValue *thisObj;
//////////////////////////////////////////////////////////////////////////
@@ -3017,7 +3017,7 @@ HRESULT CBGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisS
if (val->isNULL()) a = 255;
else a = val->getInt();
- stack->pushInt(DRGBA(r, g, b, a));
+ stack->pushInt(BYTETORGBA(r, g, b, a));
}
//////////////////////////////////////////////////////////////////////////
@@ -3039,7 +3039,7 @@ HRESULT CBGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisS
stack->correctParams(1);
uint32 rgba = (uint32)stack->pop()->getInt();
- stack->pushInt(D3DCOLGetR(rgba));
+ stack->pushInt(RGBCOLGetR(rgba));
}
//////////////////////////////////////////////////////////////////////////
@@ -3049,7 +3049,7 @@ HRESULT CBGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisS
stack->correctParams(1);
uint32 rgba = (uint32)stack->pop()->getInt();
- stack->pushInt(D3DCOLGetG(rgba));
+ stack->pushInt(RGBCOLGetG(rgba));
}
//////////////////////////////////////////////////////////////////////////
@@ -3059,7 +3059,7 @@ HRESULT CBGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisS
stack->correctParams(1);
uint32 rgba = (uint32)stack->pop()->getInt();
- stack->pushInt(D3DCOLGetB(rgba));
+ stack->pushInt(RGBCOLGetB(rgba));
}
//////////////////////////////////////////////////////////////////////////
@@ -3069,7 +3069,7 @@ HRESULT CBGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisS
stack->correctParams(1);
uint32 rgba = (uint32)stack->pop()->getInt();
- stack->pushInt(D3DCOLGetA(rgba));
+ stack->pushInt(RGBCOLGetA(rgba));
}
//////////////////////////////////////////////////////////////////////////
@@ -3168,29 +3168,29 @@ HRESULT CBGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisS
stack->pushNULL();
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::showCursor() {
- if (_cursorHidden) return S_OK;
+ERRORCODE CBGame::showCursor() {
+ if (_cursorHidden) return STATUS_OK;
if (!_interactive && Game->_state == GAME_RUNNING) {
if (_cursorNoninteractive) return drawCursor(_cursorNoninteractive);
} else {
- if (_activeObject && !FAILED(_activeObject->showCursor())) return S_OK;
+ if (_activeObject && !DID_FAIL(_activeObject->showCursor())) return STATUS_OK;
else {
if (_activeObject && _activeCursor && _activeObject->getExtendedFlag("usable")) return drawCursor(_activeCursor);
else if (_cursor) return drawCursor(_cursor);
}
}
- return E_FAIL;
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::SaveGame(int slot, const char *desc, bool quickSave) {
+ERRORCODE CBGame::SaveGame(int slot, const char *desc, bool quickSave) {
char filename[MAX_PATH + 1];
getSaveSlotFilename(slot, filename);
@@ -3198,12 +3198,12 @@ HRESULT CBGame::SaveGame(int slot, const char *desc, bool quickSave) {
Game->applyEvent("BeforeSave", true);
- HRESULT ret;
+ ERRORCODE ret;
_indicatorDisplay = true;
_indicatorProgress = 0;
CBPersistMgr *pm = new CBPersistMgr(Game);
- if (FAILED(ret = pm->initSave(desc))) goto save_finish;
+ if (DID_FAIL(ret = pm->initSave(desc))) goto save_finish;
if (!quickSave) {
delete _saveLoadImage;
@@ -3211,16 +3211,16 @@ HRESULT CBGame::SaveGame(int slot, const char *desc, bool quickSave) {
if (_saveImageName) {
_saveLoadImage = new CBSurfaceSDL(this);
- if (!_saveLoadImage || FAILED(_saveLoadImage->create(_saveImageName, true, 0, 0, 0))) {
+ if (!_saveLoadImage || DID_FAIL(_saveLoadImage->create(_saveImageName, true, 0, 0, 0))) {
delete _saveLoadImage;
_saveLoadImage = NULL;
}
}
}
- if (FAILED(ret = CSysClassRegistry::getInstance()->saveTable(Game, pm, quickSave))) goto save_finish;
- if (FAILED(ret = CSysClassRegistry::getInstance()->saveInstances(Game, pm, quickSave))) goto save_finish;
- if (FAILED(ret = pm->saveFile(filename))) goto save_finish;
+ if (DID_FAIL(ret = CSysClassRegistry::getInstance()->saveTable(Game, pm, quickSave))) goto save_finish;
+ if (DID_FAIL(ret = CSysClassRegistry::getInstance()->saveInstances(Game, pm, quickSave))) goto save_finish;
+ if (DID_FAIL(ret = pm->saveFile(filename))) goto save_finish;
_registry->writeInt("System", "MostRecentSaveSlot", slot);
@@ -3236,7 +3236,7 @@ save_finish: // TODO: Remove gotos
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::loadGame(int slot) {
+ERRORCODE CBGame::loadGame(int slot) {
//Game->LOG(0, "Load start %d", CBUtils::GetUsedMemMB());
_loading = false;
@@ -3250,18 +3250,18 @@ HRESULT CBGame::loadGame(int slot) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::loadGame(const char *filename) {
+ERRORCODE CBGame::loadGame(const char *filename) {
LOG(0, "Loading game '%s'...", filename);
getDebugMgr()->onGameShutdown();
- HRESULT ret;
+ ERRORCODE ret;
delete _saveLoadImage;
_saveLoadImage = NULL;
if (_loadImageName) {
_saveLoadImage = new CBSurfaceSDL(this);
- if (!_saveLoadImage || FAILED(_saveLoadImage->create(_loadImageName, true, 0, 0, 0))) {
+ if (!_saveLoadImage || DID_FAIL(_saveLoadImage->create(_loadImageName, true, 0, 0, 0))) {
delete _saveLoadImage;
_saveLoadImage = NULL;
}
@@ -3273,11 +3273,11 @@ HRESULT CBGame::loadGame(const char *filename) {
_indicatorProgress = 0;
CBPersistMgr *pm = new CBPersistMgr(Game);
_dEBUG_AbsolutePathWarning = false;
- if (FAILED(ret = pm->initLoad(filename))) goto load_finish;
+ if (DID_FAIL(ret = pm->initLoad(filename))) goto load_finish;
- //if(FAILED(ret = cleanup())) goto load_finish;
- if (FAILED(ret = CSysClassRegistry::getInstance()->loadTable(Game, pm))) goto load_finish;
- if (FAILED(ret = CSysClassRegistry::getInstance()->loadInstances(Game, pm))) goto load_finish;
+ //if(DID_FAIL(ret = cleanup())) goto load_finish;
+ if (DID_FAIL(ret = CSysClassRegistry::getInstance()->loadTable(Game, pm))) goto load_finish;
+ if (DID_FAIL(ret = CSysClassRegistry::getInstance()->loadInstances(Game, pm))) goto load_finish;
// data initialization after load
initAfterLoad();
@@ -3306,7 +3306,7 @@ load_finish:
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::initAfterLoad() {
+ERRORCODE CBGame::initAfterLoad() {
CSysClassRegistry::getInstance()->enumInstances(afterLoadRegion, "CBRegion", NULL);
CSysClassRegistry::getInstance()->enumInstances(afterLoadSubFrame, "CBSubFrame", NULL);
CSysClassRegistry::getInstance()->enumInstances(afterLoadSound, "CBSound", NULL);
@@ -3316,7 +3316,7 @@ HRESULT CBGame::initAfterLoad() {
_scEngine->refreshScriptBreakpoints();
if (_store) _store->afterLoad();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -3348,8 +3348,8 @@ void CBGame::afterLoadScript(void *script, void *data) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::displayWindows(bool inGame) {
- HRESULT res;
+ERRORCODE CBGame::displayWindows(bool inGame) {
+ ERRORCODE res;
// did we lose focus? focus topmost window
if (_focusedWindow == NULL || !_focusedWindow->_visible || _focusedWindow->_disable) {
@@ -3367,26 +3367,26 @@ HRESULT CBGame::displayWindows(bool inGame) {
if (_windows[i]->_visible && _windows[i]->_inGame == inGame) {
res = _windows[i]->display();
- if (FAILED(res)) return res;
+ if (DID_FAIL(res)) return res;
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::playMusic(int channel, const char *filename, bool looping, uint32 loopStart) {
+ERRORCODE CBGame::playMusic(int channel, const char *filename, bool looping, uint32 loopStart) {
if (channel >= NUM_MUSIC_CHANNELS) {
Game->LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS);
- return E_FAIL;
+ return STATUS_FAILED;
}
delete _music[channel];
_music[channel] = NULL;
_music[channel] = new CBSound(Game);
- if (_music[channel] && SUCCEEDED(_music[channel]->setSound(filename, SOUND_MUSIC, true))) {
+ if (_music[channel] && DID_SUCCEED(_music[channel]->setSound(filename, SOUND_MUSIC, true))) {
if (_musicStartTime[channel]) {
_music[channel]->setPositionTime(_musicStartTime[channel]);
_musicStartTime[channel] = 0;
@@ -3396,66 +3396,66 @@ HRESULT CBGame::playMusic(int channel, const char *filename, bool looping, uint3
} else {
delete _music[channel];
_music[channel] = NULL;
- return E_FAIL;
+ return STATUS_FAILED;
}
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::stopMusic(int channel) {
+ERRORCODE CBGame::stopMusic(int channel) {
if (channel >= NUM_MUSIC_CHANNELS) {
Game->LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS);
- return E_FAIL;
+ return STATUS_FAILED;
}
if (_music[channel]) {
_music[channel]->stop();
delete _music[channel];
_music[channel] = NULL;
- return S_OK;
- } else return E_FAIL;
+ return STATUS_OK;
+ } else return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::pauseMusic(int channel) {
+ERRORCODE CBGame::pauseMusic(int channel) {
if (channel >= NUM_MUSIC_CHANNELS) {
Game->LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS);
- return E_FAIL;
+ return STATUS_FAILED;
}
if (_music[channel]) return _music[channel]->pause();
- else return E_FAIL;
+ else return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::resumeMusic(int channel) {
+ERRORCODE CBGame::resumeMusic(int channel) {
if (channel >= NUM_MUSIC_CHANNELS) {
Game->LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS);
- return E_FAIL;
+ return STATUS_FAILED;
}
if (_music[channel]) return _music[channel]->resume();
- else return E_FAIL;
+ else return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::setMusicStartTime(int channel, uint32 time) {
+ERRORCODE CBGame::setMusicStartTime(int channel, uint32 time) {
if (channel >= NUM_MUSIC_CHANNELS) {
Game->LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS);
- return E_FAIL;
+ return STATUS_FAILED;
}
_musicStartTime[channel] = time;
if (_music[channel] && _music[channel]->isPlaying()) return _music[channel]->setPositionTime(time);
- else return S_OK;
+ else return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::loadSettings(const char *filename) {
+ERRORCODE CBGame::loadSettings(const char *filename) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(SETTINGS)
TOKEN_TABLE(GAME)
@@ -3479,10 +3479,10 @@ HRESULT CBGame::loadSettings(const char *filename) {
byte *origBuffer = Game->_fileManager->readWholeFile(filename);
if (origBuffer == NULL) {
Game->LOG(0, "CBGame::LoadSettings failed for file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
- HRESULT ret = S_OK;
+ ERRORCODE ret = STATUS_OK;
byte *buffer = origBuffer;
byte *params;
@@ -3491,7 +3491,7 @@ HRESULT CBGame::loadSettings(const char *filename) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_SETTINGS) {
Game->LOG(0, "'SETTINGS' keyword expected in game settings file.");
- return E_FAIL;
+ return STATUS_FAILED;
}
buffer = params;
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
@@ -3503,7 +3503,7 @@ HRESULT CBGame::loadSettings(const char *filename) {
break;
case TOKEN_STRING_TABLE:
- if (FAILED(_stringTable->loadFile((char *)params))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(_stringTable->loadFile((char *)params))) cmd = PARSERR_GENERIC;
break;
case TOKEN_RESOLUTION:
@@ -3560,11 +3560,11 @@ HRESULT CBGame::loadSettings(const char *filename) {
}
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in game settings '%s'", filename);
- ret = E_FAIL;
+ ret = STATUS_FAILED;
}
if (cmd == PARSERR_GENERIC) {
Game->LOG(0, "Error loading game settings '%s'", filename);
- ret = E_FAIL;
+ ret = STATUS_FAILED;
}
_settingsAllowWindowed = _registry->readBool("Debug", "AllowWindowed", _settingsAllowWindowed);
@@ -3578,7 +3578,7 @@ HRESULT CBGame::loadSettings(const char *filename) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CBGame::persist(CBPersistMgr *persistMgr) {
if (!persistMgr->_saving)
cleanup();
@@ -3671,12 +3671,12 @@ HRESULT CBGame::persist(CBPersistMgr *persistMgr) {
if (!persistMgr->_saving)
_quitting = false;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::focusWindow(CUIWindow *Window) {
+ERRORCODE CBGame::focusWindow(CUIWindow *Window) {
CUIWindow *Prev = _focusedWindow;
for (int i = 0; i < _windows.GetSize(); i++) {
@@ -3690,15 +3690,15 @@ HRESULT CBGame::focusWindow(CUIWindow *Window) {
if (Window->_mode == WINDOW_NORMAL && Prev != Window && Game->validObject(Prev) && (Prev->_mode == WINDOW_EXCLUSIVE || Prev->_mode == WINDOW_SYSTEM_EXCLUSIVE))
return focusWindow(Prev);
- else return S_OK;
+ else return STATUS_OK;
}
}
- return E_FAIL;
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::freeze(bool includingMusic) {
+ERRORCODE CBGame::freeze(bool includingMusic) {
if (_freezeLevel == 0) {
_scEngine->pauseAll();
_soundMgr->pauseAll(includingMusic);
@@ -3709,13 +3709,13 @@ HRESULT CBGame::freeze(bool includingMusic) {
_state = GAME_FROZEN;
_freezeLevel++;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::unfreeze() {
- if (_freezeLevel == 0) return S_OK;
+ERRORCODE CBGame::unfreeze() {
+ if (_freezeLevel == 0) return STATUS_OK;
_freezeLevel--;
if (_freezeLevel == 0) {
@@ -3725,7 +3725,7 @@ HRESULT CBGame::unfreeze() {
_soundMgr->resumeAll();
}
- return S_OK;
+ return STATUS_OK;
}
@@ -3811,14 +3811,14 @@ bool CBGame::handleMouseWheel(int Delta) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor) {
+ERRORCODE CBGame::getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor) {
if (verMajor) *verMajor = DCGF_VER_MAJOR;
if (verMinor) *verMinor = DCGF_VER_MINOR;
if (extMajor) *extMajor = 0;
if (extMinor) *extMinor = 0;
- return S_OK;
+ return STATUS_OK;
}
@@ -3851,12 +3851,12 @@ void CBGame::setWindowTitle() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::getSaveSlotFilename(int slot, char *buffer) {
+ERRORCODE CBGame::getSaveSlotFilename(int slot, char *buffer) {
AnsiString dataDir = getDataDir();
//sprintf(Buffer, "%s/save%03d.%s", dataDir.c_str(), Slot, _savedGameExt);
sprintf(buffer, "save%03d.%s", slot, _savedGameExt);
warning("Saving %s - we really should prefix these things to avoid collisions.", buffer);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -3872,26 +3872,26 @@ AnsiString CBGame::getDataDir() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::getSaveSlotDescription(int slot, char *buffer) {
+ERRORCODE CBGame::getSaveSlotDescription(int slot, char *buffer) {
buffer[0] = '\0';
char filename[MAX_PATH + 1];
getSaveSlotFilename(slot, filename);
CBPersistMgr *pm = new CBPersistMgr(Game);
- if (!pm) return E_FAIL;
+ if (!pm) return STATUS_FAILED;
_dEBUG_AbsolutePathWarning = false;
- if (FAILED(pm->initLoad(filename))) {
+ if (DID_FAIL(pm->initLoad(filename))) {
_dEBUG_AbsolutePathWarning = true;
delete pm;
- return E_FAIL;
+ return STATUS_FAILED;
}
_dEBUG_AbsolutePathWarning = true;
strcpy(buffer, pm->_savedDescription);
delete pm;
- return S_OK;
+ return STATUS_OK;
}
@@ -3909,24 +3909,24 @@ bool CBGame::isSaveSlotUsed(int slot) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::emptySaveSlot(int slot) {
+ERRORCODE CBGame::emptySaveSlot(int slot) {
char filename[MAX_PATH + 1];
getSaveSlotFilename(slot, filename);
CBPlatform::deleteFile(filename);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::setActiveObject(CBObject *obj) {
+ERRORCODE CBGame::setActiveObject(CBObject *obj) {
// not-active when game is frozen
if (obj && !Game->_interactive && !obj->_nonIntMouseEvents) {
obj = NULL;
}
- if (obj == _activeObject) return S_OK;
+ if (obj == _activeObject) return STATUS_OK;
if (_activeObject) _activeObject->applyEvent("MouseLeave");
//if(ValidObject(_activeObject)) _activeObject->applyEvent("MouseLeave");
@@ -3935,24 +3935,24 @@ HRESULT CBGame::setActiveObject(CBObject *obj) {
_activeObject->applyEvent("MouseEntry");
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::pushViewport(CBViewport *viewport) {
+ERRORCODE CBGame::pushViewport(CBViewport *viewport) {
_viewportSP++;
if (_viewportSP >= _viewportStack.GetSize()) _viewportStack.Add(viewport);
else _viewportStack[_viewportSP] = viewport;
_renderer->setViewport(viewport->getRect());
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::popViewport() {
+ERRORCODE CBGame::popViewport() {
_viewportSP--;
if (_viewportSP < -1) Game->LOG(0, "Fatal: Viewport stack underflow!");
@@ -3962,13 +3962,13 @@ HRESULT CBGame::popViewport() {
_renderer->_width + _renderer->_drawOffsetX,
_renderer->_height + _renderer->_drawOffsetY);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::getCurrentViewportRect(RECT *rect, bool *custom) {
- if (rect == NULL) return E_FAIL;
+ERRORCODE CBGame::getCurrentViewportRect(RECT *rect, bool *custom) {
+ if (rect == NULL) return STATUS_FAILED;
else {
if (_viewportSP >= 0) {
CBPlatform::copyRect(rect, _viewportStack[_viewportSP]->getRect());
@@ -3981,13 +3981,13 @@ HRESULT CBGame::getCurrentViewportRect(RECT *rect, bool *custom) {
if (custom) *custom = false;
}
- return S_OK;
+ return STATUS_OK;
}
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::getCurrentViewportOffset(int *offsetX, int *offsetY) {
+ERRORCODE CBGame::getCurrentViewportOffset(int *offsetX, int *offsetY) {
if (_viewportSP >= 0) {
if (offsetX) *offsetX = _viewportStack[_viewportSP]->_offsetX;
if (offsetY) *offsetY = _viewportStack[_viewportSP]->_offsetY;
@@ -3996,19 +3996,19 @@ HRESULT CBGame::getCurrentViewportOffset(int *offsetX, int *offsetY) {
if (offsetY) *offsetY = 0;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::windowLoadHook(CUIWindow *win, char **buf, char **params) {
- return E_FAIL;
+ERRORCODE CBGame::windowLoadHook(CUIWindow *win, char **buf, char **params) {
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::windowScriptMethodHook(CUIWindow *win, CScScript *script, CScStack *stack, const char *name) {
- return E_FAIL;
+ERRORCODE CBGame::windowScriptMethodHook(CUIWindow *win, CScScript *script, CScStack *stack, const char *name) {
+ return STATUS_FAILED;
}
@@ -4030,23 +4030,23 @@ void CBGame::resetMousePos() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::displayContent(bool doUpdate, bool displayAll) {
- return S_OK;
+ERRORCODE CBGame::displayContent(bool doUpdate, bool displayAll) {
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::displayContentSimple() {
+ERRORCODE CBGame::displayContentSimple() {
// fill black
_renderer->fill(0, 0, 0);
if (_indicatorDisplay) displayIndicator();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::displayIndicator() {
+ERRORCODE CBGame::displayIndicator() {
if (_saveLoadImage) {
RECT rc;
CBPlatform::setRect(&rc, 0, 0, _saveLoadImage->getWidth(), _saveLoadImage->getHeight());
@@ -4054,29 +4054,29 @@ HRESULT CBGame::displayIndicator() {
else _saveLoadImage->displayTrans(_saveImageX, _saveImageY, rc);
}
- if ((!_indicatorDisplay && _indicatorWidth <= 0) || _indicatorHeight <= 0) return S_OK;
+ if ((!_indicatorDisplay && _indicatorWidth <= 0) || _indicatorHeight <= 0) return STATUS_OK;
_renderer->setupLines();
for (int i = 0; i < _indicatorHeight; i++)
_renderer->drawLine(_indicatorX, _indicatorY + i, _indicatorX + (int)(_indicatorWidth * (float)((float)_indicatorProgress / 100.0f)), _indicatorY + i, _indicatorColor);
_renderer->setup2D();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::updateMusicCrossfade() {
+ERRORCODE CBGame::updateMusicCrossfade() {
/* byte GlobMusicVol = _soundMgr->getVolumePercent(SOUND_MUSIC); */
- if (!_musicCrossfadeRunning) return S_OK;
- if (_state == GAME_FROZEN) return S_OK;
+ if (!_musicCrossfadeRunning) return STATUS_OK;
+ if (_state == GAME_FROZEN) return STATUS_OK;
if (_musicCrossfadeChannel1 < 0 || _musicCrossfadeChannel1 >= NUM_MUSIC_CHANNELS || !_music[_musicCrossfadeChannel1]) {
_musicCrossfadeRunning = false;
- return S_OK;
+ return STATUS_OK;
}
if (_musicCrossfadeChannel2 < 0 || _musicCrossfadeChannel2 >= NUM_MUSIC_CHANNELS || !_music[_musicCrossfadeChannel2]) {
_musicCrossfadeRunning = false;
- return S_OK;
+ return STATUS_OK;
}
if (!_music[_musicCrossfadeChannel1]->isPlaying()) _music[_musicCrossfadeChannel1]->play();
@@ -4114,17 +4114,17 @@ HRESULT CBGame::updateMusicCrossfade() {
//Game->QuickMessageForm("%d %d", _music[_musicCrossfadeChannel1]->GetVolume(), _music[_musicCrossfadeChannel2]->GetVolume());
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::resetContent() {
+ERRORCODE CBGame::resetContent() {
_scEngine->clearGlobals();
//_timer = 0;
//_liveTimer = 0;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -4142,33 +4142,33 @@ void CBGame::DEBUG_DumpClassRegistry() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::invalidateDeviceObjects() {
+ERRORCODE CBGame::invalidateDeviceObjects() {
for (int i = 0; i < _regObjects.GetSize(); i++) {
_regObjects[i]->invalidateDeviceObjects();
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::restoreDeviceObjects() {
+ERRORCODE CBGame::restoreDeviceObjects() {
for (int i = 0; i < _regObjects.GetSize(); i++) {
_regObjects[i]->restoreDeviceObjects();
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::setWaitCursor(const char *filename) {
+ERRORCODE CBGame::setWaitCursor(const char *filename) {
delete _cursorNoninteractive;
_cursorNoninteractive = NULL;
_cursorNoninteractive = new CBSprite(Game);
- if (!_cursorNoninteractive || FAILED(_cursorNoninteractive->loadFile(filename))) {
+ if (!_cursorNoninteractive || DID_FAIL(_cursorNoninteractive->loadFile(filename))) {
delete _cursorNoninteractive;
_cursorNoninteractive = NULL;
- return E_FAIL;
- } else return S_OK;
+ return STATUS_FAILED;
+ } else return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -4179,20 +4179,20 @@ bool CBGame::isVideoPlaying() {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::stopVideo() {
+ERRORCODE CBGame::stopVideo() {
if (_videoPlayer->isPlaying()) _videoPlayer->stop();
if (_theoraPlayer && _theoraPlayer->isPlaying()) {
_theoraPlayer->stop();
delete _theoraPlayer;
_theoraPlayer = NULL;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::drawCursor(CBSprite *cursor) {
- if (!cursor) return E_FAIL;
+ERRORCODE CBGame::drawCursor(CBSprite *cursor) {
+ if (!cursor) return STATUS_FAILED;
if (cursor != _lastCursor) {
cursor->reset();
_lastCursor = cursor;
@@ -4203,8 +4203,8 @@ HRESULT CBGame::drawCursor(CBSprite *cursor) {
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::onActivate(bool activate, bool refreshMouse) {
- if (_shuttingDown || !_renderer) return S_OK;
+ERRORCODE CBGame::onActivate(bool activate, bool refreshMouse) {
+ if (_shuttingDown || !_renderer) return STATUS_OK;
_renderer->_active = activate;
@@ -4217,14 +4217,14 @@ HRESULT CBGame::onActivate(bool activate, bool refreshMouse) {
if (activate) _soundMgr->resumeAll();
else _soundMgr->pauseAll();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::onMouseLeftDown() {
+ERRORCODE CBGame::onMouseLeftDown() {
if (_activeObject) _activeObject->handleMouse(MOUSE_CLICK, MOUSE_BUTTON_LEFT);
- bool handled = _state == GAME_RUNNING && SUCCEEDED(applyEvent("LeftClick"));
+ bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("LeftClick"));
if (!handled) {
if (_activeObject != NULL) {
_activeObject->applyEvent("LeftClick");
@@ -4235,131 +4235,131 @@ HRESULT CBGame::onMouseLeftDown() {
_mouseLeftDown = true;
CBPlatform::setCapture(/*_renderer->_window*/);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::onMouseLeftUp() {
+ERRORCODE CBGame::onMouseLeftUp() {
if (_activeObject) _activeObject->handleMouse(MOUSE_RELEASE, MOUSE_BUTTON_LEFT);
CBPlatform::releaseCapture();
_capturedObject = NULL;
_mouseLeftDown = false;
- bool handled = _state == GAME_RUNNING && SUCCEEDED(applyEvent("LeftRelease"));
+ bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("LeftRelease"));
if (!handled) {
if (_activeObject != NULL) {
_activeObject->applyEvent("LeftRelease");
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::onMouseLeftDblClick() {
- if (_state == GAME_RUNNING && !_interactive) return S_OK;
+ERRORCODE CBGame::onMouseLeftDblClick() {
+ if (_state == GAME_RUNNING && !_interactive) return STATUS_OK;
if (_activeObject) _activeObject->handleMouse(MOUSE_DBLCLICK, MOUSE_BUTTON_LEFT);
- bool handled = _state == GAME_RUNNING && SUCCEEDED(applyEvent("LeftDoubleClick"));
+ bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("LeftDoubleClick"));
if (!handled) {
if (_activeObject != NULL) {
_activeObject->applyEvent("LeftDoubleClick");
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::onMouseRightDblClick() {
- if (_state == GAME_RUNNING && !_interactive) return S_OK;
+ERRORCODE CBGame::onMouseRightDblClick() {
+ if (_state == GAME_RUNNING && !_interactive) return STATUS_OK;
if (_activeObject) _activeObject->handleMouse(MOUSE_DBLCLICK, MOUSE_BUTTON_RIGHT);
- bool handled = _state == GAME_RUNNING && SUCCEEDED(applyEvent("RightDoubleClick"));
+ bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("RightDoubleClick"));
if (!handled) {
if (_activeObject != NULL) {
_activeObject->applyEvent("RightDoubleClick");
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::onMouseRightDown() {
+ERRORCODE CBGame::onMouseRightDown() {
if (_activeObject) _activeObject->handleMouse(MOUSE_CLICK, MOUSE_BUTTON_RIGHT);
- bool handled = _state == GAME_RUNNING && SUCCEEDED(applyEvent("RightClick"));
+ bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("RightClick"));
if (!handled) {
if (_activeObject != NULL) {
_activeObject->applyEvent("RightClick");
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::onMouseRightUp() {
+ERRORCODE CBGame::onMouseRightUp() {
if (_activeObject) _activeObject->handleMouse(MOUSE_RELEASE, MOUSE_BUTTON_RIGHT);
- bool handled = _state == GAME_RUNNING && SUCCEEDED(applyEvent("RightRelease"));
+ bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("RightRelease"));
if (!handled) {
if (_activeObject != NULL) {
_activeObject->applyEvent("RightRelease");
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::onMouseMiddleDown() {
- if (_state == GAME_RUNNING && !_interactive) return S_OK;
+ERRORCODE CBGame::onMouseMiddleDown() {
+ if (_state == GAME_RUNNING && !_interactive) return STATUS_OK;
if (_activeObject) _activeObject->handleMouse(MOUSE_CLICK, MOUSE_BUTTON_MIDDLE);
- bool handled = _state == GAME_RUNNING && SUCCEEDED(applyEvent("MiddleClick"));
+ bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("MiddleClick"));
if (!handled) {
if (_activeObject != NULL) {
_activeObject->applyEvent("MiddleClick");
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::onMouseMiddleUp() {
+ERRORCODE CBGame::onMouseMiddleUp() {
if (_activeObject) _activeObject->handleMouse(MOUSE_RELEASE, MOUSE_BUTTON_MIDDLE);
- bool handled = _state == GAME_RUNNING && SUCCEEDED(applyEvent("MiddleRelease"));
+ bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("MiddleRelease"));
if (!handled) {
if (_activeObject != NULL) {
_activeObject->applyEvent("MiddleRelease");
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::onPaint() {
+ERRORCODE CBGame::onPaint() {
if (_renderer && _renderer->_windowed && _renderer->_ready) {
_renderer->initLoop();
displayContent(false, true);
displayDebugInfo();
_renderer->windowedBlt();
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::onWindowClose() {
+ERRORCODE CBGame::onWindowClose() {
if (canHandleEvent("QuitGame")) {
if (_state != GAME_FROZEN) Game->applyEvent("QuitGame");
- return S_OK;
- } else return E_FAIL;
+ return STATUS_OK;
+ } else return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::displayDebugInfo() {
+ERRORCODE CBGame::displayDebugInfo() {
char str[100];
if (_dEBUG_ShowFPS) {
@@ -4396,7 +4396,7 @@ HRESULT CBGame::displayDebugInfo() {
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -4445,19 +4445,19 @@ void CBGame::getMousePos(POINT *pos) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::miniUpdate() {
- if (!_miniUpdateEnabled) return S_OK;
+ERRORCODE CBGame::miniUpdate() {
+ if (!_miniUpdateEnabled) return STATUS_OK;
if (CBPlatform::getTime() - _lastMiniUpdate > 200) {
if (_soundMgr) _soundMgr->initLoop();
_lastMiniUpdate = CBPlatform::getTime();
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBGame::onScriptShutdown(CScScript *script) {
- return S_OK;
+ERRORCODE CBGame::onScriptShutdown(CScScript *script) {
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/wintermute/Base/BGame.h b/engines/wintermute/Base/BGame.h
index 0d1d0fe15d..44b5b4a86d 100644
--- a/engines/wintermute/Base/BGame.h
+++ b/engines/wintermute/Base/BGame.h
@@ -38,7 +38,7 @@
namespace WinterMute {
-typedef void (*ENGINE_LOG_CALLBACK)(char *Text, HRESULT Result, void *Data);
+typedef void (*ENGINE_LOG_CALLBACK)(char *Text, ERRORCODE Result, void *Data);
class CBSoundMgr;
class CBFader;
@@ -67,19 +67,19 @@ class CBGame: public CBObject {
public:
DECLARE_PERSISTENT(CBGame, CBObject)
- virtual HRESULT onScriptShutdown(CScScript *script);
+ virtual ERRORCODE onScriptShutdown(CScScript *script);
- virtual HRESULT onActivate(bool activate, bool refreshMouse);
- virtual HRESULT onMouseLeftDown();
- virtual HRESULT onMouseLeftUp();
- virtual HRESULT onMouseLeftDblClick();
- virtual HRESULT onMouseRightDblClick();
- virtual HRESULT onMouseRightDown();
- virtual HRESULT onMouseRightUp();
- virtual HRESULT onMouseMiddleDown();
- virtual HRESULT onMouseMiddleUp();
- virtual HRESULT onPaint();
- virtual HRESULT onWindowClose();
+ virtual ERRORCODE onActivate(bool activate, bool refreshMouse);
+ virtual ERRORCODE onMouseLeftDown();
+ virtual ERRORCODE onMouseLeftUp();
+ virtual ERRORCODE onMouseLeftDblClick();
+ virtual ERRORCODE onMouseRightDblClick();
+ virtual ERRORCODE onMouseRightDown();
+ virtual ERRORCODE onMouseRightUp();
+ virtual ERRORCODE onMouseMiddleDown();
+ virtual ERRORCODE onMouseMiddleUp();
+ virtual ERRORCODE onPaint();
+ virtual ERRORCODE onWindowClose();
bool isLeftDoubleClick();
bool isRightDoubleClick();
@@ -89,14 +89,14 @@ public:
uint32 _lastMiniUpdate;
bool _miniUpdateEnabled;
- virtual HRESULT miniUpdate();
+ virtual ERRORCODE miniUpdate();
void getMousePos(POINT *Pos);
RECT _mouseLockRect;
bool _shuttingDown;
- virtual HRESULT displayDebugInfo();
+ virtual ERRORCODE displayDebugInfo();
bool _dEBUG_ShowFPS;
bool _suspendedRendering;
@@ -110,10 +110,10 @@ public:
int _loadingIconY;
int _loadingIconPersistent;
- virtual HRESULT resetContent();
+ virtual ERRORCODE resetContent();
void DEBUG_DumpClassRegistry();
- HRESULT setWaitCursor(const char *filename);
+ ERRORCODE setWaitCursor(const char *filename);
char *_localSaveDir;
bool _saveDirChecked;
@@ -137,7 +137,7 @@ public:
int _loadImageY;
CBSurface *_saveLoadImage;
- HRESULT displayIndicator();
+ ERRORCODE displayIndicator();
int _thumbnailWidth;
int _thumbnailHeight;
@@ -159,20 +159,20 @@ public:
float _offsetPercentY;
CBObject *_mainObject;
- HRESULT initInput();
- HRESULT initLoop();
+ ERRORCODE initInput();
+ ERRORCODE initLoop();
uint32 _currentTime;
uint32 _deltaTime;
CBFont *_systemFont;
CBFont *_videoFont;
- HRESULT initialize1();
- HRESULT initialize2();
- HRESULT initialize3();
+ ERRORCODE initialize1();
+ ERRORCODE initialize2();
+ ERRORCODE initialize3();
CBFileManager *_fileManager;
CBTransitionMgr *_transMgr;
CBDebugger *getDebugMgr();
- void LOG(HRESULT res, LPCSTR fmt, ...);
+ void LOG(ERRORCODE res, LPCSTR fmt, ...);
CBRenderer *_renderer;
CBSoundMgr *_soundMgr;
@@ -191,8 +191,8 @@ public:
void *_dEBUG_LogFile;
int _sequence;
- virtual HRESULT loadFile(const char *filename);
- virtual HRESULT loadBuffer(byte *buffer, bool complete = true);
+ virtual ERRORCODE loadFile(const char *filename);
+ virtual ERRORCODE loadBuffer(byte *buffer, bool complete = true);
CBArray<CBQuickMsg *, CBQuickMsg *> _quickMessages;
CBArray<CUIWindow *, CUIWindow *> _windows;
CBArray<CBViewport *, CBViewport *> _viewportStack;
@@ -217,14 +217,14 @@ public:
CBFader *_fader;
bool _suppressScriptErrors;
- virtual HRESULT invalidateDeviceObjects();
- virtual HRESULT restoreDeviceObjects();
+ virtual ERRORCODE invalidateDeviceObjects();
+ virtual ERRORCODE restoreDeviceObjects();
- virtual HRESULT ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStack, char *name);
+ virtual ERRORCODE ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStack, char *name);
// scripting interface
virtual CScValue *scGetProperty(const char *name);
- virtual HRESULT scSetProperty(const char *name, CScValue *value);
- virtual HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ERRORCODE scSetProperty(const char *name, CScValue *value);
+ virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
virtual const char *scToString();
// compatibility bits
bool _compatKillMethodThreads;
@@ -245,21 +245,21 @@ public:
int _scheduledLoadSlot;
bool _loading;
bool _personalizedSave;
- HRESULT emptySaveSlot(int slot);
+ ERRORCODE emptySaveSlot(int slot);
bool isSaveSlotUsed(int slot);
- HRESULT getSaveSlotDescription(int slot, char *buffer);
- HRESULT getSaveSlotFilename(int slot, char *buffer);
+ ERRORCODE getSaveSlotDescription(int slot, char *buffer);
+ ERRORCODE getSaveSlotFilename(int slot, char *buffer);
void setWindowTitle();
virtual bool handleMouseWheel(int delta);
bool _quitting;
- virtual HRESULT getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor);
+ virtual ERRORCODE getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor);
virtual bool handleKeypress(Common::Event *event, bool printable = false);
virtual void handleKeyRelease(Common::Event *event);
int _freezeLevel;
- HRESULT unfreeze();
- HRESULT freeze(bool includingMusic = true);
- HRESULT focusWindow(CUIWindow *window);
+ ERRORCODE unfreeze();
+ ERRORCODE freeze(bool includingMusic = true);
+ ERRORCODE focusWindow(CUIWindow *window);
CVidPlayer *_videoPlayer;
CVidTheoraPlayer *_theoraPlayer;
bool _loadInProgress;
@@ -272,12 +272,12 @@ public:
static void afterLoadScript(void *script, void *data);
static void invalidateValues(void *value, void *data);
- HRESULT loadSettings(const char *filename);
- HRESULT resumeMusic(int channel);
- HRESULT setMusicStartTime(int channel, uint32 time);
- HRESULT pauseMusic(int channel);
- HRESULT stopMusic(int channel);
- HRESULT playMusic(int channel, const char *filename, bool looping = true, uint32 loopStart = 0);
+ ERRORCODE loadSettings(const char *filename);
+ ERRORCODE resumeMusic(int channel);
+ ERRORCODE setMusicStartTime(int channel, uint32 time);
+ ERRORCODE pauseMusic(int channel);
+ ERRORCODE stopMusic(int channel);
+ ERRORCODE playMusic(int channel, const char *filename, bool looping = true, uint32 loopStart = 0);
CBSound *_music[NUM_MUSIC_CHANNELS];
bool _musicCrossfadeRunning;
bool _musicCrossfadeSwap;
@@ -285,14 +285,14 @@ public:
uint32 _musicCrossfadeLength;
int _musicCrossfadeChannel1;
int _musicCrossfadeChannel2;
- HRESULT displayWindows(bool inGame = false);
+ ERRORCODE displayWindows(bool inGame = false);
CBRegistry *_registry;
bool _useD3D;
- virtual HRESULT cleanup();
- virtual HRESULT loadGame(int slot);
- virtual HRESULT loadGame(const char *filename);
- virtual HRESULT SaveGame(int slot, const char *desc, bool quickSave = false);
- virtual HRESULT showCursor();
+ virtual ERRORCODE cleanup();
+ virtual ERRORCODE loadGame(int slot);
+ virtual ERRORCODE loadGame(const char *filename);
+ virtual ERRORCODE SaveGame(int slot, const char *desc, bool quickSave = false);
+ virtual ERRORCODE showCursor();
CBSprite *_cursorNoninteractive;
CBObject *_activeObject;
@@ -312,36 +312,36 @@ public:
CBObject *_capturedObject;
POINT _mousePos;
bool validObject(CBObject *object);
- HRESULT unregisterObject(CBObject *object);
- HRESULT registerObject(CBObject *object);
+ ERRORCODE unregisterObject(CBObject *object);
+ ERRORCODE registerObject(CBObject *object);
void quickMessage(const char *text);
void quickMessageForm(LPSTR fmt, ...);
- HRESULT displayQuickMsg();
+ ERRORCODE displayQuickMsg();
uint32 _fps;
- HRESULT updateMusicCrossfade();
+ ERRORCODE updateMusicCrossfade();
bool isVideoPlaying();
- HRESULT stopVideo();
+ ERRORCODE stopVideo();
CBArray<CBObject *, CBObject *> _regObjects;
public:
- virtual HRESULT displayContent(bool update = true, bool displayAll = false);
- virtual HRESULT displayContentSimple();
+ virtual ERRORCODE displayContent(bool update = true, bool displayAll = false);
+ virtual ERRORCODE displayContentSimple();
bool _forceNonStreamedSounds;
void resetMousePos();
int _subtitlesSpeed;
void setInteractive(bool state);
- virtual HRESULT windowLoadHook(CUIWindow *win, char **buf, char **params);
- virtual HRESULT windowScriptMethodHook(CUIWindow *win, CScScript *script, CScStack *stack, const char *name);
- HRESULT getCurrentViewportOffset(int *offsetX = NULL, int *offsetY = NULL);
- HRESULT getCurrentViewportRect(RECT *rect, bool *custom = NULL);
- HRESULT popViewport();
- HRESULT pushViewport(CBViewport *Viewport);
- HRESULT setActiveObject(CBObject *Obj);
+ virtual ERRORCODE windowLoadHook(CUIWindow *win, char **buf, char **params);
+ virtual ERRORCODE windowScriptMethodHook(CUIWindow *win, CScScript *script, CScStack *stack, const char *name);
+ ERRORCODE getCurrentViewportOffset(int *offsetX = NULL, int *offsetY = NULL);
+ ERRORCODE getCurrentViewportRect(RECT *rect, bool *custom = NULL);
+ ERRORCODE popViewport();
+ ERRORCODE pushViewport(CBViewport *Viewport);
+ ERRORCODE setActiveObject(CBObject *Obj);
CBSprite *_lastCursor;
- HRESULT drawCursor(CBSprite *Cursor);
+ ERRORCODE drawCursor(CBSprite *Cursor);
- virtual HRESULT initAfterLoad();
+ virtual ERRORCODE initAfterLoad();
CBSaveThumbHelper *_cachedThumbnail;
AnsiString getDataDir();
void addMem(int bytes);
diff --git a/engines/wintermute/Base/BImage.cpp b/engines/wintermute/Base/BImage.cpp
index c119e023c1..c28577087b 100644
--- a/engines/wintermute/Base/BImage.cpp
+++ b/engines/wintermute/Base/BImage.cpp
@@ -70,7 +70,7 @@ CBImage::~CBImage() {
#endif
}
-HRESULT CBImage::loadFile(const Common::String &filename) {
+ERRORCODE CBImage::loadFile(const Common::String &filename) {
_filename = filename;
if (StringUtil::startsWith(filename, "savegame:", true)) {
@@ -88,14 +88,14 @@ HRESULT CBImage::loadFile(const Common::String &filename) {
}
Common::SeekableReadStream *file = Game->_fileManager->openFile(filename.c_str());
- if (!file) return E_FAIL;
+ if (!file) return STATUS_FAILED;
_decoder->loadStream(*file);
_surface = _decoder->getSurface();
_palette = _decoder->getPalette();
Game->_fileManager->closeFile(file);
- return S_OK;
+ return STATUS_OK;
}
byte CBImage::getAlphaAt(int x, int y) {
@@ -112,21 +112,21 @@ void CBImage::copyFrom(Graphics::Surface *surface) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBImage::saveBMPFile(const char *filename) {
+ERRORCODE CBImage::saveBMPFile(const char *filename) {
#if 0
- if (!_bitmap) return E_FAIL;
+ if (!_bitmap) return STATUS_FAILED;
- if (FreeImage_Save(FIF_BMP, _bitmap, filename)) return S_OK;
- else return E_FAIL;
+ if (FreeImage_Save(FIF_BMP, _bitmap, filename)) return STATUS_OK;
+ else return STATUS_FAILED;
#endif
- return E_FAIL;
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBImage::resize(int newWidth, int newHeight) {
+ERRORCODE CBImage::resize(int newWidth, int newHeight) {
#if 0
- if (!_bitmap) return E_FAIL;
+ if (!_bitmap) return STATUS_FAILED;
if (newWidth == 0) NewWidth = FreeImage_GetWidth(_bitmap);
if (newHeight == 0) NewHeight = FreeImage_GetHeight(_bitmap);
@@ -136,10 +136,10 @@ HRESULT CBImage::resize(int newWidth, int newHeight) {
if (newImg) {
FreeImage_Unload(_bitmap);
_bitmap = newImg;
- return S_OK;
- } else return E_FAIL;
+ return STATUS_OK;
+ } else return STATUS_FAILED;
#endif
- return E_FAIL;
+ return STATUS_FAILED;
}
@@ -248,7 +248,7 @@ bool CBImage::writeBMPToStream(Common::WriteStream *stream) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBImage::copyFrom(CBImage *origImage, int newWidth, int newHeight) {
+ERRORCODE CBImage::copyFrom(CBImage *origImage, int newWidth, int newHeight) {
#if 0
if (_bitmap) FreeImage_Unload(_bitmap);
@@ -264,7 +264,7 @@ HRESULT CBImage::copyFrom(CBImage *origImage, int newWidth, int newHeight) {
_deletableSurface = NULL;
}
_surface = _deletableSurface = temp.scale(newWidth, newHeight);
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Base/BImage.h b/engines/wintermute/Base/BImage.h
index 8edde54d3f..c66f6f4ca3 100644
--- a/engines/wintermute/Base/BImage.h
+++ b/engines/wintermute/Base/BImage.h
@@ -47,7 +47,7 @@ public:
CBImage(CBGame *inGame, FIBITMAP *bitmap = NULL);
~CBImage();
- HRESULT loadFile(const Common::String &filename);
+ ERRORCODE loadFile(const Common::String &filename);
const Graphics::Surface *getSurface() const {
return _surface;
};
@@ -56,9 +56,9 @@ public:
}
byte getAlphaAt(int x, int y);
bool writeBMPToStream(Common::WriteStream *stream);
- HRESULT resize(int newWidth, int newHeight);
- HRESULT saveBMPFile(const char *filename);
- HRESULT copyFrom(CBImage *origImage, int newWidth = 0, int newHeight = 0);
+ ERRORCODE resize(int newWidth, int newHeight);
+ ERRORCODE saveBMPFile(const char *filename);
+ ERRORCODE copyFrom(CBImage *origImage, int newWidth = 0, int newHeight = 0);
void copyFrom(Graphics::Surface *surface);
private:
Common::String _filename;
diff --git a/engines/wintermute/Base/BKeyboardState.cpp b/engines/wintermute/Base/BKeyboardState.cpp
index 36a208b317..f67833eb5e 100644
--- a/engines/wintermute/Base/BKeyboardState.cpp
+++ b/engines/wintermute/Base/BKeyboardState.cpp
@@ -73,7 +73,7 @@ void CBKeyboardState::handleKeyRelease(Common::Event *event) {
//////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-HRESULT CBKeyboardState::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CBKeyboardState::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// IsKeyDown
//////////////////////////////////////////////////////////////////////////
@@ -95,7 +95,7 @@ HRESULT CBKeyboardState::scCallMethod(CScScript *script, CScStack *stack, CScSta
bool isDown = _keyStates[vKeyToKeyCode(vKey)];
stack->pushBool(isDown);
- return S_OK;
+ return STATUS_OK;
}
else return CBScriptable::scCallMethod(script, stack, thisStack, name);
@@ -173,7 +173,7 @@ CScValue *CBKeyboardState::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBKeyboardState::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CBKeyboardState::scSetProperty(const char *name, CScValue *value) {
/*
//////////////////////////////////////////////////////////////////////////
// Name
@@ -181,7 +181,7 @@ HRESULT CBKeyboardState::scSetProperty(const char *name, CScValue *value) {
if (strcmp(name, "Name") == 0) {
setName(value->getString());
if (_renderer) SetWindowText(_renderer->_window, _name);
- return S_OK;
+ return STATUS_OK;
}
else*/ return CBScriptable::scSetProperty(name, value);
@@ -195,7 +195,7 @@ const char *CBKeyboardState::scToString() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBKeyboardState::readKey(Common::Event *event) {
+ERRORCODE CBKeyboardState::readKey(Common::Event *event) {
//_currentPrintable = (event->type == SDL_TEXTINPUT); // TODO
_currentCharCode = keyCodeToVKey(event);
if ((_currentCharCode <= Common::KEYCODE_z && _currentCharCode >= Common::KEYCODE_a) ||
@@ -210,12 +210,12 @@ HRESULT CBKeyboardState::readKey(Common::Event *event) {
_currentAlt = isAltDown();
_currentShift = isShiftDown();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBKeyboardState::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CBKeyboardState::persist(CBPersistMgr *persistMgr) {
//if(!persistMgr->_saving) cleanup();
CBScriptable::persist(persistMgr);
@@ -233,7 +233,7 @@ HRESULT CBKeyboardState::persist(CBPersistMgr *persistMgr) {
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/wintermute/Base/BKeyboardState.h b/engines/wintermute/Base/BKeyboardState.h
index da324b86a3..29844e5d09 100644
--- a/engines/wintermute/Base/BKeyboardState.h
+++ b/engines/wintermute/Base/BKeyboardState.h
@@ -50,7 +50,7 @@ public:
DECLARE_PERSISTENT(CBKeyboardState, CBScriptable)
CBKeyboardState(CBGame *inGame);
virtual ~CBKeyboardState();
- HRESULT readKey(Common::Event *event);
+ ERRORCODE readKey(Common::Event *event);
void handleKeyPress(Common::Event *event);
void handleKeyRelease(Common::Event *event);
@@ -60,8 +60,8 @@ public:
// scripting interface
virtual CScValue *scGetProperty(const char *name);
- virtual HRESULT scSetProperty(const char *name, CScValue *value);
- virtual HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ERRORCODE scSetProperty(const char *name, CScValue *value);
+ virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
virtual const char *scToString();
private:
diff --git a/engines/wintermute/Base/BObject.cpp b/engines/wintermute/Base/BObject.cpp
index af688a4514..abced32767 100644
--- a/engines/wintermute/Base/BObject.cpp
+++ b/engines/wintermute/Base/BObject.cpp
@@ -107,7 +107,7 @@ CBObject::~CBObject() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBObject::cleanup() {
+ERRORCODE CBObject::cleanup() {
if (Game && Game->_activeObject == this)
Game->_activeObject = NULL;
@@ -132,7 +132,7 @@ HRESULT CBObject::cleanup() {
_sFXType = SFX_NONE;
_sFXParam1 = _sFXParam2 = _sFXParam3 = _sFXParam4 = 0;
- return S_OK;
+ return STATUS_OK;
}
@@ -161,15 +161,15 @@ const char *CBObject::getCaption(int caseVal) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBObject::listen(CBScriptHolder *param1, uint32 param2) {
- return E_FAIL;
+ERRORCODE CBObject::listen(CBScriptHolder *param1, uint32 param2) {
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// SkipTo
@@ -181,7 +181,7 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
afterMove();
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -191,7 +191,7 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
stack->correctParams(1);
stack->pushString(getCaption(stack->pop()->getInt()));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -199,10 +199,10 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetCursor") == 0) {
stack->correctParams(1);
- if (SUCCEEDED(setCursor(stack->pop()->getString()))) stack->pushBool(true);
+ if (DID_SUCCEED(setCursor(stack->pop()->getString()))) stack->pushBool(true);
else stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -219,7 +219,7 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
}
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -230,7 +230,7 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
if (!_cursor || !_cursor->_filename) stack->pushNULL();
else stack->pushString(_cursor->_filename);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -241,7 +241,7 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
if (!_cursor) stack->pushNULL();
else stack->pushNative(_cursor, true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -253,7 +253,7 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
if (_cursor) stack->pushBool(true);
else stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -264,7 +264,7 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
setCaption(stack->pop()->getString(), stack->pop()->getInt());
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -273,12 +273,12 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
else if (strcmp(name, "LoadSound") == 0) {
stack->correctParams(1);
const char *filename = stack->pop()->getString();
- if (SUCCEEDED(playSFX(filename, false, false)))
+ if (DID_SUCCEED(playSFX(filename, false, false)))
stack->pushBool(true);
else
stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -306,10 +306,10 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
loopStart = val3->getInt();
}
- if (FAILED(playSFX(filename, looping, true, NULL, loopStart)))
+ if (DID_FAIL(playSFX(filename, looping, true, NULL, loopStart)))
stack->pushBool(false);
else stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -332,9 +332,9 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
eventName = val2->getString();
}
- if (FAILED(playSFX(filename, false, true, eventName))) stack->pushBool(false);
+ if (DID_FAIL(playSFX(filename, false, true, eventName))) stack->pushBool(false);
else stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -343,9 +343,9 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
else if (strcmp(name, "StopSound") == 0) {
stack->correctParams(0);
- if (FAILED(stopSFX())) stack->pushBool(false);
+ if (DID_FAIL(stopSFX())) stack->pushBool(false);
else stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -354,9 +354,9 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
else if (strcmp(name, "PauseSound") == 0) {
stack->correctParams(0);
- if (FAILED(pauseSFX())) stack->pushBool(false);
+ if (DID_FAIL(pauseSFX())) stack->pushBool(false);
else stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -365,9 +365,9 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
else if (strcmp(name, "ResumeSound") == 0) {
stack->correctParams(0);
- if (FAILED(resumeSFX())) stack->pushBool(false);
+ if (DID_FAIL(resumeSFX())) stack->pushBool(false);
else stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -378,7 +378,7 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
if (_sFX && _sFX->isPlaying()) stack->pushBool(true);
else stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -388,9 +388,9 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
stack->correctParams(1);
uint32 Time = stack->pop()->getInt();
- if (FAILED(setSFXTime(Time))) stack->pushBool(false);
+ if (DID_FAIL(setSFXTime(Time))) stack->pushBool(false);
else stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -401,7 +401,7 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
if (!_sFX) stack->pushInt(0);
else stack->pushInt(_sFX->getPositionTime());
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -411,9 +411,9 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
stack->correctParams(1);
int volume = stack->pop()->getInt();
- if (FAILED(setSFXVolume(volume))) stack->pushBool(false);
+ if (DID_FAIL(setSFXVolume(volume))) stack->pushBool(false);
else stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -424,7 +424,7 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
if (!_sFX) stack->pushInt(_sFXVolume);
else stack->pushInt(_sFX->getVolume());
- return S_OK;
+ return STATUS_OK;
}
@@ -440,7 +440,7 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
_sFXParam4 = 0;
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -455,7 +455,7 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
_sFXParam4 = (float)stack->pop()->getFloat(333.0f); // Right Delay [ms] (1-2000)
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -470,7 +470,7 @@ HRESULT CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
_sFXParam4 = (float)stack->pop()->getFloat(0.001f); // HighFreq RT Ratio (0.001 - 0.999)
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
else return CBScriptHolder::scCallMethod(script, stack, thisStack, name);
@@ -671,13 +671,13 @@ CScValue *CBObject::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBObject::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CBObject::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
// Caption
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "Caption") == 0) {
setCaption(value->getString());
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -686,7 +686,7 @@ HRESULT CBObject::scSetProperty(const char *name, CScValue *value) {
else if (strcmp(name, "X") == 0) {
_posX = value->getInt();
afterMove();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -695,7 +695,7 @@ HRESULT CBObject::scSetProperty(const char *name, CScValue *value) {
else if (strcmp(name, "Y") == 0) {
_posY = value->getInt();
afterMove();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -703,7 +703,7 @@ HRESULT CBObject::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Movable") == 0) {
_movable = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -711,7 +711,7 @@ HRESULT CBObject::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Registrable") == 0 || strcmp(name, "Interactive") == 0) {
_registrable = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -719,7 +719,7 @@ HRESULT CBObject::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Zoomable") == 0 || strcmp(name, "Scalable") == 0) {
_zoomable = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -727,7 +727,7 @@ HRESULT CBObject::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Rotatable") == 0) {
_rotatable = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -735,7 +735,7 @@ HRESULT CBObject::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "AlphaColor") == 0) {
_alphaColor = (uint32)value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -745,7 +745,7 @@ HRESULT CBObject::scSetProperty(const char *name, CScValue *value) {
int i = value->getInt();
if (i < BLEND_NORMAL || i >= NUM_BLEND_MODES) i = BLEND_NORMAL;
_blendMode = (TSpriteBlendMode)i;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -754,7 +754,7 @@ HRESULT CBObject::scSetProperty(const char *name, CScValue *value) {
else if (strcmp(name, "Scale") == 0) {
if (value->isNULL()) _scale = -1;
else _scale = (float)value->getFloat();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -763,7 +763,7 @@ HRESULT CBObject::scSetProperty(const char *name, CScValue *value) {
else if (strcmp(name, "ScaleX") == 0) {
if (value->isNULL()) _scaleX = -1;
else _scaleX = (float)value->getFloat();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -772,7 +772,7 @@ HRESULT CBObject::scSetProperty(const char *name, CScValue *value) {
else if (strcmp(name, "ScaleY") == 0) {
if (value->isNULL()) _scaleY = -1;
else _scaleY = (float)value->getFloat();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -780,7 +780,7 @@ HRESULT CBObject::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "RelativeScale") == 0) {
_relativeScale = (float)value->getFloat();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -794,7 +794,7 @@ HRESULT CBObject::scSetProperty(const char *name, CScValue *value) {
_rotate = (float)value->getFloat();
_rotateValid = true;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -802,7 +802,7 @@ HRESULT CBObject::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "RelativeRotate") == 0) {
_relativeRotate = (float)value->getFloat();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -810,7 +810,7 @@ HRESULT CBObject::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Colorable") == 0) {
_shadowable = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -819,7 +819,7 @@ HRESULT CBObject::scSetProperty(const char *name, CScValue *value) {
else if (strcmp(name, "SoundPanning") == 0) {
_autoSoundPanning = value->getBool();
if (!_autoSoundPanning) resetSoundPan();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -827,7 +827,7 @@ HRESULT CBObject::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SaveState") == 0) {
_saveState = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -835,14 +835,14 @@ HRESULT CBObject::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "NonIntMouseEvents") == 0) {
_nonIntMouseEvents = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// AccCaption
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "AccCaption") == 0) {
- return S_OK;
+ return STATUS_OK;
}
else return CBScriptHolder::scSetProperty(name, value);
@@ -856,20 +856,20 @@ const char *CBObject::scToString() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBObject::showCursor() {
+ERRORCODE CBObject::showCursor() {
if (_cursor) return Game->drawCursor(_cursor);
- else return E_FAIL;
+ else return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBObject::saveAsText(CBDynBuffer *buffer, int indent) {
- return S_OK;
+ERRORCODE CBObject::saveAsText(CBDynBuffer *buffer, int indent) {
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBObject::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CBObject::persist(CBPersistMgr *persistMgr) {
CBScriptHolder::persist(persistMgr);
for (int i = 0; i < 7; i++)
@@ -920,12 +920,12 @@ HRESULT CBObject::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER_INT(_blendMode));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBObject::setCursor(const char *filename) {
+ERRORCODE CBObject::setCursor(const char *filename) {
if (!_sharedCursors) {
delete _cursor;
_cursor = NULL;
@@ -933,23 +933,23 @@ HRESULT CBObject::setCursor(const char *filename) {
_sharedCursors = false;
_cursor = new CBSprite(Game);
- if (!_cursor || FAILED(_cursor->loadFile(filename))) {
+ if (!_cursor || DID_FAIL(_cursor->loadFile(filename))) {
delete _cursor;
_cursor = NULL;
- return E_FAIL;
- } else return S_OK;
+ return STATUS_FAILED;
+ } else return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBObject::setActiveCursor(const char *filename) {
+ERRORCODE CBObject::setActiveCursor(const char *filename) {
delete _activeCursor;
_activeCursor = new CBSprite(Game);
- if (!_activeCursor || FAILED(_activeCursor->loadFile(filename))) {
+ if (!_activeCursor || DID_FAIL(_activeCursor->loadFile(filename))) {
delete _activeCursor;
_activeCursor = NULL;
- return E_FAIL;
- } else return S_OK;
+ return STATUS_FAILED;
+ } else return STATUS_OK;
}
@@ -960,8 +960,8 @@ int CBObject::getHeight() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBObject::handleMouse(TMouseEvent event, TMouseButton button) {
- return S_OK;
+ERRORCODE CBObject::handleMouse(TMouseEvent event, TMouseButton button) {
+ return STATUS_OK;
}
@@ -978,7 +978,7 @@ bool CBObject::handleMouseWheel(int delta) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBObject::playSFX(const char *filename, bool looping, bool playNow, const char *eventName, uint32 loopStart) {
+ERRORCODE CBObject::playSFX(const char *filename, bool looping, bool playNow, const char *eventName, uint32 loopStart) {
// just play loaded sound
if (filename == NULL && _sFX) {
if (Game->_editorMode || _sFXStart) {
@@ -990,16 +990,16 @@ HRESULT CBObject::playSFX(const char *filename, bool looping, bool playNow, cons
setSoundEvent(eventName);
if (loopStart) _sFX->setLoopStart(loopStart);
return _sFX->play(looping);
- } else return S_OK;
+ } else return STATUS_OK;
}
- if (filename == NULL) return E_FAIL;
+ if (filename == NULL) return STATUS_FAILED;
// create new sound
delete _sFX;
_sFX = new CBSound(Game);
- if (_sFX && SUCCEEDED(_sFX->setSound(filename, SOUND_SFX, true))) {
+ if (_sFX && DID_SUCCEED(_sFX->setSound(filename, SOUND_SFX, true))) {
_sFX->setVolume(_sFXVolume);
if (_sFXStart) {
_sFX->setPositionTime(_sFXStart);
@@ -1010,60 +1010,60 @@ HRESULT CBObject::playSFX(const char *filename, bool looping, bool playNow, cons
setSoundEvent(eventName);
if (loopStart) _sFX->setLoopStart(loopStart);
return _sFX->play(looping);
- } else return S_OK;
+ } else return STATUS_OK;
} else {
delete _sFX;
_sFX = NULL;
- return E_FAIL;
+ return STATUS_FAILED;
}
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBObject::stopSFX(bool deleteSound) {
+ERRORCODE CBObject::stopSFX(bool deleteSound) {
if (_sFX) {
_sFX->stop();
if (deleteSound) {
delete _sFX;
_sFX = NULL;
}
- return S_OK;
- } else return E_FAIL;
+ return STATUS_OK;
+ } else return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBObject::pauseSFX() {
+ERRORCODE CBObject::pauseSFX() {
if (_sFX) return _sFX->pause();
- else return E_FAIL;
+ else return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBObject::resumeSFX() {
+ERRORCODE CBObject::resumeSFX() {
if (_sFX) return _sFX->resume();
- else return E_FAIL;
+ else return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBObject::setSFXTime(uint32 time) {
+ERRORCODE CBObject::setSFXTime(uint32 time) {
_sFXStart = time;
if (_sFX && _sFX->isPlaying()) return _sFX->setPositionTime(time);
- else return S_OK;
+ else return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBObject::setSFXVolume(int volume) {
+ERRORCODE CBObject::setSFXVolume(int volume) {
_sFXVolume = volume;
if (_sFX) return _sFX->setVolume(volume);
- else return S_OK;
+ else return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBObject::updateSounds() {
+ERRORCODE CBObject::updateSounds() {
if (_soundEvent) {
if (_sFX && !_sFX->isPlaying()) {
applyEvent(_soundEvent);
@@ -1073,12 +1073,12 @@ HRESULT CBObject::updateSounds() {
if (_sFX) updateOneSound(_sFX);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBObject::updateOneSound(CBSound *sound) {
- HRESULT Ret = S_OK;
+ERRORCODE CBObject::updateOneSound(CBSound *sound) {
+ ERRORCODE Ret = STATUS_OK;
if (sound) {
if (_autoSoundPanning)
@@ -1090,8 +1090,8 @@ HRESULT CBObject::updateOneSound(CBSound *sound) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBObject::resetSoundPan() {
- if (!_sFX) return S_OK;
+ERRORCODE CBObject::resetSoundPan() {
+ if (!_sFX) return STATUS_OK;
else {
return _sFX->setPan(0.0f);
}
@@ -1121,8 +1121,8 @@ void CBObject::setSoundEvent(const char *eventName) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBObject::afterMove() {
- return S_OK;
+ERRORCODE CBObject::afterMove() {
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Base/BObject.h b/engines/wintermute/Base/BObject.h
index db2bd2f290..ff876a3035 100644
--- a/engines/wintermute/Base/BObject.h
+++ b/engines/wintermute/Base/BObject.h
@@ -46,7 +46,7 @@ class CScScript;
class CBObject : public CBScriptHolder {
public:
TSpriteBlendMode _blendMode;
- virtual HRESULT afterMove();
+ virtual ERRORCODE afterMove();
float _relativeRotate;
bool _rotateValid;
float _rotate;
@@ -59,18 +59,18 @@ public:
float _relativeScale;
virtual bool isReady();
virtual bool getExtendedFlag(const char *flagName);
- virtual HRESULT resetSoundPan();
- virtual HRESULT updateSounds();
- HRESULT updateOneSound(CBSound *sound);
+ virtual ERRORCODE resetSoundPan();
+ virtual ERRORCODE updateSounds();
+ ERRORCODE updateOneSound(CBSound *sound);
bool _autoSoundPanning;
uint32 _sFXStart;
int _sFXVolume;
- HRESULT setSFXTime(uint32 time);
- HRESULT setSFXVolume(int volume);
- HRESULT resumeSFX();
- HRESULT pauseSFX();
- HRESULT stopSFX(bool deleteSound = true);
- HRESULT playSFX(const char *filename, bool looping = false, bool playNow = true, const char *eventName = NULL, uint32 loopStart = 0);
+ ERRORCODE setSFXTime(uint32 time);
+ ERRORCODE setSFXVolume(int volume);
+ ERRORCODE resumeSFX();
+ ERRORCODE pauseSFX();
+ ERRORCODE stopSFX(bool deleteSound = true);
+ ERRORCODE playSFX(const char *filename, bool looping = false, bool playNow = true, const char *eventName = NULL, uint32 loopStart = 0);
CBSound *_sFX;
TSFXType _sFXType;
@@ -80,12 +80,12 @@ public:
float _sFXParam4;
virtual bool handleMouseWheel(int delta);
- virtual HRESULT handleMouse(TMouseEvent event, TMouseButton button);
+ virtual ERRORCODE handleMouse(TMouseEvent event, TMouseButton button);
virtual bool handleKeypress(Common::Event *event, bool printable = false);
virtual int getHeight();
- HRESULT setCursor(const char *filename);
- HRESULT setActiveCursor(const char *filename);
- HRESULT cleanup();
+ ERRORCODE setCursor(const char *filename);
+ ERRORCODE setActiveCursor(const char *filename);
+ ERRORCODE cleanup();
const char *getCaption(int caseVal = 1);
void setCaption(const char *caption, int caseVal = 1);
bool _editorSelected;
@@ -93,12 +93,12 @@ public:
bool _editorOnly;
bool _is3D;
DECLARE_PERSISTENT(CBObject, CBScriptHolder)
- virtual HRESULT showCursor();
+ virtual ERRORCODE showCursor();
CBSprite *_cursor;
bool _sharedCursors;
CBSprite *_activeCursor;
- virtual HRESULT saveAsText(CBDynBuffer *buffer, int indent);
- virtual HRESULT listen(CBScriptHolder *param1, uint32 param2);
+ virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent);
+ virtual ERRORCODE listen(CBScriptHolder *param1, uint32 param2);
bool _ready;
bool _registrable;
bool _zoomable;
@@ -116,17 +116,17 @@ public:
bool _saveState;
// base
- virtual HRESULT update() {
- return E_FAIL;
+ virtual ERRORCODE update() {
+ return STATUS_FAILED;
};
- virtual HRESULT display() {
- return E_FAIL;
+ virtual ERRORCODE display() {
+ return STATUS_FAILED;
};
- virtual HRESULT invalidateDeviceObjects() {
- return S_OK;
+ virtual ERRORCODE invalidateDeviceObjects() {
+ return STATUS_OK;
};
- virtual HRESULT restoreDeviceObjects() {
- return S_OK;
+ virtual ERRORCODE restoreDeviceObjects() {
+ return STATUS_OK;
};
bool _nonIntMouseEvents;
@@ -134,8 +134,8 @@ public:
public:
// scripting interface
virtual CScValue *scGetProperty(const char *name);
- virtual HRESULT scSetProperty(const char *name, CScValue *value);
- virtual HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ERRORCODE scSetProperty(const char *name, CScValue *value);
+ virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
virtual const char *scToString();
};
diff --git a/engines/wintermute/Base/BPackage.cpp b/engines/wintermute/Base/BPackage.cpp
index e75e537df5..1122ebc16d 100644
--- a/engines/wintermute/Base/BPackage.cpp
+++ b/engines/wintermute/Base/BPackage.cpp
@@ -57,31 +57,31 @@ CBPackage::~CBPackage() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBPackage::open() {
- if (_file) return S_OK;
+ERRORCODE CBPackage::open() {
+ if (_file) return STATUS_OK;
else {
_file = getFilePointer();
- return _file ? S_OK : E_FAIL;
+ return _file ? STATUS_OK : STATUS_FAILED;
}
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBPackage::close() {
+ERRORCODE CBPackage::close() {
delete _file;
_file = NULL;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBPackage::read(Common::SeekableReadStream *file, uint32 offset, byte *buffer, uint32 size) {
- HRESULT ret;
- if (FAILED(ret = open())) return ret;
+ERRORCODE CBPackage::read(Common::SeekableReadStream *file, uint32 offset, byte *buffer, uint32 size) {
+ ERRORCODE ret;
+ if (DID_FAIL(ret = open())) return ret;
else {
- if (file->seek(offset, SEEK_SET)) return E_FAIL;
- if (file->read(buffer, size) != 1) return E_FAIL;
- else return S_OK;
+ if (file->seek(offset, SEEK_SET)) return STATUS_FAILED;
+ if (file->read(buffer, size) != 1) return STATUS_FAILED;
+ else return STATUS_OK;
}
}
diff --git a/engines/wintermute/Base/BPackage.h b/engines/wintermute/Base/BPackage.h
index 6135e5324a..cb56717b71 100644
--- a/engines/wintermute/Base/BPackage.h
+++ b/engines/wintermute/Base/BPackage.h
@@ -45,9 +45,9 @@ public:
bool _boundToExe;
byte _priority;
- HRESULT read(Common::SeekableReadStream *file, uint32 offset, byte *buffer, uint32 size);
- HRESULT close();
- HRESULT open();
+ ERRORCODE read(Common::SeekableReadStream *file, uint32 offset, byte *buffer, uint32 size);
+ ERRORCODE close();
+ ERRORCODE open();
char *_name;
int _cD;
Common::SeekableReadStream *_file;
diff --git a/engines/wintermute/Base/BPersistMgr.cpp b/engines/wintermute/Base/BPersistMgr.cpp
index 6491e821ae..bbe532d819 100644
--- a/engines/wintermute/Base/BPersistMgr.cpp
+++ b/engines/wintermute/Base/BPersistMgr.cpp
@@ -119,7 +119,7 @@ Common::String CBPersistMgr::getFilenameForSlot(int slot) {
void CBPersistMgr::getSaveStateDesc(int slot, SaveStateDescriptor &desc) {
Common::String filename = getFilenameForSlot(slot);
warning("Trying to list savegame %s in slot %d", filename.c_str(), slot);
- if (FAILED(readHeader(filename))) {
+ if (DID_FAIL(readHeader(filename))) {
warning("getSavedDesc(%d) - Failed for %s", slot, filename.c_str());
return;
}
@@ -163,15 +163,15 @@ uint32 CBPersistMgr::getMaxUsedSlot() {
bool CBPersistMgr::getSaveExists(int slot) {
Common::String filename = getFilenameForSlot(slot);
warning("Trying to list savegame %s in slot %d", filename.c_str(), slot);
- if (FAILED(readHeader(filename))) {
+ if (DID_FAIL(readHeader(filename))) {
return false;
}
return true;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBPersistMgr::initSave(const char *desc) {
- if (!desc) return E_FAIL;
+ERRORCODE CBPersistMgr::initSave(const char *desc) {
+ if (!desc) return STATUS_FAILED;
cleanup();
_saving = true;
@@ -182,7 +182,7 @@ HRESULT CBPersistMgr::initSave(const char *desc) {
// get thumbnails
if (!Game->_cachedThumbnail) {
Game->_cachedThumbnail = new CBSaveThumbHelper(Game);
- if (FAILED(Game->_cachedThumbnail->storeThumbnail(true))) {
+ if (DID_FAIL(Game->_cachedThumbnail->storeThumbnail(true))) {
delete Game->_cachedThumbnail;
Game->_cachedThumbnail = NULL;
}
@@ -241,10 +241,10 @@ HRESULT CBPersistMgr::initSave(const char *desc) {
_savedPlayTime = g_system->getMillis();
_saveStream->writeUint32LE(_savedPlayTime);
}
- return S_OK;
+ return STATUS_OK;
}
-HRESULT CBPersistMgr::readHeader(const Common::String &filename) {
+ERRORCODE CBPersistMgr::readHeader(const Common::String &filename) {
cleanup();
_saving = false;
@@ -257,7 +257,7 @@ HRESULT CBPersistMgr::readHeader(const Common::String &filename) {
if (magic != DCGF_MAGIC) {
cleanup();
- return E_FAIL;
+ return STATUS_FAILED;
}
magic = getDWORD();
@@ -290,26 +290,26 @@ HRESULT CBPersistMgr::readHeader(const Common::String &filename) {
_offset = dataOffset;
- return S_OK;
+ return STATUS_OK;
}
}
cleanup();
- return E_FAIL;
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBPersistMgr::initLoad(const char *filename) {
- if (FAILED(readHeader(filename))) {
+ERRORCODE CBPersistMgr::initLoad(const char *filename) {
+ if (DID_FAIL(readHeader(filename))) {
cleanup();
- return E_FAIL;
+ return STATUS_FAILED;
}
_saving = false;
if (_savedName == "" || scumm_stricmp(_savedName.c_str(), Game->_name) != 0) {
Game->LOG(0, "ERROR: Saved game name doesn't match current game");
cleanup();
- return E_FAIL;
+ return STATUS_FAILED;
}
// if save is newer version than we are, fail
@@ -320,7 +320,7 @@ HRESULT CBPersistMgr::initLoad(const char *filename) {
Game->LOG(0, "ERROR: Saved game version is newer than current game");
Game->LOG(0, "ERROR: Expected %d.%d.%d got %d.%d.%d", DCGF_VER_MAJOR, DCGF_VER_MINOR, DCGF_VER_BUILD, _savedVerMajor, _savedVerMinor, _savedVerBuild);
cleanup();
- return E_FAIL;
+ return STATUS_FAILED;
}
// if save is older than the minimal version we support
@@ -331,7 +331,7 @@ HRESULT CBPersistMgr::initLoad(const char *filename) {
Game->LOG(0, "ERROR: Saved game is too old and cannot be used by this version of game engine");
Game->LOG(0, "ERROR: Expected %d.%d.%d got %d.%d.%d", DCGF_VER_MAJOR, DCGF_VER_MINOR, DCGF_VER_BUILD, _savedVerMajor, _savedVerMinor, _savedVerBuild);
cleanup();
- return E_FAIL;
+ return STATUS_FAILED;
}
@@ -343,30 +343,30 @@ HRESULT CBPersistMgr::initLoad(const char *filename) {
}
*/
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBPersistMgr::saveFile(const char *filename) {
+ERRORCODE CBPersistMgr::saveFile(const char *filename) {
return Game->_fileManager->saveFile(filename, ((Common::MemoryWriteStreamDynamic *)_saveStream)->getData(), ((Common::MemoryWriteStreamDynamic *)_saveStream)->size(), Game->_compressedSavegames, _richBuffer, _richBufferSize);
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBPersistMgr::putBytes(byte *buffer, uint32 size) {
+ERRORCODE CBPersistMgr::putBytes(byte *buffer, uint32 size) {
_saveStream->write(buffer, size);
if (_saveStream->err())
- return E_FAIL;
- return S_OK;
+ return STATUS_FAILED;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBPersistMgr::getBytes(byte *buffer, uint32 size) {
+ERRORCODE CBPersistMgr::getBytes(byte *buffer, uint32 size) {
_loadStream->read(buffer, size);
if (_loadStream->err())
- return E_FAIL;
- return S_OK;
+ return STATUS_FAILED;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -420,7 +420,7 @@ char *CBPersistMgr::getString() {
} else return ret;
}
-HRESULT CBPersistMgr::putTimeDate(const TimeDate &t) {
+ERRORCODE CBPersistMgr::putTimeDate(const TimeDate &t) {
_saveStream->writeSint32LE(t.tm_sec);
_saveStream->writeSint32LE(t.tm_min);
_saveStream->writeSint32LE(t.tm_hour);
@@ -430,9 +430,9 @@ HRESULT CBPersistMgr::putTimeDate(const TimeDate &t) {
// _saveStream->writeSint32LE(t.tm_wday); //TODO: Add this in when merging next
if (_saveStream->err()) {
- return E_FAIL;
+ return STATUS_FAILED;
}
- return S_OK;
+ return STATUS_OK;
}
TimeDate CBPersistMgr::getTimeDate() {
@@ -484,134 +484,134 @@ double CBPersistMgr::getDouble() {
//////////////////////////////////////////////////////////////////////////
// bool
-HRESULT CBPersistMgr::transfer(const char *name, bool *val) {
+ERRORCODE CBPersistMgr::transfer(const char *name, bool *val) {
if (_saving) {
_saveStream->writeByte(*val);
if (_saveStream->err())
- return E_FAIL;
- return S_OK;
+ return STATUS_FAILED;
+ return STATUS_OK;
} else {
*val = _loadStream->readByte();
if (_loadStream->err())
- return E_FAIL;
- return S_OK;
+ return STATUS_FAILED;
+ return STATUS_OK;
}
}
//////////////////////////////////////////////////////////////////////////
// int
-HRESULT CBPersistMgr::transfer(const char *name, int *val) {
+ERRORCODE CBPersistMgr::transfer(const char *name, int *val) {
if (_saving) {
_saveStream->writeSint32LE(*val);
if (_saveStream->err())
- return E_FAIL;
- return S_OK;
+ return STATUS_FAILED;
+ return STATUS_OK;
} else {
*val = _loadStream->readSint32LE();
if (_loadStream->err())
- return E_FAIL;
- return S_OK;
+ return STATUS_FAILED;
+ return STATUS_OK;
}
}
//////////////////////////////////////////////////////////////////////////
// DWORD
-HRESULT CBPersistMgr::transfer(const char *name, uint32 *val) {
+ERRORCODE CBPersistMgr::transfer(const char *name, uint32 *val) {
if (_saving) {
_saveStream->writeUint32LE(*val);
if (_saveStream->err())
- return E_FAIL;
- return S_OK;
+ return STATUS_FAILED;
+ return STATUS_OK;
} else {
*val = _loadStream->readUint32LE();
if (_loadStream->err())
- return E_FAIL;
- return S_OK;
+ return STATUS_FAILED;
+ return STATUS_OK;
}
}
//////////////////////////////////////////////////////////////////////////
// float
-HRESULT CBPersistMgr::transfer(const char *name, float *val) {
+ERRORCODE CBPersistMgr::transfer(const char *name, float *val) {
if (_saving) {
putFloat(*val);
if (_saveStream->err())
- return E_FAIL;
- return S_OK;
+ return STATUS_FAILED;
+ return STATUS_OK;
} else {
*val = getFloat();
if (_loadStream->err())
- return E_FAIL;
- return S_OK;
+ return STATUS_FAILED;
+ return STATUS_OK;
}
}
//////////////////////////////////////////////////////////////////////////
// double
-HRESULT CBPersistMgr::transfer(const char *name, double *val) {
+ERRORCODE CBPersistMgr::transfer(const char *name, double *val) {
if (_saving) {
putDouble(*val);
if (_saveStream->err())
- return E_FAIL;
- return S_OK;
+ return STATUS_FAILED;
+ return STATUS_OK;
} else {
*val = getDouble();
if (_loadStream->err())
- return E_FAIL;
- return S_OK;
+ return STATUS_FAILED;
+ return STATUS_OK;
}
}
//////////////////////////////////////////////////////////////////////////
// char*
-HRESULT CBPersistMgr::transfer(const char *name, char **val) {
+ERRORCODE CBPersistMgr::transfer(const char *name, char **val) {
if (_saving) {
putString(*val);
- return S_OK;
+ return STATUS_OK;
} else {
char *str = getString();
if (_loadStream->err()) {
delete[] str;
- return E_FAIL;
+ return STATUS_FAILED;
}
*val = str;
- return S_OK;
+ return STATUS_OK;
}
}
//////////////////////////////////////////////////////////////////////////
// const char*
-HRESULT CBPersistMgr::transfer(const char *name, const char **val) {
+ERRORCODE CBPersistMgr::transfer(const char *name, const char **val) {
if (_saving) {
putString(*val);
- return S_OK;
+ return STATUS_OK;
} else {
char *str = getString();
if (_loadStream->err()) {
delete[] str;
- return E_FAIL;
+ return STATUS_FAILED;
}
*val = str;
- return S_OK;
+ return STATUS_OK;
}
}
//////////////////////////////////////////////////////////////////////////
// Common::String
-HRESULT CBPersistMgr::transfer(const char *name, Common::String *val) {
+ERRORCODE CBPersistMgr::transfer(const char *name, Common::String *val) {
if (_saving) {
putString(*val);
- return S_OK;
+ return STATUS_OK;
} else {
char *str = getString();
if (_loadStream->err()) {
delete[] str;
- return E_FAIL;
+ return STATUS_FAILED;
}
if (str) {
*val = str;
@@ -619,12 +619,12 @@ HRESULT CBPersistMgr::transfer(const char *name, Common::String *val) {
} else {
*val = "";
}
- return S_OK;
+ return STATUS_OK;
}
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBPersistMgr::transfer(const char *name, AnsiStringArray &val) {
+ERRORCODE CBPersistMgr::transfer(const char *name, AnsiStringArray &val) {
size_t size;
if (_saving) {
@@ -642,97 +642,97 @@ HRESULT CBPersistMgr::transfer(const char *name, AnsiStringArray &val) {
char *str = getString();
if (_loadStream->err()) {
delete[] str;
- return E_FAIL;
+ return STATUS_FAILED;
}
if (str) val.push_back(str);
delete[] str;
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// BYTE
-HRESULT CBPersistMgr::transfer(const char *name, byte *val) {
+ERRORCODE CBPersistMgr::transfer(const char *name, byte *val) {
if (_saving) {
_saveStream->writeByte(*val);
if (_saveStream->err())
- return E_FAIL;
- return S_OK;
+ return STATUS_FAILED;
+ return STATUS_OK;
} else {
*val = _loadStream->readByte();
if (_loadStream->err())
- return E_FAIL;
- return S_OK;
+ return STATUS_FAILED;
+ return STATUS_OK;
}
}
//////////////////////////////////////////////////////////////////////////
// RECT
-HRESULT CBPersistMgr::transfer(const char *name, RECT *val) {
+ERRORCODE CBPersistMgr::transfer(const char *name, RECT *val) {
if (_saving) {
_saveStream->writeSint32LE(val->left);
_saveStream->writeSint32LE(val->top);
_saveStream->writeSint32LE(val->right);
_saveStream->writeSint32LE(val->bottom);
if (_saveStream->err())
- return E_FAIL;
- return S_OK;
+ return STATUS_FAILED;
+ return STATUS_OK;
} else {
val->left = _loadStream->readSint32LE();
val->top = _loadStream->readSint32LE();
val->right = _loadStream->readSint32LE();
val->bottom = _loadStream->readSint32LE();
if (_loadStream->err())
- return E_FAIL;
- return S_OK;
+ return STATUS_FAILED;
+ return STATUS_OK;
}
}
//////////////////////////////////////////////////////////////////////////
// POINT
-HRESULT CBPersistMgr::transfer(const char *name, POINT *val) {
+ERRORCODE CBPersistMgr::transfer(const char *name, POINT *val) {
if (_saving) {
_saveStream->writeSint32LE(val->x);
_saveStream->writeSint32LE(val->y);
if (_saveStream->err())
- return E_FAIL;
- return S_OK;
+ return STATUS_FAILED;
+ return STATUS_OK;
} else {
val->x = _loadStream->readSint32LE();
val->y = _loadStream->readSint32LE();
if (_loadStream->err())
- return E_FAIL;
- return S_OK;
+ return STATUS_FAILED;
+ return STATUS_OK;
}
}
//////////////////////////////////////////////////////////////////////////
// Vector2
-HRESULT CBPersistMgr::transfer(const char *name, Vector2 *val) {
+ERRORCODE CBPersistMgr::transfer(const char *name, Vector2 *val) {
if (_saving) {
putFloat(val->x);
putFloat(val->y);
if (_saveStream->err())
- return E_FAIL;
- return S_OK;
+ return STATUS_FAILED;
+ return STATUS_OK;
} else {
val->x = getFloat();
val->y = getFloat();
if (_loadStream->err())
- return E_FAIL;
- return S_OK;
+ return STATUS_FAILED;
+ return STATUS_OK;
}
}
//////////////////////////////////////////////////////////////////////////
// generic pointer
-HRESULT CBPersistMgr::transfer(const char *name, void *val) {
+ERRORCODE CBPersistMgr::transfer(const char *name, void *val) {
int classID = -1, instanceID = -1;
if (_saving) {
@@ -750,7 +750,7 @@ HRESULT CBPersistMgr::transfer(const char *name, void *val) {
*(void **)val = CSysClassRegistry::getInstance()->idToPointer(classID, instanceID);
}
- return S_OK;
+ return STATUS_OK;
}
diff --git a/engines/wintermute/Base/BPersistMgr.h b/engines/wintermute/Base/BPersistMgr.h
index f2f428fb25..9559dc7490 100644
--- a/engines/wintermute/Base/BPersistMgr.h
+++ b/engines/wintermute/Base/BPersistMgr.h
@@ -51,7 +51,7 @@ public:
byte _savedExtMajor;
byte _savedExtMinor;
Common::String _savedName;
- HRESULT saveFile(const char *filename);
+ ERRORCODE saveFile(const char *filename);
uint32 getDWORD();
void putDWORD(uint32 val);
char *getString();
@@ -66,10 +66,10 @@ public:
void deleteSaveSlot(int slot);
uint32 getMaxUsedSlot();
bool getSaveExists(int slot);
- HRESULT initLoad(const char *filename);
- HRESULT initSave(const char *desc);
- HRESULT getBytes(byte *buffer, uint32 size);
- HRESULT putBytes(byte *buffer, uint32 size);
+ ERRORCODE initLoad(const char *filename);
+ ERRORCODE initSave(const char *desc);
+ ERRORCODE getBytes(byte *buffer, uint32 size);
+ ERRORCODE putBytes(byte *buffer, uint32 size);
uint32 _offset;
bool _saving;
@@ -77,20 +77,20 @@ public:
uint32 _richBufferSize;
byte *_richBuffer;
- HRESULT transfer(const char *name, void *val);
- HRESULT transfer(const char *name, int *val);
- HRESULT transfer(const char *name, uint32 *val);
- HRESULT transfer(const char *name, float *val);
- HRESULT transfer(const char *name, double *val);
- HRESULT transfer(const char *name, bool *val);
- HRESULT transfer(const char *name, byte *val);
- HRESULT transfer(const char *name, RECT *val);
- HRESULT transfer(const char *name, POINT *val);
- HRESULT transfer(const char *name, const char **val);
- HRESULT transfer(const char *name, char **val);
- HRESULT transfer(const char *name, Common::String *val);
- HRESULT transfer(const char *name, Vector2 *val);
- HRESULT transfer(const char *name, AnsiStringArray &Val);
+ ERRORCODE transfer(const char *name, void *val);
+ ERRORCODE transfer(const char *name, int *val);
+ ERRORCODE transfer(const char *name, uint32 *val);
+ ERRORCODE transfer(const char *name, float *val);
+ ERRORCODE transfer(const char *name, double *val);
+ ERRORCODE transfer(const char *name, bool *val);
+ ERRORCODE transfer(const char *name, byte *val);
+ ERRORCODE transfer(const char *name, RECT *val);
+ ERRORCODE transfer(const char *name, POINT *val);
+ ERRORCODE transfer(const char *name, const char **val);
+ ERRORCODE transfer(const char *name, char **val);
+ ERRORCODE transfer(const char *name, Common::String *val);
+ ERRORCODE transfer(const char *name, Vector2 *val);
+ ERRORCODE transfer(const char *name, AnsiStringArray &Val);
CBPersistMgr(CBGame *inGame = NULL);
virtual ~CBPersistMgr();
bool checkVersion(byte verMajor, byte verMinor, byte verBuild);
@@ -99,9 +99,9 @@ public:
byte *_thumbnailData;
private:
Common::String getFilenameForSlot(int slot);
- HRESULT readHeader(const Common::String &filename);
+ ERRORCODE readHeader(const Common::String &filename);
TimeDate getTimeDate();
- HRESULT putTimeDate(const TimeDate &t);
+ ERRORCODE putTimeDate(const TimeDate &t);
Common::WriteStream *_saveStream;
Common::SeekableReadStream *_loadStream;
};
diff --git a/engines/wintermute/Base/BPoint.cpp b/engines/wintermute/Base/BPoint.cpp
index 92cfccd87a..b6b8c4e572 100644
--- a/engines/wintermute/Base/BPoint.cpp
+++ b/engines/wintermute/Base/BPoint.cpp
@@ -53,12 +53,12 @@ CBPoint::CBPoint(int initX, int initY) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBPoint::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CBPoint::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(x));
persistMgr->transfer(TMEMBER(y));
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Base/BRegion.cpp b/engines/wintermute/Base/BRegion.cpp
index 1b89988ba8..32eb383de0 100644
--- a/engines/wintermute/Base/BRegion.cpp
+++ b/engines/wintermute/Base/BRegion.cpp
@@ -71,7 +71,7 @@ void CBRegion::cleanup() {
//////////////////////////////////////////////////////////////////////////
bool CBRegion::createRegion() {
- return SUCCEEDED(getBoundingRect(&_rect));
+ return DID_SUCCEED(getBoundingRect(&_rect));
}
@@ -95,19 +95,19 @@ bool CBRegion::pointInRegion(int x, int y) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBRegion::loadFile(const char *filename) {
+ERRORCODE CBRegion::loadFile(const char *filename) {
byte *buffer = Game->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
Game->LOG(0, "CBRegion::LoadFile failed for file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
- HRESULT ret;
+ ERRORCODE ret;
_filename = new char [strlen(filename) + 1];
strcpy(_filename, filename);
- if (FAILED(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing REGION file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing REGION file '%s'", filename);
delete [] buffer;
@@ -128,7 +128,7 @@ TOKEN_DEF(EDITOR_SELECTED_POINT)
TOKEN_DEF(PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-HRESULT CBRegion::loadBuffer(byte *buffer, bool complete) {
+ERRORCODE CBRegion::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(REGION)
TOKEN_TABLE(TEMPLATE)
@@ -148,7 +148,7 @@ HRESULT CBRegion::loadBuffer(byte *buffer, bool complete) {
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_REGION) {
Game->LOG(0, "'REGION' keyword expected.");
- return E_FAIL;
+ return STATUS_FAILED;
}
buffer = params;
}
@@ -161,7 +161,7 @@ HRESULT CBRegion::loadBuffer(byte *buffer, bool complete) {
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
- if (FAILED(loadFile((char *)params))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(loadFile((char *)params))) cmd = PARSERR_GENERIC;
break;
case TOKEN_NAME:
@@ -198,19 +198,19 @@ HRESULT CBRegion::loadBuffer(byte *buffer, bool complete) {
}
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in REGION definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
createRegion();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-HRESULT CBRegion::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CBRegion::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// AddPoint
@@ -225,7 +225,7 @@ HRESULT CBRegion::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -244,7 +244,7 @@ HRESULT CBRegion::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
stack->pushBool(true);
} else stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -264,7 +264,7 @@ HRESULT CBRegion::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
stack->pushBool(true);
} else stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -284,7 +284,7 @@ HRESULT CBRegion::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
stack->pushBool(true);
} else stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -302,7 +302,7 @@ HRESULT CBRegion::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
}
} else stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
else return CBObject::scCallMethod(script, stack, thisStack, name);
@@ -350,13 +350,13 @@ CScValue *CBRegion::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBRegion::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CBRegion::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
// Name
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "Name") == 0) {
setName(value->getString());
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -364,7 +364,7 @@ HRESULT CBRegion::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Active") == 0) {
_active = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
else return CBObject::scSetProperty(name, value);
@@ -378,7 +378,7 @@ const char *CBRegion::scToString() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBRegion::saveAsText(CBDynBuffer *buffer, int indent, const char *nameOverride) {
+ERRORCODE CBRegion::saveAsText(CBDynBuffer *buffer, int indent, const char *nameOverride) {
if (!nameOverride) buffer->putTextIndent(indent, "REGION {\n");
else buffer->putTextIndent(indent, "%s {\n", nameOverride);
@@ -401,12 +401,12 @@ HRESULT CBRegion::saveAsText(CBDynBuffer *buffer, int indent, const char *nameOv
buffer->putTextIndent(indent, "}\n\n");
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBRegion::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CBRegion::persist(CBPersistMgr *persistMgr) {
CBObject::persist(persistMgr);
@@ -417,7 +417,7 @@ HRESULT CBRegion::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(_lastMimicY));
_points.persist(persistMgr);
- return S_OK;
+ return STATUS_OK;
}
@@ -465,7 +465,7 @@ bool CBRegion::ptInPolygon(int x, int y) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBRegion::getBoundingRect(RECT *rect) {
+ERRORCODE CBRegion::getBoundingRect(RECT *rect) {
if (_points.GetSize() == 0) CBPlatform::setRectEmpty(rect);
else {
int MinX = INT_MAX, MinY = INT_MAX, MaxX = INT_MIN, MaxY = INT_MIN;
@@ -479,13 +479,13 @@ HRESULT CBRegion::getBoundingRect(RECT *rect) {
}
CBPlatform::setRect(rect, MinX, MinY, MaxX, MaxY);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBRegion::mimic(CBRegion *region, float scale, int x, int y) {
- if (scale == _lastMimicScale && x == _lastMimicX && y == _lastMimicY) return S_OK;
+ERRORCODE CBRegion::mimic(CBRegion *region, float scale, int x, int y) {
+ if (scale == _lastMimicScale && x == _lastMimicX && y == _lastMimicY) return STATUS_OK;
cleanup();
@@ -502,7 +502,7 @@ HRESULT CBRegion::mimic(CBRegion *region, float scale, int x, int y) {
_lastMimicX = x;
_lastMimicY = y;
- return createRegion() ? S_OK : E_FAIL;
+ return createRegion() ? STATUS_OK : STATUS_FAILED;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Base/BRegion.h b/engines/wintermute/Base/BRegion.h
index 0b005eb1de..5f6b79e17f 100644
--- a/engines/wintermute/Base/BRegion.h
+++ b/engines/wintermute/Base/BRegion.h
@@ -40,8 +40,8 @@ public:
int _lastMimicX;
int _lastMimicY;
void cleanup();
- HRESULT mimic(CBRegion *region, float scale = 100.0f, int x = 0, int y = 0);
- HRESULT getBoundingRect(RECT *rect);
+ ERRORCODE mimic(CBRegion *region, float scale = 100.0f, int x = 0, int y = 0);
+ ERRORCODE getBoundingRect(RECT *rect);
bool ptInPolygon(int x, int y);
DECLARE_PERSISTENT(CBRegion, CBObject)
bool _active;
@@ -50,16 +50,16 @@ public:
virtual ~CBRegion();
bool pointInRegion(int x, int y);
bool createRegion();
- HRESULT loadFile(const char *filename);
- HRESULT loadBuffer(byte *buffer, bool complete = true);
+ ERRORCODE loadFile(const char *filename);
+ ERRORCODE loadBuffer(byte *buffer, bool complete = true);
RECT _rect;
CBArray<CBPoint *, CBPoint *> _points;
- virtual HRESULT saveAsText(CBDynBuffer *buffer, int indent, const char *nameOverride = NULL);
+ virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent, const char *nameOverride = NULL);
// scripting interface
virtual CScValue *scGetProperty(const char *name);
- virtual HRESULT scSetProperty(const char *name, CScValue *value);
- virtual HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ERRORCODE scSetProperty(const char *name, CScValue *value);
+ virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
virtual const char *scToString();
};
diff --git a/engines/wintermute/Base/BRenderSDL.cpp b/engines/wintermute/Base/BRenderSDL.cpp
index b6de4e2bf5..e2ddc38d98 100644
--- a/engines/wintermute/Base/BRenderSDL.cpp
+++ b/engines/wintermute/Base/BRenderSDL.cpp
@@ -111,8 +111,8 @@ CBRenderSDL::~CBRenderSDL() {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBRenderSDL::initRenderer(int width, int height, bool windowed) {
- //if (SDL_Init(SDL_INIT_VIDEO) < 0) return E_FAIL;
+ERRORCODE CBRenderSDL::initRenderer(int width, int height, bool windowed) {
+ //if (SDL_Init(SDL_INIT_VIDEO) < 0) return STATUS_FAILED;
#if 0
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0);
@@ -194,7 +194,7 @@ HRESULT CBRenderSDL::initRenderer(int width, int height, bool windowed) {
if (gfxError != OSystem::kTransactionSuccess) {
warning("Couldn't setup GFX-backend for %dx%dx%d", _width, _height, format.bytesPerPixel * 8);
- return E_FAIL;
+ return STATUS_FAILED;
}
#if 0
_win = SDL_CreateWindow("WME Lite",
@@ -203,7 +203,7 @@ HRESULT CBRenderSDL::initRenderer(int width, int height, bool windowed) {
_realWidth, _realHeight,
flags);
- if (!_win) return E_FAIL;
+ if (!_win) return STATUS_FAILED;
#endif
g_system->showMouse(false);
@@ -217,30 +217,30 @@ HRESULT CBRenderSDL::initRenderer(int width, int height, bool windowed) {
#if 0
_renderer = SDL_CreateRenderer(_win, -1, 0);
- if (!_renderer) return E_FAIL;
+ if (!_renderer) return STATUS_FAILED;
#endif
_renderSurface->create(g_system->getWidth(), g_system->getHeight(), g_system->getScreenFormat());
_active = true;
_clearColor = _renderSurface->format.ARGBToColor(255, 0, 0, 0);
- return S_OK;
+ return STATUS_OK;
}
void CBRenderSDL::setAlphaMod(byte alpha) {
- byte r = D3DCOLGetR(_colorMod);
- byte g = D3DCOLGetB(_colorMod);
- byte b = D3DCOLGetB(_colorMod);
+ byte r = RGBCOLGetR(_colorMod);
+ byte g = RGBCOLGetB(_colorMod);
+ byte b = RGBCOLGetB(_colorMod);
_colorMod = BS_ARGB(alpha, r, g, b);
}
void CBRenderSDL::setColorMod(byte r, byte g, byte b) {
- byte alpha = D3DCOLGetA(_colorMod);
+ byte alpha = RGBCOLGetA(_colorMod);
_colorMod = BS_ARGB(alpha, r, g, b);
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBRenderSDL::flip() {
+ERRORCODE CBRenderSDL::flip() {
if (!_disableDirtyRects) {
drawTickets();
}
@@ -254,33 +254,33 @@ HRESULT CBRenderSDL::flip() {
}
_drawNum = 1;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBRenderSDL::fill(byte r, byte g, byte b, Common::Rect *rect) {
+ERRORCODE CBRenderSDL::fill(byte r, byte g, byte b, Common::Rect *rect) {
//SDL_SetRenderDrawColor(_renderer, r, g, b, 0xFF);
//SDL_RenderClear(_renderer);
_clearColor = _renderSurface->format.ARGBToColor(0xFF, r, g, b);
if (!_disableDirtyRects)
- return S_OK;
+ return STATUS_OK;
if (!rect) {
rect = &_renderRect;
}
_renderSurface->fillRect(*rect, _clearColor);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBRenderSDL::fade(uint16 Alpha) {
+ERRORCODE CBRenderSDL::fade(uint16 Alpha) {
uint32 dwAlpha = 255 - Alpha;
return fadeToColor(dwAlpha << 24);
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBRenderSDL::fadeToColor(uint32 Color, Common::Rect *rect) {
+ERRORCODE CBRenderSDL::fadeToColor(uint32 Color, Common::Rect *rect) {
// This particular warning is rather messy, as this function is called a ton,
// thus we avoid printing it more than once.
static bool hasWarned = false;
@@ -307,10 +307,10 @@ HRESULT CBRenderSDL::fadeToColor(uint32 Color, Common::Rect *rect) {
}
modTargetRect(&fillRect);
- byte r = D3DCOLGetR(Color);
- byte g = D3DCOLGetG(Color);
- byte b = D3DCOLGetB(Color);
- byte a = D3DCOLGetA(Color);
+ byte r = RGBCOLGetR(Color);
+ byte g = RGBCOLGetG(Color);
+ byte b = RGBCOLGetB(Color);
+ byte a = RGBCOLGetA(Color);
//TODO: This is only here until I'm sure about the final pixelformat
uint32 col = _renderSurface->format.ARGBToColor(a, r, g, b);
@@ -320,7 +320,7 @@ HRESULT CBRenderSDL::fadeToColor(uint32 Color, Common::Rect *rect) {
//SDL_SetRenderDrawBlendMode(_renderer, SDL_BLENDMODE_BLEND);
//SDL_RenderFillRect(_renderer, &fillRect);
- return S_OK;
+ return STATUS_OK;
}
void CBRenderSDL::drawSurface(CBSurfaceSDL *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, bool mirrorX, bool mirrorY) {
@@ -487,16 +487,16 @@ void CBRenderSDL::drawFromSurface(const Graphics::Surface *surf, Common::Rect *s
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBRenderSDL::drawLine(int x1, int y1, int x2, int y2, uint32 color) {
+ERRORCODE CBRenderSDL::drawLine(int x1, int y1, int x2, int y2, uint32 color) {
static bool hasWarned = false;
if (!hasWarned) {
warning("CBRenderSDL::DrawLine - not fully ported yet");
hasWarned = true;
}
- byte r = D3DCOLGetR(color);
- byte g = D3DCOLGetG(color);
- byte b = D3DCOLGetB(color);
- byte a = D3DCOLGetA(color);
+ byte r = RGBCOLGetR(color);
+ byte g = RGBCOLGetG(color);
+ byte b = RGBCOLGetB(color);
+ byte a = RGBCOLGetA(color);
//SDL_SetRenderDrawColor(_renderer, r, g, b, a);
//SDL_SetRenderDrawBlendMode(_renderer, SDL_BLENDMODE_BLEND);
@@ -514,7 +514,7 @@ HRESULT CBRenderSDL::drawLine(int x1, int y1, int x2, int y2, uint32 color) {
uint32 colorVal = _renderSurface->format.ARGBToColor(a, r, g, b);
_renderSurface->drawLine(point1.x, point1.y, point2.x, point2.y, colorVal);
//SDL_RenderDrawLine(_renderer, point1.x, point1.y, point2.x, point2.y);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -550,7 +550,7 @@ CBImage *CBRenderSDL::takeScreenshot() {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBRenderSDL::switchFullscreen() {
+ERRORCODE CBRenderSDL::switchFullscreen() {
/*if (_windowed) SDL_SetWindowFullscreen(_win, SDL_TRUE);
else SDL_SetWindowFullscreen(_win, SDL_FALSE);
@@ -558,7 +558,7 @@ HRESULT CBRenderSDL::switchFullscreen() {
*/
Game->_registry->writeBool("Video", "Windowed", _windowed);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -576,7 +576,7 @@ const char *CBRenderSDL::getName() {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBRenderSDL::setViewport(int left, int top, int right, int bottom) {
+ERRORCODE CBRenderSDL::setViewport(int left, int top, int right, int bottom) {
Common::Rect rect;
// TODO: Hopefully this is the same logic that ScummVM uses.
rect.left = (int16)(left + _borderLeft);
@@ -588,7 +588,7 @@ HRESULT CBRenderSDL::setViewport(int left, int top, int right, int bottom) {
#ifndef __IPHONEOS__
//SDL_RenderSetViewport(GetSdlRenderer(), &rect);
#endif
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/wintermute/Base/BRenderSDL.h b/engines/wintermute/Base/BRenderSDL.h
index 67999fe867..f7659e3e84 100644
--- a/engines/wintermute/Base/BRenderSDL.h
+++ b/engines/wintermute/Base/BRenderSDL.h
@@ -64,16 +64,16 @@ public:
const char *getName();
- HRESULT initRenderer(int width, int height, bool windowed);
- HRESULT flip();
- HRESULT fill(byte r, byte g, byte b, Common::Rect *rect = NULL);
+ ERRORCODE initRenderer(int width, int height, bool windowed);
+ ERRORCODE flip();
+ ERRORCODE fill(byte r, byte g, byte b, Common::Rect *rect = NULL);
- HRESULT fade(uint16 alpha);
- HRESULT fadeToColor(uint32 color, Common::Rect *rect = NULL);
+ ERRORCODE fade(uint16 alpha);
+ ERRORCODE fadeToColor(uint32 color, Common::Rect *rect = NULL);
- HRESULT switchFullscreen();
+ ERRORCODE switchFullscreen();
- HRESULT drawLine(int x1, int y1, int x2, int y2, uint32 color);
+ ERRORCODE drawLine(int x1, int y1, int x2, int y2, uint32 color);
CBImage *takeScreenshot();
@@ -83,7 +83,7 @@ public:
void invalidateTicketsFromSurface(CBSurfaceSDL *surf);
void drawFromTicket(RenderTicket *renderTicket);
- HRESULT setViewport(int left, int top, int right, int bottom);
+ ERRORCODE setViewport(int left, int top, int right, int bottom);
void modTargetRect(Common::Rect *rect);
void pointFromScreen(POINT *point);
diff --git a/engines/wintermute/Base/BRenderer.cpp b/engines/wintermute/Base/BRenderer.cpp
index 26e7f3de5a..9038d8364e 100644
--- a/engines/wintermute/Base/BRenderer.cpp
+++ b/engines/wintermute/Base/BRenderer.cpp
@@ -115,19 +115,19 @@ void CBRenderer::deleteRectList() {
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
-HRESULT CBRenderer::switchFullscreen() {
- return E_FAIL;
+ERRORCODE CBRenderer::switchFullscreen() {
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////
-HRESULT CBRenderer::flip() {
- return E_FAIL;
+ERRORCODE CBRenderer::flip() {
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////
-HRESULT CBRenderer::initRenderer(int width, int height, bool windowed) {
- return E_FAIL;
+ERRORCODE CBRenderer::initRenderer(int width, int height, bool windowed) {
+ return STATUS_FAILED;
}
@@ -137,36 +137,36 @@ void CBRenderer::onWindowChange() {
//////////////////////////////////////////////////////////////////////
-HRESULT CBRenderer::fill(byte r, byte g, byte b, Common::Rect *rect) {
- return E_FAIL;
+ERRORCODE CBRenderer::fill(byte r, byte g, byte b, Common::Rect *rect) {
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBRenderer::windowedBlt() {
- return E_FAIL;
+ERRORCODE CBRenderer::windowedBlt() {
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBRenderer::setup2D(bool Force) {
- return E_FAIL;
+ERRORCODE CBRenderer::setup2D(bool Force) {
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBRenderer::setupLines() {
- return E_FAIL;
+ERRORCODE CBRenderer::setupLines() {
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBRenderer::drawLine(int x1, int y1, int x2, int y2, uint32 color) {
- return E_FAIL;
+ERRORCODE CBRenderer::drawLine(int x1, int y1, int x2, int y2, uint32 color) {
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBRenderer::drawRect(int x1, int y1, int x2, int y2, uint32 color, int width) {
+ERRORCODE CBRenderer::drawRect(int x1, int y1, int x2, int y2, uint32 color, int width) {
for (int i = 0; i < width; i++) {
drawLine(x1 + i, y1 + i, x2 - i, y1 + i, color); // up
drawLine(x1 + i, y2 - i, x2 - i + 1, y2 - i, color); // down
@@ -174,36 +174,36 @@ HRESULT CBRenderer::drawRect(int x1, int y1, int x2, int y2, uint32 color, int w
drawLine(x1 + i, y1 + i, x1 + i, y2 - i, color); // left
drawLine(x2 - i, y1 + i, x2 - i, y2 - i + 1, color); // right
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBRenderer::fade(uint16 alpha) {
- return E_FAIL;
+ERRORCODE CBRenderer::fade(uint16 alpha) {
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBRenderer::fadeToColor(uint32 color, Common::Rect *rect) {
- return E_FAIL;
+ERRORCODE CBRenderer::fadeToColor(uint32 color, Common::Rect *rect) {
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBRenderer::setViewport(int left, int top, int right, int bottom) {
- return E_FAIL;
+ERRORCODE CBRenderer::setViewport(int left, int top, int right, int bottom) {
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBRenderer::setScreenViewport() {
+ERRORCODE CBRenderer::setScreenViewport() {
return setViewport(_drawOffsetX, _drawOffsetY, _width + _drawOffsetX, _height + _drawOffsetY);
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBRenderer::setViewport(RECT *rect) {
+ERRORCODE CBRenderer::setViewport(RECT *rect) {
return setViewport(rect->left + _drawOffsetX,
rect->top + _drawOffsetY,
rect->right + _drawOffsetX,
@@ -218,7 +218,7 @@ CBImage *CBRenderer::takeScreenshot() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBRenderer::clipCursor() {
+ERRORCODE CBRenderer::clipCursor() {
/*
if (!_windowed) {
RECT rc;
@@ -233,15 +233,15 @@ HRESULT CBRenderer::clipCursor() {
::ClipCursor(&rc);
}
*/
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBRenderer::unclipCursor() {
+ERRORCODE CBRenderer::unclipCursor() {
/*
if (!_windowed) ::ClipCursor(NULL);
*/
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/wintermute/Base/BRenderer.h b/engines/wintermute/Base/BRenderer.h
index e8067bee7e..5d290eedd6 100644
--- a/engines/wintermute/Base/BRenderer.h
+++ b/engines/wintermute/Base/BRenderer.h
@@ -49,37 +49,37 @@ public:
virtual void dumpData(const char *filename) {};
virtual CBImage *takeScreenshot();
- virtual HRESULT setViewport(int left, int top, int right, int bottom);
- virtual HRESULT setViewport(RECT *Rect);
- virtual HRESULT setScreenViewport();
- virtual HRESULT fade(uint16 Alpha);
- virtual HRESULT fadeToColor(uint32 Color, Common::Rect *rect = NULL);
- virtual HRESULT drawLine(int x1, int y1, int x2, int y2, uint32 color);
- virtual HRESULT drawRect(int x1, int y1, int x2, int y2, uint32 color, int width = 1);
+ virtual ERRORCODE setViewport(int left, int top, int right, int bottom);
+ virtual ERRORCODE setViewport(RECT *Rect);
+ virtual ERRORCODE setScreenViewport();
+ virtual ERRORCODE fade(uint16 Alpha);
+ virtual ERRORCODE fadeToColor(uint32 Color, Common::Rect *rect = NULL);
+ virtual ERRORCODE drawLine(int x1, int y1, int x2, int y2, uint32 color);
+ virtual ERRORCODE drawRect(int x1, int y1, int x2, int y2, uint32 color, int width = 1);
CBRenderer(CBGame *inGame = NULL);
virtual ~CBRenderer();
- virtual HRESULT setProjection() {
- return S_OK;
+ virtual ERRORCODE setProjection() {
+ return STATUS_OK;
};
- virtual HRESULT windowedBlt();
- virtual HRESULT fill(byte r, byte g, byte b, Common::Rect *rect = NULL);
+ virtual ERRORCODE windowedBlt();
+ virtual ERRORCODE fill(byte r, byte g, byte b, Common::Rect *rect = NULL);
virtual void onWindowChange();
- virtual HRESULT initRenderer(int width, int height, bool windowed);
- virtual HRESULT flip();
+ virtual ERRORCODE initRenderer(int width, int height, bool windowed);
+ virtual ERRORCODE flip();
virtual void initLoop();
- virtual HRESULT switchFullscreen();
- virtual HRESULT setup2D(bool force = false);
- virtual HRESULT setupLines();
+ virtual ERRORCODE switchFullscreen();
+ virtual ERRORCODE setup2D(bool force = false);
+ virtual ERRORCODE setupLines();
virtual const char *getName() {
return "";
};
- virtual HRESULT displayDebugInfo() {
- return E_FAIL;
+ virtual ERRORCODE displayDebugInfo() {
+ return STATUS_FAILED;
};
- virtual HRESULT drawShaderQuad() {
- return E_FAIL;
+ virtual ERRORCODE drawShaderQuad() {
+ return STATUS_FAILED;
}
virtual float getScaleRatioX() const {
@@ -89,17 +89,17 @@ public:
return 1.0f;
}
- HRESULT clipCursor();
- HRESULT unclipCursor();
+ ERRORCODE clipCursor();
+ ERRORCODE unclipCursor();
CBObject *getObjectAt(int x, int y);
void deleteRectList();
- virtual HRESULT startSpriteBatch() {
- return S_OK;
+ virtual ERRORCODE startSpriteBatch() {
+ return STATUS_OK;
};
- virtual HRESULT endSpriteBatch() {
- return S_OK;
+ virtual ERRORCODE endSpriteBatch() {
+ return STATUS_OK;
};
bool pointInViewport(POINT *P);
uint32 _forceAlphaColor;
diff --git a/engines/wintermute/Base/BSaveThumbHelper.cpp b/engines/wintermute/Base/BSaveThumbHelper.cpp
index 16485fd9ef..f53ffda52c 100644
--- a/engines/wintermute/Base/BSaveThumbHelper.cpp
+++ b/engines/wintermute/Base/BSaveThumbHelper.cpp
@@ -45,7 +45,7 @@ CBSaveThumbHelper::~CBSaveThumbHelper(void) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSaveThumbHelper::storeThumbnail(bool doFlip) {
+ERRORCODE CBSaveThumbHelper::storeThumbnail(bool doFlip) {
delete _thumbnail;
_thumbnail = NULL;
@@ -61,7 +61,7 @@ HRESULT CBSaveThumbHelper::storeThumbnail(bool doFlip) {
}
CBImage *screenshot = Game->_renderer->takeScreenshot();
- if (!screenshot) return E_FAIL;
+ if (!screenshot) return STATUS_FAILED;
// normal thumbnail
if (Game->_thumbnailWidth > 0 && Game->_thumbnailHeight > 0) {
@@ -73,7 +73,7 @@ HRESULT CBSaveThumbHelper::storeThumbnail(bool doFlip) {
delete screenshot;
screenshot = NULL;
}
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Base/BSaveThumbHelper.h b/engines/wintermute/Base/BSaveThumbHelper.h
index f3a2f914ef..27163af30f 100644
--- a/engines/wintermute/Base/BSaveThumbHelper.h
+++ b/engines/wintermute/Base/BSaveThumbHelper.h
@@ -39,7 +39,7 @@ class CBSaveThumbHelper : public CBBase {
public:
CBSaveThumbHelper(CBGame *inGame);
virtual ~CBSaveThumbHelper(void);
- HRESULT storeThumbnail(bool doFlip = false);
+ ERRORCODE storeThumbnail(bool doFlip = false);
CBImage *_thumbnail;
CBImage *_richThumbnail;
diff --git a/engines/wintermute/Base/BScriptHolder.cpp b/engines/wintermute/Base/BScriptHolder.cpp
index 2049287be5..160ba7e2cd 100644
--- a/engines/wintermute/Base/BScriptHolder.cpp
+++ b/engines/wintermute/Base/BScriptHolder.cpp
@@ -55,7 +55,7 @@ CBScriptHolder::~CBScriptHolder() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBScriptHolder::cleanup() {
+ERRORCODE CBScriptHolder::cleanup() {
delete[] _filename;
_filename = NULL;
@@ -67,7 +67,7 @@ HRESULT CBScriptHolder::cleanup() {
}
_scripts.RemoveAll();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////
@@ -80,17 +80,17 @@ void CBScriptHolder::setFilename(const char *filename) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBScriptHolder::applyEvent(const char *eventName, bool unbreakable) {
+ERRORCODE CBScriptHolder::applyEvent(const char *eventName, bool unbreakable) {
int numHandlers = 0;
- HRESULT ret = E_FAIL;
+ ERRORCODE ret = STATUS_FAILED;
for (int i = 0; i < _scripts.GetSize(); i++) {
if (!_scripts[i]->_thread) {
CScScript *handler = _scripts[i]->invokeEventHandler(eventName, unbreakable);
if (handler) {
//_scripts.Add(handler);
numHandlers++;
- ret = S_OK;
+ ret = STATUS_OK;
}
}
}
@@ -101,15 +101,15 @@ HRESULT CBScriptHolder::applyEvent(const char *eventName, bool unbreakable) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBScriptHolder::listen(CBScriptHolder *param1, uint32 param2) {
- return E_FAIL;
+ERRORCODE CBScriptHolder::listen(CBScriptHolder *param1, uint32 param2) {
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-HRESULT CBScriptHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CBScriptHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// DEBUG_CrashMe
//////////////////////////////////////////////////////////////////////////
@@ -119,7 +119,7 @@ HRESULT CBScriptHolder::scCallMethod(CScScript *script, CScStack *stack, CScStac
*p = 10;
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -128,13 +128,13 @@ HRESULT CBScriptHolder::scCallMethod(CScScript *script, CScStack *stack, CScStac
else if (strcmp(name, "ApplyEvent") == 0) {
stack->correctParams(1);
CScValue *val = stack->pop();
- HRESULT ret;
+ ERRORCODE ret;
ret = applyEvent(val->getString());
- if (SUCCEEDED(ret)) stack->pushBool(true);
+ if (DID_SUCCEED(ret)) stack->pushBool(true);
else stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -144,7 +144,7 @@ HRESULT CBScriptHolder::scCallMethod(CScScript *script, CScStack *stack, CScStac
stack->correctParams(1);
stack->pushBool(canHandleEvent(stack->pop()->getString()));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -154,7 +154,7 @@ HRESULT CBScriptHolder::scCallMethod(CScScript *script, CScStack *stack, CScStac
stack->correctParams(1);
stack->pushBool(canHandleMethod(stack->pop()->getString()));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -162,9 +162,9 @@ HRESULT CBScriptHolder::scCallMethod(CScScript *script, CScStack *stack, CScStac
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "AttachScript") == 0) {
stack->correctParams(1);
- stack->pushBool(SUCCEEDED(addScript(stack->pop()->getString())));
+ stack->pushBool(DID_SUCCEED(addScript(stack->pop()->getString())));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -184,7 +184,7 @@ HRESULT CBScriptHolder::scCallMethod(CScScript *script, CScStack *stack, CScStac
}
stack->pushBool(ret);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -202,7 +202,7 @@ HRESULT CBScriptHolder::scCallMethod(CScScript *script, CScStack *stack, CScStac
}
stack->pushBool(ret);
- return S_OK;
+ return STATUS_OK;
} else return CBScriptable::scCallMethod(script, stack, thisStack, name);
}
@@ -240,13 +240,13 @@ CScValue *CBScriptHolder::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBScriptHolder::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CBScriptHolder::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
// Name
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "Name") == 0) {
setName(value->getString());
- return S_OK;
+ return STATUS_OK;
} else return CBScriptable::scSetProperty(name, value);
}
@@ -257,13 +257,13 @@ const char *CBScriptHolder::scToString() {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBScriptHolder::saveAsText(CBDynBuffer *buffer, int indent) {
+ERRORCODE CBScriptHolder::saveAsText(CBDynBuffer *buffer, int indent) {
return CBBase::saveAsText(buffer, indent);
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBScriptHolder::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CBScriptHolder::persist(CBPersistMgr *persistMgr) {
CBScriptable::persist(persistMgr);
persistMgr->transfer(TMEMBER(_filename));
@@ -271,17 +271,17 @@ HRESULT CBScriptHolder::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(_name));
_scripts.persist(persistMgr);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBScriptHolder::addScript(const char *filename) {
+ERRORCODE CBScriptHolder::addScript(const char *filename) {
for (int i = 0; i < _scripts.GetSize(); i++) {
if (scumm_stricmp(_scripts[i]->_filename, filename) == 0) {
if (_scripts[i]->_state != SCRIPT_FINISHED) {
Game->LOG(0, "CBScriptHolder::AddScript - trying to add script '%s' mutiple times (obj: '%s')", filename, _name);
- return S_OK;
+ return STATUS_OK;
}
}
}
@@ -299,26 +299,26 @@ HRESULT CBScriptHolder::addScript(const char *filename) {
Game->_scEngine->_scripts.Add(scr);
Game->getDebugMgr()->onScriptInit(scr);
- return S_OK;
+ return STATUS_OK;
}
- return E_FAIL;
+ return STATUS_FAILED;
} else {
scr->_freezable = _freezable;
_scripts.Add(scr);
- return S_OK;
+ return STATUS_OK;
}
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBScriptHolder::removeScript(CScScript *script) {
+ERRORCODE CBScriptHolder::removeScript(CScScript *script) {
for (int i = 0; i < _scripts.GetSize(); i++) {
if (_scripts[i] == script) {
_scripts.RemoveAt(i);
break;
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -345,7 +345,7 @@ TOKEN_DEF(NAME)
TOKEN_DEF(VALUE)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-HRESULT CBScriptHolder::parseProperty(byte *buffer, bool complete) {
+ERRORCODE CBScriptHolder::parseProperty(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(PROPERTY)
TOKEN_TABLE(NAME)
@@ -359,7 +359,7 @@ HRESULT CBScriptHolder::parseProperty(byte *buffer, bool complete) {
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_PROPERTY) {
Game->LOG(0, "'PROPERTY' keyword expected.");
- return E_FAIL;
+ return STATUS_FAILED;
}
buffer = params;
}
@@ -391,7 +391,7 @@ HRESULT CBScriptHolder::parseProperty(byte *buffer, bool complete) {
propName = NULL;
propValue = NULL;
Game->LOG(0, "Syntax error in PROPERTY definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (cmd == PARSERR_GENERIC || propName == NULL || propValue == NULL) {
delete[] propName;
@@ -399,7 +399,7 @@ HRESULT CBScriptHolder::parseProperty(byte *buffer, bool complete) {
propName = NULL;
propValue = NULL;
Game->LOG(0, "Error loading PROPERTY definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
@@ -413,7 +413,7 @@ HRESULT CBScriptHolder::parseProperty(byte *buffer, bool complete) {
propName = NULL;
propValue = NULL;
- return S_OK;
+ return STATUS_OK;
}
@@ -433,8 +433,8 @@ CScScript *CBScriptHolder::invokeMethodThread(const char *methodName) {
CScScript *thread = new CScScript(Game, _scripts[i]->_engine);
if (thread) {
- HRESULT ret = thread->createMethodThread(_scripts[i], methodName);
- if (SUCCEEDED(ret)) {
+ ERRORCODE ret = thread->createMethodThread(_scripts[i], methodName);
+ if (DID_SUCCEED(ret)) {
_scripts[i]->_engine->_scripts.Add(thread);
Game->getDebugMgr()->onScriptMethodThreadInit(thread, _scripts[i], methodName);
@@ -467,7 +467,7 @@ void CBScriptHolder::scDebuggerDesc(char *buf, int bufSize) {
// IWmeObject
//////////////////////////////////////////////////////////////////////////
bool CBScriptHolder::sendEvent(const char *eventName) {
- return SUCCEEDED(applyEvent(eventName));
+ return DID_SUCCEED(applyEvent(eventName));
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Base/BScriptHolder.h b/engines/wintermute/Base/BScriptHolder.h
index f417cc7e51..dabaf52dd3 100644
--- a/engines/wintermute/Base/BScriptHolder.h
+++ b/engines/wintermute/Base/BScriptHolder.h
@@ -45,14 +45,14 @@ public:
virtual void makeFreezable(bool freezable);
bool canHandleEvent(const char *eventName);
virtual bool canHandleMethod(const char *eventMethod);
- HRESULT cleanup();
- HRESULT removeScript(CScScript *script);
- HRESULT addScript(const char *filename);
- virtual HRESULT saveAsText(CBDynBuffer *buffer, int indent);
- virtual HRESULT listen(CBScriptHolder *param1, uint32 param2);
- HRESULT applyEvent(const char *eventName, bool unbreakable = false);
+ ERRORCODE cleanup();
+ ERRORCODE removeScript(CScScript *script);
+ ERRORCODE addScript(const char *filename);
+ virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent);
+ virtual ERRORCODE listen(CBScriptHolder *param1, uint32 param2);
+ ERRORCODE applyEvent(const char *eventName, bool unbreakable = false);
void setFilename(const char *filename);
- HRESULT parseProperty(byte *buffer, bool complete = true);
+ ERRORCODE parseProperty(byte *buffer, bool complete = true);
char *_filename;
bool _freezable;
bool _ready;
@@ -60,8 +60,8 @@ public:
CBArray<CScScript *, CScScript *> _scripts;
// scripting interface
virtual CScValue *scGetProperty(const char *name);
- virtual HRESULT scSetProperty(const char *name, CScValue *value);
- virtual HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ERRORCODE scSetProperty(const char *name, CScValue *value);
+ virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
virtual const char *scToString();
virtual void scDebuggerDesc(char *buf, int bufSize);
// IWmeObject
diff --git a/engines/wintermute/Base/BScriptable.cpp b/engines/wintermute/Base/BScriptable.cpp
index 0e0ca7d45b..8e93a8914e 100644
--- a/engines/wintermute/Base/BScriptable.cpp
+++ b/engines/wintermute/Base/BScriptable.cpp
@@ -61,15 +61,15 @@ CBScriptable::~CBScriptable() {
//////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-HRESULT CBScriptable::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CBScriptable::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
/*
stack->correctParams(0);
stack->pushNULL();
script->runtimeError("Call to undefined method '%s'.", name);
- return S_OK;
+ return STATUS_OK;
*/
- return E_FAIL;
+ return STATUS_FAILED;
}
@@ -82,10 +82,10 @@ CScValue *CBScriptable::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBScriptable::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CBScriptable::scSetProperty(const char *name, CScValue *value) {
if (!_scProp) _scProp = new CScValue(Game);
if (_scProp) return _scProp->setProp(name, value);
- else return E_FAIL;
+ else return STATUS_FAILED;
}
@@ -139,13 +139,13 @@ void CBScriptable::scSetBool(bool val) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBScriptable::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CBScriptable::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(Game));
persistMgr->transfer(TMEMBER(_refCount));
persistMgr->transfer(TMEMBER(_scProp));
persistMgr->transfer(TMEMBER(_scValue));
- return S_OK;
+ return STATUS_OK;
}
diff --git a/engines/wintermute/Base/BScriptable.h b/engines/wintermute/Base/BScriptable.h
index d0c91800f1..a65e3d20b6 100644
--- a/engines/wintermute/Base/BScriptable.h
+++ b/engines/wintermute/Base/BScriptable.h
@@ -50,9 +50,9 @@ public:
// high level scripting interface
virtual bool canHandleMethod(const char *eventMethod);
- virtual HRESULT scSetProperty(const char *name, CScValue *value);
+ virtual ERRORCODE scSetProperty(const char *name, CScValue *value);
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);
virtual const char *scToString();
virtual void *scToMemBuffer();
virtual int scToInt();
diff --git a/engines/wintermute/Base/BSound.cpp b/engines/wintermute/Base/BSound.cpp
index c3ed1a8e26..b4536e7f9e 100644
--- a/engines/wintermute/Base/BSound.cpp
+++ b/engines/wintermute/Base/BSound.cpp
@@ -65,7 +65,7 @@ CBSound::~CBSound() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSound::setSound(const char *filename, TSoundType type, bool streamed) {
+ERRORCODE CBSound::setSound(const char *filename, TSoundType type, bool streamed) {
if (_sound) {
Game->_soundMgr->removeSound(_sound);
_sound = NULL;
@@ -81,13 +81,13 @@ HRESULT CBSound::setSound(const char *filename, TSoundType type, bool streamed)
_soundType = type;
_soundStreamed = streamed;
- return S_OK;
- } else return E_FAIL;
+ return STATUS_OK;
+ } else return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSound::setSoundSimple() {
+ERRORCODE CBSound::setSoundSimple() {
_sound = Game->_soundMgr->addSound(_soundFilename, _soundType, _soundStreamed);
if (_sound) {
if (_soundPosition) _sound->setPosition(_soundPosition);
@@ -96,8 +96,8 @@ HRESULT CBSound::setSoundSimple() {
_sound->setLoopStart(_soundLoopStart);
_sound->_freezePaused = _soundFreezePaused;
if (_soundPlaying) return _sound->resume();
- else return S_OK;
- } else return E_FAIL;
+ else return STATUS_OK;
+ } else return STATUS_FAILED;
}
@@ -110,44 +110,44 @@ uint32 CBSound::getLength() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSound::play(bool looping) {
+ERRORCODE CBSound::play(bool looping) {
if (_sound) {
_soundPaused = false;
return _sound->play(looping, _soundPosition);
- } else return E_FAIL;
+ } else return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSound::stop() {
+ERRORCODE CBSound::stop() {
if (_sound) {
_soundPaused = false;
return _sound->stop();
- } else return E_FAIL;
+ } else return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSound::pause(bool freezePaused) {
+ERRORCODE CBSound::pause(bool freezePaused) {
if (_sound) {
_soundPaused = true;
if (freezePaused) _sound->_freezePaused = true;
return _sound->pause();
- } else return E_FAIL;
+ } else return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSound::resume() {
+ERRORCODE CBSound::resume() {
if (_sound && _soundPaused) {
_soundPaused = false;
return _sound->resume();
- } else return E_FAIL;
+ } else return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSound::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CBSound::persist(CBPersistMgr *persistMgr) {
if (persistMgr->_saving && _sound) {
_soundPlaying = _sound->isPlaying();
_soundLooping = _sound->_looping;
@@ -176,7 +176,7 @@ HRESULT CBSound::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER_INT(_soundType));
persistMgr->transfer(TMEMBER(_soundLoopStart));
- return S_OK;
+ return STATUS_OK;
}
@@ -193,10 +193,10 @@ bool CBSound::isPaused() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSound::setPositionTime(uint32 time) {
- if (!_sound) return E_FAIL;
+ERRORCODE CBSound::setPositionTime(uint32 time) {
+ if (!_sound) return STATUS_FAILED;
_soundPosition = time;
- HRESULT ret = _sound->setPosition(_soundPosition);
+ ERRORCODE ret = _sound->setPosition(_soundPosition);
if (_sound->isPlaying())
_soundPosition = 0;
return ret;
@@ -214,16 +214,16 @@ uint32 CBSound::getPositionTime() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSound::setVolume(int volume) {
+ERRORCODE CBSound::setVolume(int volume) {
if (!_sound)
- return E_FAIL;
+ return STATUS_FAILED;
else return _sound->setPrivateVolume(volume);
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSound::setPrivateVolume(int volume) {
+ERRORCODE CBSound::setPrivateVolume(int volume) {
if (!_sound)
- return E_FAIL;
+ return STATUS_FAILED;
else return _sound->_privateVolume = volume;
}
@@ -236,30 +236,30 @@ int CBSound::getVolume() {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSound::setLoopStart(uint32 pos) {
+ERRORCODE CBSound::setLoopStart(uint32 pos) {
if (!_sound)
- return E_FAIL;
+ return STATUS_FAILED;
else {
_sound->setLoopStart(pos);
- return S_OK;
+ return STATUS_OK;
}
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSound::setPan(float pan) {
+ERRORCODE CBSound::setPan(float pan) {
if (_sound)
return _sound->setPan(pan);
- else return E_FAIL;
+ else return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSound::ApplyFX(TSFXType type, float param1, float param2, float param3, float param4) {
+ERRORCODE CBSound::ApplyFX(TSFXType type, float param1, float param2, float param3, float param4) {
if (!_sound)
- return S_OK;
+ return STATUS_OK;
if (type != _sFXType || param1 != _sFXParam1 || param2 != _sFXParam2 || param3 != _sFXParam3 || param4 != _sFXParam4) {
- HRESULT ret = _sound->applyFX(type, param1, param2, param3, param4);
+ ERRORCODE ret = _sound->applyFX(type, param1, param2, param3, param4);
_sFXType = type;
_sFXParam1 = param1;
@@ -269,7 +269,7 @@ HRESULT CBSound::ApplyFX(TSFXType type, float param1, float param2, float param3
return ret;
}
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Base/BSound.h b/engines/wintermute/Base/BSound.h
index 4bc3f25c19..dd08e32b54 100644
--- a/engines/wintermute/Base/BSound.h
+++ b/engines/wintermute/Base/BSound.h
@@ -38,14 +38,14 @@ namespace WinterMute {
class CBSound : public CBBase {
public:
- HRESULT setPan(float pan);
+ ERRORCODE setPan(float pan);
int _soundPrivateVolume;
int getVolume();
- HRESULT setVolume(int volume);
- HRESULT setPrivateVolume(int volume);
- HRESULT setLoopStart(uint32 pos);
+ ERRORCODE setVolume(int volume);
+ ERRORCODE setPrivateVolume(int volume);
+ ERRORCODE setLoopStart(uint32 pos);
uint32 getPositionTime();
- HRESULT setPositionTime(uint32 time);
+ ERRORCODE setPositionTime(uint32 time);
bool _soundPaused;
bool _soundFreezePaused;
bool isPlaying();
@@ -55,20 +55,20 @@ public:
uint32 _soundLoopStart;
uint32 _soundPosition;
DECLARE_PERSISTENT(CBSound, CBBase)
- HRESULT resume();
- HRESULT pause(bool freezePaused = false);
- HRESULT stop();
- HRESULT play(bool looping = false);
+ ERRORCODE resume();
+ ERRORCODE pause(bool freezePaused = false);
+ ERRORCODE stop();
+ ERRORCODE play(bool looping = false);
uint32 getLength();
bool _soundStreamed;
TSoundType _soundType;
char *_soundFilename;
- HRESULT setSoundSimple();
- HRESULT setSound(const char *filename, TSoundType type = SOUND_SFX, bool streamed = false);
+ ERRORCODE setSoundSimple();
+ ERRORCODE setSound(const char *filename, TSoundType type = SOUND_SFX, bool streamed = false);
CBSound(CBGame *inGame);
virtual ~CBSound();
- HRESULT ApplyFX(TSFXType type = SFX_NONE, float param1 = 0, float param2 = 0, float param3 = 0, float param4 = 0);
+ ERRORCODE ApplyFX(TSFXType type = SFX_NONE, float param1 = 0, float param2 = 0, float param3 = 0, float param4 = 0);
private:
TSFXType _sFXType;
diff --git a/engines/wintermute/Base/BSoundBuffer.cpp b/engines/wintermute/Base/BSoundBuffer.cpp
index 40793efc98..1bdb0f3adc 100644
--- a/engines/wintermute/Base/BSoundBuffer.cpp
+++ b/engines/wintermute/Base/BSoundBuffer.cpp
@@ -93,7 +93,7 @@ void CBSoundBuffer::setStreaming(bool Streamed, uint32 NumBlocks, uint32 BlockSi
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSoundBuffer::loadFromFile(const char *filename, bool forceReload) {
+ERRORCODE CBSoundBuffer::loadFromFile(const char *filename, bool forceReload) {
warning("BSoundBuffer::LoadFromFile(%s,%d)", filename, forceReload);
#if 0
if (_stream) {
@@ -108,7 +108,7 @@ HRESULT CBSoundBuffer::loadFromFile(const char *filename, bool forceReload) {
_file = Game->_fileManager->openFile(filename, true, false);
if (!_file) {
Game->LOG(0, "Error opening sound file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
Common::String strFilename(filename);
if (strFilename.hasSuffix(".ogg")) {
@@ -120,11 +120,11 @@ HRESULT CBSoundBuffer::loadFromFile(const char *filename, bool forceReload) {
warning("BSoundBuffer::LoadFromFile - Unknown filetype for %s", filename);
}
if (!_stream) {
- return E_FAIL;
+ return STATUS_FAILED;
}
CBUtils::setString(&_filename, filename);
- return S_OK;
+ return STATUS_OK;
#if 0
BASS_FILEPROCS fileProc;
fileProc.close = CBSoundBuffer::FileCloseProc;
@@ -135,20 +135,20 @@ HRESULT CBSoundBuffer::loadFromFile(const char *filename, bool forceReload) {
_stream = BASS_StreamCreateFileUser(STREAMFILE_NOBUFFER, 0, &fileProc, (void *)_file);
if (!_stream) {
Game->LOG(0, "BASS error: %d while loading '%s'", BASS_ErrorGetCode(), filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
CBUtils::setString(&_filename, filename);
/*
- HRESULT res;
+ ERRORCODE res;
bool NewlyCreated = false;
if(!_soundBuffer || ForceReload || _streamed){
if(!_file) _file = Game->_fileManager->openFile(filename);
if(!_file){
Game->LOG(0, "Error opening sound file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
// switch to streamed for big files
if(!_streamed && (_file->GetSize() > MAX_NONSTREAMED_FILE_SIZE && !Game->_forceNonStreamedSounds)) SetStreaming(true);
@@ -159,7 +159,7 @@ HRESULT CBSoundBuffer::loadFromFile(const char *filename, bool forceReload) {
NewlyCreated = true;
res = InitializeBuffer(_file);
- if(FAILED(res)){
+ if(DID_FAIL(res)){
Game->LOG(res, "Error creating sound buffer for file '%s'", filename);
return res;
}
@@ -180,13 +180,13 @@ HRESULT CBSoundBuffer::loadFromFile(const char *filename, bool forceReload) {
}
*/
- return S_OK;
+ return STATUS_OK;
#endif
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSoundBuffer::play(bool looping, uint32 startSample) {
+ERRORCODE CBSoundBuffer::play(bool looping, uint32 startSample) {
if (startSample != 0) {
warning("BSoundBuffer::Play - Should start playback at %d, but currently we don't", startSample);
}
@@ -198,7 +198,7 @@ HRESULT CBSoundBuffer::play(bool looping, uint32 startSample) {
g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, _handle, _stream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::YES);
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -214,29 +214,29 @@ void CBSoundBuffer::setLooping(bool looping) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSoundBuffer::resume() {
+ERRORCODE CBSoundBuffer::resume() {
if (_stream && _handle) {
g_system->getMixer()->pauseHandle(*_handle, false);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSoundBuffer::stop() {
+ERRORCODE CBSoundBuffer::stop() {
if (_stream && _handle) {
g_system->getMixer()->stopHandle(*_handle);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSoundBuffer::pause() {
+ERRORCODE CBSoundBuffer::pause() {
if (_stream && _handle) {
g_system->getMixer()->pauseHandle(*_handle, true);
}
- return S_OK;
+ return STATUS_OK;
}
@@ -257,17 +257,17 @@ void CBSoundBuffer::setType(TSoundType type) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSoundBuffer::setVolume(int volume) {
+ERRORCODE CBSoundBuffer::setVolume(int volume) {
if (_stream && _handle) {
byte vol = (byte)(volume / 100.f * Audio::Mixer::kMaxChannelVolume);
g_system->getMixer()->setChannelVolume(*_handle, vol);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSoundBuffer::setPrivateVolume(int volume) {
+ERRORCODE CBSoundBuffer::setPrivateVolume(int volume) {
#if 0
_privateVolume = Volume;
@@ -308,7 +308,7 @@ uint32 CBSoundBuffer::getPosition() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSoundBuffer::setPosition(uint32 pos) {
+ERRORCODE CBSoundBuffer::setPosition(uint32 pos) {
warning("CBSoundBuffer::SetPosition - not implemented yet");
#if 0
if (_stream) {
@@ -316,11 +316,11 @@ HRESULT CBSoundBuffer::setPosition(uint32 pos) {
BASS_ChannelSetPosition(_stream, pos, BASS_POS_BYTE);
}
#endif
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSoundBuffer::setLoopStart(uint32 pos) {
+ERRORCODE CBSoundBuffer::setLoopStart(uint32 pos) {
_loopStart = pos;
#if 0
if (_stream) {
@@ -334,7 +334,7 @@ HRESULT CBSoundBuffer::setLoopStart(uint32 pos) {
}
}
#endif
- return S_OK;
+ return STATUS_OK;
}
#if 0
//////////////////////////////////////////////////////////////////////////
@@ -347,15 +347,15 @@ void CBSoundBuffer::LoopSyncProc(HSYNC handle, uint32 channel, uint32 data, void
}
#endif
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSoundBuffer::setPan(float pan) {
+ERRORCODE CBSoundBuffer::setPan(float pan) {
if (_stream) {
g_system->getMixer()->setChannelBalance(*_handle, (int8)(pan * 127));
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSoundBuffer::applyFX(TSFXType type, float param1, float param2, float param3, float param4) {
+ERRORCODE CBSoundBuffer::applyFX(TSFXType type, float param1, float param2, float param3, float param4) {
warning("CBSoundBuffer::ApplyFX - not implemented yet");
#if 0
switch (type) {
@@ -369,7 +369,7 @@ HRESULT CBSoundBuffer::applyFX(TSFXType type, float param1, float param2, float
break;
}
#endif
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Base/BSoundBuffer.h b/engines/wintermute/Base/BSoundBuffer.h
index 359c89e59e..22c4fd63da 100644
--- a/engines/wintermute/Base/BSoundBuffer.h
+++ b/engines/wintermute/Base/BSoundBuffer.h
@@ -48,32 +48,32 @@ public:
virtual ~CBSoundBuffer();
- HRESULT pause();
- HRESULT play(bool looping = false, uint32 startSample = 0);
- HRESULT resume();
- HRESULT stop();
+ ERRORCODE pause();
+ ERRORCODE play(bool looping = false, uint32 startSample = 0);
+ ERRORCODE resume();
+ ERRORCODE stop();
bool isPlaying();
void setLooping(bool looping);
uint32 getPosition();
- HRESULT setPosition(uint32 pos);
+ ERRORCODE setPosition(uint32 pos);
uint32 getLength();
- HRESULT setLoopStart(uint32 pos);
+ ERRORCODE setLoopStart(uint32 pos);
uint32 getLoopStart() const {
return _loopStart;
}
- HRESULT setPan(float pan);
- HRESULT setPrivateVolume(int colume);
- HRESULT setVolume(int colume);
+ ERRORCODE setPan(float pan);
+ ERRORCODE setPrivateVolume(int colume);
+ ERRORCODE setVolume(int colume);
void setType(TSoundType Type);
- HRESULT loadFromFile(const char *filename, bool forceReload = false);
+ ERRORCODE loadFromFile(const char *filename, bool forceReload = false);
void setStreaming(bool streamed, uint32 numBlocks = 0, uint32 blockSize = 0);
- HRESULT applyFX(TSFXType type, float param1, float param2, float param3, float param4);
+ ERRORCODE applyFX(TSFXType type, float param1, float param2, float param3, float param4);
//HSTREAM _stream;
//HSYNC _sync;
diff --git a/engines/wintermute/Base/BSoundMgr.cpp b/engines/wintermute/Base/BSoundMgr.cpp
index 1f801aca7a..9e038fd5fc 100644
--- a/engines/wintermute/Base/BSoundMgr.cpp
+++ b/engines/wintermute/Base/BSoundMgr.cpp
@@ -59,14 +59,14 @@ CBSoundMgr::~CBSoundMgr() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSoundMgr::cleanup() {
+ERRORCODE CBSoundMgr::cleanup() {
for (int i = 0; i < _sounds.GetSize(); i++)
delete _sounds[i];
_sounds.RemoveAll();
#if 0
BASS_Free();
#endif
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -81,7 +81,7 @@ void CBSoundMgr::saveSettings() {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSoundMgr::initialize() {
+ERRORCODE CBSoundMgr::initialize() {
_soundAvailable = false;
#if 0
@@ -93,12 +93,12 @@ HRESULT CBSoundMgr::initialize() {
if (HIWORD(BASS_GetVersion()) != BASSVERSION) {
Game->LOG(0, "An incorrect version of BASS was loaded");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (!BASS_Init(-1, 44100, 0, 0, NULL)) {
Game->LOG(0, "Can't initialize sound device");
- return E_FAIL;
+ return STATUS_FAILED;
}
#endif
@@ -111,19 +111,19 @@ HRESULT CBSoundMgr::initialize() {
_soundAvailable = true;
setMasterVolumePercent(_volumeMaster);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSoundMgr::initLoop() {
+ERRORCODE CBSoundMgr::initLoop() {
if (!_soundAvailable)
- return S_OK;
+ return STATUS_OK;
#if 0
BASS_Update(500);
#endif
- return S_OK;
+ return STATUS_OK;
}
@@ -153,8 +153,8 @@ CBSoundBuffer *CBSoundMgr::addSound(const char *filename, TSoundType type, bool
sound->setType(type);
- HRESULT res = sound->loadFromFile(filename);
- if (FAILED(res)) {
+ ERRORCODE res = sound->loadFromFile(filename);
+ if (DID_FAIL(res)) {
Game->LOG(res, "Error loading sound '%s'", filename);
delete sound;
return NULL;
@@ -182,9 +182,9 @@ CBSoundBuffer *CBSoundMgr::addSound(const char *filename, TSoundType type, bool
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSoundMgr::addSound(CBSoundBuffer *sound, TSoundType type) {
+ERRORCODE CBSoundMgr::addSound(CBSoundBuffer *sound, TSoundType type) {
if (!sound)
- return E_FAIL;
+ return STATUS_FAILED;
// set volume appropriately
switch (type) {
@@ -202,27 +202,27 @@ HRESULT CBSoundMgr::addSound(CBSoundBuffer *sound, TSoundType type) {
// register sound
_sounds.Add(sound);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSoundMgr::removeSound(CBSoundBuffer *sound) {
+ERRORCODE CBSoundMgr::removeSound(CBSoundBuffer *sound) {
for (int i = 0; i < _sounds.GetSize(); i++) {
if (_sounds[i] == sound) {
delete _sounds[i];
_sounds.RemoveAt(i);
- return S_OK;
+ return STATUS_OK;
}
}
- return E_FAIL;
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSoundMgr::setVolume(TSoundType type, int volume) {
+ERRORCODE CBSoundMgr::setVolume(TSoundType type, int volume) {
if (!_soundAvailable)
- return S_OK;
+ return STATUS_OK;
switch (type) {
case SOUND_SFX:
@@ -240,11 +240,11 @@ HRESULT CBSoundMgr::setVolume(TSoundType type, int volume) {
if (_sounds[i]->_type == type) _sounds[i]->setVolume(volume);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSoundMgr::setVolumePercent(TSoundType type, byte percent) {
+ERRORCODE CBSoundMgr::setVolumePercent(TSoundType type, byte percent) {
return setVolume(type, percent);
}
@@ -272,12 +272,12 @@ byte CBSoundMgr::getVolumePercent(TSoundType type) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSoundMgr::setMasterVolumePercent(byte percent) {
+ERRORCODE CBSoundMgr::setMasterVolumePercent(byte percent) {
_volumeMaster = percent;
#if 0
BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, (uint32)(10000.0f / 100.0f * (float)Percent));
#endif
- return S_OK;
+ return STATUS_OK;
}
@@ -293,7 +293,7 @@ byte CBSoundMgr::getMasterVolumePercent() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSoundMgr::pauseAll(bool includingMusic) {
+ERRORCODE CBSoundMgr::pauseAll(bool includingMusic) {
for (int i = 0; i < _sounds.GetSize(); i++) {
if (_sounds[i]->isPlaying() && (_sounds[i]->_type != SOUND_MUSIC || includingMusic)) {
@@ -302,12 +302,12 @@ HRESULT CBSoundMgr::pauseAll(bool includingMusic) {
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSoundMgr::resumeAll() {
+ERRORCODE CBSoundMgr::resumeAll() {
for (int i = 0; i < _sounds.GetSize(); i++) {
if (_sounds[i]->_freezePaused) {
@@ -316,7 +316,7 @@ HRESULT CBSoundMgr::resumeAll() {
}
}
- return S_OK;
+ return STATUS_OK;
}
diff --git a/engines/wintermute/Base/BSoundMgr.h b/engines/wintermute/Base/BSoundMgr.h
index e271508a50..9e8106e973 100644
--- a/engines/wintermute/Base/BSoundMgr.h
+++ b/engines/wintermute/Base/BSoundMgr.h
@@ -37,25 +37,25 @@ class CBSoundBuffer;
class CBSoundMgr : public CBBase {
public:
float posToPan(int x, int y);
- HRESULT resumeAll();
- HRESULT pauseAll(bool includingMusic = true);
- HRESULT cleanup();
+ ERRORCODE resumeAll();
+ ERRORCODE pauseAll(bool includingMusic = true);
+ ERRORCODE cleanup();
//DECLARE_PERSISTENT(CBSoundMgr, CBBase);
byte getMasterVolumePercent();
- HRESULT setMasterVolumePercent(byte percent);
+ ERRORCODE setMasterVolumePercent(byte percent);
byte getVolumePercent(TSoundType type);
- HRESULT setVolumePercent(TSoundType type, byte percent);
- HRESULT setVolume(TSoundType type, int volume);
+ ERRORCODE setVolumePercent(TSoundType type, byte percent);
+ ERRORCODE setVolume(TSoundType type, int volume);
uint32 _volumeOriginal;
int _volumeMaster;
int _volumeMusic;
int _volumeSpeech;
int _volumeSFX;
- HRESULT removeSound(CBSoundBuffer *sound);
+ ERRORCODE removeSound(CBSoundBuffer *sound);
CBSoundBuffer *addSound(const char *filename, TSoundType type = SOUND_SFX, bool streamed = false);
- HRESULT addSound(CBSoundBuffer *sound, TSoundType type = SOUND_SFX);
- HRESULT initLoop();
- HRESULT initialize();
+ ERRORCODE addSound(CBSoundBuffer *sound, TSoundType type = SOUND_SFX);
+ ERRORCODE initLoop();
+ ERRORCODE initialize();
bool _soundAvailable;
CBSoundMgr(CBGame *inGame);
virtual ~CBSoundMgr();
diff --git a/engines/wintermute/Base/BSprite.cpp b/engines/wintermute/Base/BSprite.cpp
index e022d75d84..6d595ffbe8 100644
--- a/engines/wintermute/Base/BSprite.cpp
+++ b/engines/wintermute/Base/BSprite.cpp
@@ -102,9 +102,9 @@ void CBSprite::cleanup() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSprite::draw(int x, int y, CBObject *registerOwner, float zoomX, float zoomY, uint32 alpha) {
+ERRORCODE CBSprite::draw(int x, int y, CBObject *registerOwner, float zoomX, float zoomY, uint32 alpha) {
GetCurrentFrame(zoomX, zoomY);
- if (_currentFrame < 0 || _currentFrame >= _frames.GetSize()) return S_OK;
+ if (_currentFrame < 0 || _currentFrame >= _frames.GetSize()) return STATUS_OK;
// move owner if allowed to
if (_changed && _owner && _owner->_movable) {
@@ -122,7 +122,7 @@ HRESULT CBSprite::draw(int x, int y, CBObject *registerOwner, float zoomX, float
//////////////////////////////////////////////////////////////////////
-HRESULT CBSprite::loadFile(const char *filename, int lifeTime, TSpriteCacheType cacheType) {
+ERRORCODE CBSprite::loadFile(const char *filename, int lifeTime, TSpriteCacheType cacheType) {
Common::SeekableReadStream *file = Game->_fileManager->openFile(filename);
if (!file) {
Game->LOG(0, "CBSprite::LoadFile failed for file '%s'", filename);
@@ -133,7 +133,7 @@ HRESULT CBSprite::loadFile(const char *filename, int lifeTime, TSpriteCacheType
file = NULL;
}
- HRESULT ret;
+ ERRORCODE ret;
AnsiString ext = PathUtil::getExtension(filename);
if (StringUtil::startsWith(filename, "savegame:", true) || StringUtil::compareNoCase(ext, "bmp") || StringUtil::compareNoCase(ext, "tga") || StringUtil::compareNoCase(ext, "png") || StringUtil::compareNoCase(ext, "jpg")) {
@@ -142,7 +142,7 @@ HRESULT CBSprite::loadFile(const char *filename, int lifeTime, TSpriteCacheType
subframe->setSurface(filename, true, 0, 0, 0, lifeTime, true);
if (subframe->_surface == NULL) {
Game->LOG(0, "Error loading simple sprite '%s'", filename);
- ret = E_FAIL;
+ ret = STATUS_FAILED;
delete frame;
delete subframe;
} else {
@@ -150,12 +150,12 @@ HRESULT CBSprite::loadFile(const char *filename, int lifeTime, TSpriteCacheType
frame->_subframes.Add(subframe);
_frames.Add(frame);
_currentFrame = 0;
- ret = S_OK;
+ ret = STATUS_OK;
}
} else {
byte *buffer = Game->_fileManager->readWholeFile(filename);
if (buffer) {
- if (FAILED(ret = loadBuffer(buffer, true, lifeTime, cacheType))) Game->LOG(0, "Error parsing SPRITE file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer, true, lifeTime, cacheType))) Game->LOG(0, "Error parsing SPRITE file '%s'", filename);
delete [] buffer;
}
}
@@ -187,7 +187,7 @@ TOKEN_DEF(EDITOR_BG_ALPHA)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////
-HRESULT CBSprite::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteCacheType cacheType) {
+ERRORCODE CBSprite::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteCacheType cacheType) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(CONTINUOUS)
TOKEN_TABLE(SPRITE)
@@ -216,7 +216,7 @@ HRESULT CBSprite::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteC
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_SPRITE) {
Game->LOG(0, "'SPRITE' keyword expected.");
- return E_FAIL;
+ return STATUS_FAILED;
}
buffer = params;
}
@@ -289,10 +289,10 @@ HRESULT CBSprite::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteC
frame = new CBFrame(Game);
- if (FAILED(frame->loadBuffer(params, FrameLifeTime, _streamedKeepLoaded))) {
+ if (DID_FAIL(frame->loadBuffer(params, FrameLifeTime, _streamedKeepLoaded))) {
delete frame;
Game->LOG(0, "Error parsing frame %d", frameCount);
- return E_FAIL;
+ return STATUS_FAILED;
}
_frames.Add(frame);
@@ -309,11 +309,11 @@ HRESULT CBSprite::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteC
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in SPRITE definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
_canBreak = !_continuous;
- return S_OK;
+ return STATUS_OK;
}
@@ -383,8 +383,8 @@ bool CBSprite::GetCurrentFrame(float zoomX, float zoomY) {
//////////////////////////////////////////////////////////////////////
-HRESULT CBSprite::display(int X, int Y, CBObject *Register, float ZoomX, float ZoomY, uint32 Alpha, float Rotate, TSpriteBlendMode BlendMode) {
- if (_currentFrame < 0 || _currentFrame >= _frames.GetSize()) return S_OK;
+ERRORCODE CBSprite::display(int X, int Y, CBObject *Register, float ZoomX, float ZoomY, uint32 Alpha, float Rotate, TSpriteBlendMode BlendMode) {
+ if (_currentFrame < 0 || _currentFrame >= _frames.GetSize()) return STATUS_OK;
// on change...
if (_changed) {
@@ -428,7 +428,7 @@ bool CBSprite::GetBoundingRect(LPRECT rect, int x, int y, float scaleX, float sc
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSprite::saveAsText(CBDynBuffer *buffer, int indent) {
+ERRORCODE CBSprite::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "SPRITE {\n");
buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", _name);
buffer->putTextIndent(indent + 2, "LOOPING=%s\n", _looping ? "TRUE" : "FALSE");
@@ -467,12 +467,12 @@ HRESULT CBSprite::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "}\n\n");
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSprite::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CBSprite::persist(CBPersistMgr *persistMgr) {
CBScriptHolder::persist(persistMgr);
persistMgr->transfer(TMEMBER(_canBreak));
@@ -500,14 +500,14 @@ HRESULT CBSprite::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(_streamedKeepLoaded));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// GetFrame
//////////////////////////////////////////////////////////////////////////
@@ -518,7 +518,7 @@ HRESULT CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
script->runtimeError("Sprite.GetFrame: Frame index %d is out of range.", Index);
stack->pushNULL();
} else stack->pushNative(_frames[Index], true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -544,7 +544,7 @@ HRESULT CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
}
}
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -554,7 +554,7 @@ HRESULT CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
stack->correctParams(0);
reset();
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -569,7 +569,7 @@ HRESULT CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
CBFrame *frame = new CBFrame(Game);
if (filename != NULL) {
CBSubFrame *sub = new CBSubFrame(Game);
- if (SUCCEEDED(sub->setSurface(filename))) {
+ if (DID_SUCCEED(sub->setSurface(filename))) {
sub->setDefaultRect();
frame->_subframes.Add(sub);
} else delete sub;
@@ -577,7 +577,7 @@ HRESULT CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
_frames.Add(frame);
stack->pushNative(frame, true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -597,7 +597,7 @@ HRESULT CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
CBFrame *frame = new CBFrame(Game);
if (filename != NULL) {
CBSubFrame *sub = new CBSubFrame(Game);
- if (SUCCEEDED(sub->setSurface(filename))) frame->_subframes.Add(sub);
+ if (DID_SUCCEED(sub->setSurface(filename))) frame->_subframes.Add(sub);
else delete sub;
}
@@ -606,7 +606,7 @@ HRESULT CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
else _frames.InsertAt(index, frame);
stack->pushNative(frame, true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -616,7 +616,7 @@ HRESULT CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
stack->correctParams(0);
_paused = true;
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -626,7 +626,7 @@ HRESULT CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
stack->correctParams(0);
_paused = false;
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
else return CBScriptHolder::scCallMethod(script, stack, thisStack, name);
@@ -707,7 +707,7 @@ CScValue *CBSprite::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSprite::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CBSprite::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
// CurrentFrame
//////////////////////////////////////////////////////////////////////////
@@ -717,7 +717,7 @@ HRESULT CBSprite::scSetProperty(const char *name, CScValue *value) {
_currentFrame = -1;
}
_lastFrameTime = 0;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -725,7 +725,7 @@ HRESULT CBSprite::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "PixelPerfect") == 0) {
_precise = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -733,7 +733,7 @@ HRESULT CBSprite::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Looping") == 0) {
_looping = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
else return CBScriptHolder::scSetProperty(name, value);
@@ -747,12 +747,12 @@ const char *CBSprite::scToString() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSprite::killAllSounds() {
+ERRORCODE CBSprite::killAllSounds() {
for (int i = 0; i < _frames.GetSize(); i++) {
if (_frames[i]->_sound)
_frames[i]->_sound->stop();
}
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Base/BSprite.h b/engines/wintermute/Base/BSprite.h
index 4bfa720289..a9ca84d358 100644
--- a/engines/wintermute/Base/BSprite.h
+++ b/engines/wintermute/Base/BSprite.h
@@ -39,7 +39,7 @@ class CBSurface;
class CBObject;
class CBSprite: public CBScriptHolder {
public:
- HRESULT killAllSounds();
+ ERRORCODE killAllSounds();
CBSurface *getSurface();
char *_editorBgFile;
int _editorBgOffsetX;
@@ -56,7 +56,7 @@ public:
bool GetBoundingRect(LPRECT rect, int x, int y, float scaleX = 100, float scaleY = 100);
int _moveY;
int _moveX;
- HRESULT display(int x, int y, CBObject *registerOwner = NULL, float zoomX = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL);
+ ERRORCODE display(int x, int y, CBObject *registerOwner = NULL, float zoomX = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL);
bool GetCurrentFrame(float zoomX = 100, float zoomY = 100);
bool _canBreak;
bool _editorMuted;
@@ -66,22 +66,22 @@ public:
bool _changed;
bool _paused;
bool _finished;
- HRESULT loadBuffer(byte *buffer, bool compete = true, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
- HRESULT loadFile(const char *filename, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
+ ERRORCODE loadBuffer(byte *buffer, bool compete = true, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
+ ERRORCODE loadFile(const char *filename, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
uint32 _lastFrameTime;
- HRESULT draw(int x, int y, CBObject *Register = NULL, float zoomX = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF);
+ ERRORCODE draw(int x, int y, CBObject *Register = NULL, float zoomX = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF);
bool _looping;
int _currentFrame;
- HRESULT addFrame(const char *filename, uint32 delay = 0, int hotspotX = 0, int hotspotY = 0, RECT *rect = NULL);
+ ERRORCODE addFrame(const char *filename, uint32 delay = 0, int hotspotX = 0, int hotspotY = 0, RECT *rect = NULL);
CBSprite(CBGame *inGame, CBObject *owner = NULL);
virtual ~CBSprite();
CBArray<CBFrame *, CBFrame *> _frames;
- HRESULT saveAsText(CBDynBuffer *buffer, int indent);
+ ERRORCODE saveAsText(CBDynBuffer *buffer, int indent);
// scripting interface
virtual CScValue *scGetProperty(const char *name);
- virtual HRESULT scSetProperty(const char *name, CScValue *value);
- virtual HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ERRORCODE scSetProperty(const char *name, CScValue *value);
+ virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
virtual const char *scToString();
};
diff --git a/engines/wintermute/Base/BStringTable.cpp b/engines/wintermute/Base/BStringTable.cpp
index 00e791dc5e..8d8b6b0fd1 100644
--- a/engines/wintermute/Base/BStringTable.cpp
+++ b/engines/wintermute/Base/BStringTable.cpp
@@ -50,12 +50,12 @@ CBStringTable::~CBStringTable() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBStringTable::addString(const char *key, const char *val, bool reportDuplicities) {
- if (key == NULL || val == NULL) return E_FAIL;
+ERRORCODE CBStringTable::addString(const char *key, const char *val, bool reportDuplicities) {
+ if (key == NULL || val == NULL) return STATUS_FAILED;
if (scumm_stricmp(key, "@right-to-left") == 0) {
Game->_textRTL = true;
- return S_OK;
+ return STATUS_OK;
}
Common::String final_key = key;
@@ -66,7 +66,7 @@ HRESULT CBStringTable::addString(const char *key, const char *val, bool reportDu
_strings[final_key] = val;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -169,7 +169,7 @@ const char *CBStringTable::expandStatic(const char *string, bool forceExpand) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBStringTable::loadFile(const char *filename, bool clearOld) {
+ERRORCODE CBStringTable::loadFile(const char *filename, bool clearOld) {
Game->LOG(0, "Loading string table...");
if (clearOld) _strings.clear();
@@ -178,7 +178,7 @@ HRESULT CBStringTable::loadFile(const char *filename, bool clearOld) {
byte *buffer = Game->_fileManager->readWholeFile(filename, &size);
if (buffer == NULL) {
Game->LOG(0, "CBStringTable::LoadFile failed for file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
uint32 pos = 0;
@@ -223,7 +223,7 @@ HRESULT CBStringTable::loadFile(const char *filename, bool clearOld) {
Game->LOG(0, " %d strings loaded", _strings.size());
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Base/BStringTable.h b/engines/wintermute/Base/BStringTable.h
index 059ff6fec0..94547ffbfc 100644
--- a/engines/wintermute/Base/BStringTable.h
+++ b/engines/wintermute/Base/BStringTable.h
@@ -38,9 +38,9 @@ namespace WinterMute {
class CBStringTable : public CBBase {
public:
const char *expandStatic(const char *string, bool forceExpand = false);
- HRESULT loadFile(const char *filename, bool deleteAll = true);
+ ERRORCODE loadFile(const char *filename, bool deleteAll = true);
void expand(char **str, bool forceExpand = false);
- HRESULT addString(const char *key, const char *val, bool reportDuplicities = true);
+ ERRORCODE addString(const char *key, const char *val, bool reportDuplicities = true);
CBStringTable(CBGame *inGame);
virtual ~CBStringTable();
Common::HashMap<Common::String, Common::String> _strings;
diff --git a/engines/wintermute/Base/BSubFrame.cpp b/engines/wintermute/Base/BSubFrame.cpp
index 36eb2f4063..af7bb128a5 100644
--- a/engines/wintermute/Base/BSubFrame.cpp
+++ b/engines/wintermute/Base/BSubFrame.cpp
@@ -90,7 +90,7 @@ TOKEN_DEF(EDITOR_SELECTED)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////
-HRESULT CBSubFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) {
+ERRORCODE CBSubFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(IMAGE)
TOKEN_TABLE(TRANSPARENT)
@@ -178,7 +178,7 @@ HRESULT CBSubFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) {
}
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in SUBFRAME definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (surfaceFile != NULL) {
@@ -186,26 +186,26 @@ HRESULT CBSubFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) {
else setSurface(surfaceFile, true, 0, 0, 0, lifeTime, keepLoaded);
}
- _alpha = DRGBA(ar, ag, ab, alpha);
- if (custoTrans) _transparent = DRGBA(r, g, b, 0xFF);
+ _alpha = BYTETORGBA(ar, ag, ab, alpha);
+ if (custoTrans) _transparent = BYTETORGBA(r, g, b, 0xFF);
/*
if(_surface == NULL)
{
Game->LOG(0, "Error parsing sub-frame. Image not set.");
- return E_FAIL;
+ return STATUS_FAILED;
}
*/
if (CBPlatform::isRectEmpty(&rect)) setDefaultRect();
else _rect = rect;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////
-HRESULT CBSubFrame::draw(int x, int y, CBObject *registerOwner, float zoomX, float zoomY, bool precise, uint32 alpha, float rotate, TSpriteBlendMode blendMode) {
- if (!_surface) return S_OK;
+ERRORCODE CBSubFrame::draw(int x, int y, CBObject *registerOwner, float zoomX, float zoomY, bool precise, uint32 alpha, float rotate, TSpriteBlendMode blendMode) {
+ if (!_surface) return STATUS_OK;
if (registerOwner != NULL && !_decoration) {
if (zoomX == 100 && zoomY == 100) {
@@ -214,9 +214,9 @@ HRESULT CBSubFrame::draw(int x, int y, CBObject *registerOwner, float zoomX, flo
Game->_renderer->_rectList.Add(new CBActiveRect(Game, registerOwner, this, (int)(x - (_hotspotX + _rect.left) * (zoomX / 100)), (int)(y - (_hotspotY + _rect.top) * (zoomY / 100)), (int)((_rect.right - _rect.left) * (zoomX / 100)), (int)((_rect.bottom - _rect.top) * (zoomY / 100)), zoomX, zoomY, precise));
}
}
- if (Game->_suspendedRendering) return S_OK;
+ if (Game->_suspendedRendering) return STATUS_OK;
- HRESULT res;
+ ERRORCODE res;
//if(Alpha==0xFFFFFFFF) Alpha = _alpha; // TODO: better (combine owner's and self alpha)
if (_alpha != 0xFFFFFFFF) alpha = _alpha;
@@ -249,7 +249,7 @@ bool CBSubFrame::getBoundingRect(LPRECT rect, int x, int y, float scaleX, float
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSubFrame::saveAsText(CBDynBuffer *buffer, int indent, bool complete) {
+ERRORCODE CBSubFrame::saveAsText(CBDynBuffer *buffer, int indent, bool complete) {
if (complete)
buffer->putTextIndent(indent, "SUBFRAME {\n");
@@ -257,7 +257,7 @@ HRESULT CBSubFrame::saveAsText(CBDynBuffer *buffer, int indent, bool complete) {
buffer->putTextIndent(indent + 2, "IMAGE = \"%s\"\n", _surface->_filename);
if (_transparent != 0xFFFF00FF)
- buffer->putTextIndent(indent + 2, "TRANSPARENT { %d,%d,%d }\n", D3DCOLGetR(_transparent), D3DCOLGetG(_transparent), D3DCOLGetB(_transparent));
+ buffer->putTextIndent(indent + 2, "TRANSPARENT { %d,%d,%d }\n", RGBCOLGetR(_transparent), RGBCOLGetG(_transparent), RGBCOLGetB(_transparent));
RECT rect;
CBPlatform::setRectEmpty(&rect);
@@ -269,8 +269,8 @@ HRESULT CBSubFrame::saveAsText(CBDynBuffer *buffer, int indent, bool complete) {
buffer->putTextIndent(indent + 2, "HOTSPOT {%d, %d}\n", _hotspotX, _hotspotY);
if (_alpha != 0xFFFFFFFF) {
- buffer->putTextIndent(indent + 2, "ALPHA_COLOR { %d,%d,%d }\n", D3DCOLGetR(_alpha), D3DCOLGetG(_alpha), D3DCOLGetB(_alpha));
- buffer->putTextIndent(indent + 2, "ALPHA = %d\n", D3DCOLGetA(_alpha));
+ buffer->putTextIndent(indent + 2, "ALPHA_COLOR { %d,%d,%d }\n", RGBCOLGetR(_alpha), RGBCOLGetG(_alpha), RGBCOLGetB(_alpha));
+ buffer->putTextIndent(indent + 2, "ALPHA = %d\n", RGBCOLGetA(_alpha));
}
if (_mirrorX)
@@ -297,7 +297,7 @@ HRESULT CBSubFrame::saveAsText(CBDynBuffer *buffer, int indent, bool complete) {
if (complete)
buffer->putTextIndent(indent, "}\n\n");
- return S_OK;
+ return STATUS_OK;
}
@@ -310,7 +310,7 @@ void CBSubFrame::setDefaultRect() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSubFrame::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CBSubFrame::persist(CBPersistMgr *persistMgr) {
CBScriptable::persist(persistMgr);
@@ -335,14 +335,14 @@ HRESULT CBSubFrame::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(_mirrorY));
persistMgr->transfer(TMEMBER(_transparent));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSubFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CBSubFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// GetImage
@@ -352,7 +352,7 @@ HRESULT CBSubFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *t
if (!_surfaceFilename) stack->pushNULL();
else stack->pushString(_surfaceFilename);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -369,13 +369,13 @@ HRESULT CBSubFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *t
stack->pushBool(true);
} else {
const char *filename = Val->getString();
- if (SUCCEEDED(setSurface(filename))) {
+ if (DID_SUCCEED(setSurface(filename))) {
setDefaultRect();
stack->pushBool(true);
} else stack->pushBool(false);
}
- return S_OK;
+ return STATUS_OK;
}
else return CBScriptable::scCallMethod(script, stack, thisStack, name);
@@ -473,13 +473,13 @@ CScValue *CBSubFrame::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSubFrame::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CBSubFrame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
// AlphaColor
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "AlphaColor") == 0) {
_alpha = (uint32)value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -487,7 +487,7 @@ HRESULT CBSubFrame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Is2DOnly") == 0) {
_2DOnly = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -495,7 +495,7 @@ HRESULT CBSubFrame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Is3DOnly") == 0) {
_3DOnly = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -503,7 +503,7 @@ HRESULT CBSubFrame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "MirrorX") == 0) {
_mirrorX = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -511,7 +511,7 @@ HRESULT CBSubFrame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "MirrorY") == 0) {
_mirrorY = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -519,7 +519,7 @@ HRESULT CBSubFrame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Decoration") == 0) {
_decoration = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -527,7 +527,7 @@ HRESULT CBSubFrame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "HotspotX") == 0) {
_hotspotX = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -535,7 +535,7 @@ HRESULT CBSubFrame::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "HotspotY") == 0) {
_hotspotY = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
else return CBScriptable::scSetProperty(name, value);
@@ -549,7 +549,7 @@ const char *CBSubFrame::scToString() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSubFrame::setSurface(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) {
+ERRORCODE CBSubFrame::setSurface(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) {
if (_surface) {
Game->_surfaceStorage->removeSurface(_surface);
_surface = NULL;
@@ -570,20 +570,20 @@ HRESULT CBSubFrame::setSurface(const char *filename, bool defaultCK, byte ckRed,
_lifeTime = lifeTime;
_keepLoaded = keepLoaded;
- return S_OK;
- } else return E_FAIL;
+ return STATUS_OK;
+ } else return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSubFrame::setSurfaceSimple() {
+ERRORCODE CBSubFrame::setSurfaceSimple() {
if (!_surfaceFilename) {
_surface = NULL;
- return S_OK;
+ return STATUS_OK;
}
_surface = Game->_surfaceStorage->addSurface(_surfaceFilename, _cKDefault, _cKRed, _cKGreen, _cKBlue, _lifeTime, _keepLoaded);
- if (_surface) return S_OK;
- else return E_FAIL;
+ if (_surface) return STATUS_OK;
+ else return STATUS_FAILED;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Base/BSubFrame.h b/engines/wintermute/Base/BSubFrame.h
index 575c91fd0f..b1503e3506 100644
--- a/engines/wintermute/Base/BSubFrame.h
+++ b/engines/wintermute/Base/BSubFrame.h
@@ -41,18 +41,18 @@ public:
bool _mirrorX;
bool _mirrorY;
bool _decoration;
- HRESULT setSurface(const char *filename, bool defaultCK = true, byte ckRed = 0, byte ckGreen = 0, byte ckBlue = 0, int lifeTime = -1, bool keepLoaded = false);
- HRESULT setSurfaceSimple();
+ ERRORCODE setSurface(const char *filename, bool defaultCK = true, byte ckRed = 0, byte ckGreen = 0, byte ckBlue = 0, int lifeTime = -1, bool keepLoaded = false);
+ ERRORCODE setSurfaceSimple();
DECLARE_PERSISTENT(CBSubFrame, CBScriptable)
void setDefaultRect();
uint32 _transparent;
- HRESULT saveAsText(CBDynBuffer *buffer, int indent) { return saveAsText(buffer, indent, true); }
- HRESULT saveAsText(CBDynBuffer *buffer, int indent, bool complete);
+ ERRORCODE saveAsText(CBDynBuffer *buffer, int indent) { return saveAsText(buffer, indent, true); }
+ ERRORCODE saveAsText(CBDynBuffer *buffer, int indent, bool complete);
bool _editorSelected;
CBSubFrame(CBGame *inGame);
virtual ~CBSubFrame();
- HRESULT loadBuffer(byte *buffer, int lifeTime, bool keepLoaded);
- HRESULT draw(int x, int y, CBObject *registerOwner = NULL, float zoomX = 100, float zoomY = 100, bool precise = true, uint32 alpha = 0xFFFFFFFF, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL);
+ ERRORCODE loadBuffer(byte *buffer, int lifeTime, bool keepLoaded);
+ ERRORCODE draw(int x, int y, CBObject *registerOwner = NULL, float zoomX = 100, float zoomY = 100, bool precise = true, uint32 alpha = 0xFFFFFFFF, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL);
bool getBoundingRect(LPRECT rect, int x, int y, float scaleX = 100, float scaleY = 100);
int _hotspotX;
@@ -75,8 +75,8 @@ public:
// scripting interface
virtual CScValue *scGetProperty(const char *name);
- virtual HRESULT scSetProperty(const char *name, CScValue *value);
- virtual HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ERRORCODE scSetProperty(const char *name, CScValue *value);
+ virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
virtual const char *scToString();
};
diff --git a/engines/wintermute/Base/BSurface.cpp b/engines/wintermute/Base/BSurface.cpp
index 8a325a4d7f..0cf5292afb 100644
--- a/engines/wintermute/Base/BSurface.cpp
+++ b/engines/wintermute/Base/BSurface.cpp
@@ -60,14 +60,14 @@ CBSurface::~CBSurface() {
//////////////////////////////////////////////////////////////////////
-HRESULT CBSurface::create(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) {
- return E_FAIL;
+ERRORCODE CBSurface::create(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) {
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////
-HRESULT CBSurface::restore() {
- return E_FAIL;
+ERRORCODE CBSurface::restore() {
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////
@@ -76,41 +76,41 @@ bool CBSurface::isTransparentAt(int x, int y) {
}
//////////////////////////////////////////////////////////////////////
-HRESULT CBSurface::displayHalfTrans(int x, int y, RECT rect) {
- return E_FAIL;
+ERRORCODE CBSurface::displayHalfTrans(int x, int y, RECT rect) {
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSurface::displayTransform(int x, int y, int hotX, int hotY, RECT rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
+ERRORCODE CBSurface::displayTransform(int x, int y, int hotX, int hotY, RECT rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
return displayTransZoom(x, y, rect, zoomX, zoomY, alpha, blendMode, mirrorX, mirrorY);
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSurface::create(int Width, int Height) {
- return E_FAIL;
+ERRORCODE CBSurface::create(int Width, int Height) {
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSurface::startPixelOp() {
- return E_FAIL;
+ERRORCODE CBSurface::startPixelOp() {
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSurface::endPixelOp() {
- return E_FAIL;
+ERRORCODE CBSurface::endPixelOp() {
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSurface::getPixel(int x, int y, byte *r, byte *g, byte *b, byte *a) {
- return E_FAIL;
+ERRORCODE CBSurface::getPixel(int x, int y, byte *r, byte *g, byte *b, byte *a) {
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSurface::putPixel(int x, int y, byte r, byte g, byte b, int a) {
- return E_FAIL;
+ERRORCODE CBSurface::putPixel(int x, int y, byte r, byte g, byte b, int a) {
+ return STATUS_FAILED;
}
@@ -127,20 +127,20 @@ bool CBSurface::isTransparentAtLite(int x, int y) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSurface::invalidate() {
- return E_FAIL;
+ERRORCODE CBSurface::invalidate() {
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSurface::prepareToDraw() {
+ERRORCODE CBSurface::prepareToDraw() {
_lastUsedTime = Game->_liveTimer;
if (!_valid) {
//Game->LOG(0, "Reviving: %s", _filename);
return create(_filename, _cKDefault, _cKRed, _cKGreen, _cKBlue, _lifeTime, _keepLoaded);
- } else return S_OK;
+ } else return STATUS_OK;
}
diff --git a/engines/wintermute/Base/BSurface.h b/engines/wintermute/Base/BSurface.h
index 9962b095c3..6a4dd89af6 100644
--- a/engines/wintermute/Base/BSurface.h
+++ b/engines/wintermute/Base/BSurface.h
@@ -36,8 +36,8 @@ namespace WinterMute {
class CBSurface: public CBBase {
public:
- virtual HRESULT invalidate();
- virtual HRESULT prepareToDraw();
+ virtual ERRORCODE invalidate();
+ virtual ERRORCODE prepareToDraw();
bool _cKDefault;
byte _cKRed;
byte _cKGreen;
@@ -52,25 +52,25 @@ public:
CBSurface(CBGame *inGame);
virtual ~CBSurface();
- virtual HRESULT displayHalfTrans(int x, int y, RECT rect);
+ virtual ERRORCODE displayHalfTrans(int x, int y, RECT rect);
virtual bool isTransparentAt(int x, int y);
- virtual HRESULT displayTransZoom(int x, int y, RECT rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0;
- virtual HRESULT displayTrans(int x, int y, RECT rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0;
- virtual HRESULT displayTransOffset(int x, int y, RECT rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0) = 0;
- virtual HRESULT display(int x, int y, RECT rect, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool MirrorY = false) = 0;
- virtual HRESULT displayZoom(int x, int y, RECT rect, float ZoomX, float ZoomY, uint32 alpha = 0xFFFFFFFF, bool transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0;
- virtual HRESULT displayTransform(int x, int y, int hotX, int hotY, RECT rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0;
- virtual HRESULT restore();
- virtual HRESULT create(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime = -1, bool keepLoaded = false) = 0;
- virtual HRESULT create(int Width, int Height);
- virtual HRESULT putSurface(const Graphics::Surface &surface, bool hasAlpha = false) {
- return E_FAIL;
+ virtual ERRORCODE displayTransZoom(int x, int y, RECT rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0;
+ virtual ERRORCODE displayTrans(int x, int y, RECT rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0;
+ virtual ERRORCODE displayTransOffset(int x, int y, RECT rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0) = 0;
+ virtual ERRORCODE display(int x, int y, RECT rect, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool MirrorY = false) = 0;
+ virtual ERRORCODE displayZoom(int x, int y, RECT rect, float ZoomX, float ZoomY, uint32 alpha = 0xFFFFFFFF, bool transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0;
+ virtual ERRORCODE displayTransform(int x, int y, int hotX, int hotY, RECT rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0;
+ virtual ERRORCODE restore();
+ virtual ERRORCODE create(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime = -1, bool keepLoaded = false) = 0;
+ virtual ERRORCODE create(int Width, int Height);
+ virtual ERRORCODE putSurface(const Graphics::Surface &surface, bool hasAlpha = false) {
+ return STATUS_FAILED;
}
- virtual HRESULT putPixel(int x, int y, byte r, byte g, byte b, int a = -1);
- virtual HRESULT getPixel(int x, int y, byte *r, byte *g, byte *b, byte *a = NULL);
+ virtual ERRORCODE putPixel(int x, int y, byte r, byte g, byte b, int a = -1);
+ virtual ERRORCODE getPixel(int x, int y, byte *r, byte *g, byte *b, byte *a = NULL);
virtual bool comparePixel(int x, int y, byte r, byte g, byte b, int a = -1);
- virtual HRESULT startPixelOp();
- virtual HRESULT endPixelOp();
+ virtual ERRORCODE startPixelOp();
+ virtual ERRORCODE endPixelOp();
virtual bool isTransparentAtLite(int x, int y);
void setFilename(const char *filename);
void setSize(int width, int height);
diff --git a/engines/wintermute/Base/BSurfaceSDL.cpp b/engines/wintermute/Base/BSurfaceSDL.cpp
index de61d638a0..27bd7fd334 100644
--- a/engines/wintermute/Base/BSurfaceSDL.cpp
+++ b/engines/wintermute/Base/BSurfaceSDL.cpp
@@ -90,7 +90,7 @@ bool hasTransparency(Graphics::Surface *surf) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSurfaceSDL::create(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) {
+ERRORCODE CBSurfaceSDL::create(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) {
/* CBRenderSDL *renderer = static_cast<CBRenderSDL *>(Game->_renderer); */
Common::String strFileName(filename);
CBImage *image = new CBImage(Game);
@@ -177,7 +177,7 @@ HRESULT CBSurfaceSDL::create(const char *filename, bool defaultCK, byte ckRed, b
if (!_texture) {
SDL_FreeSurface(surf);
delete imgDecoder;
- return E_FAIL;
+ return STATUS_FAILED;
}
GenAlphaMask(surf);
@@ -207,7 +207,7 @@ HRESULT CBSurfaceSDL::create(const char *filename, bool defaultCK, byte ckRed, b
delete image;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -293,7 +293,7 @@ uint32 CBSurfaceSDL::getPixel(Graphics::Surface *surface, int x, int y) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSurfaceSDL::create(int width, int height) {
+ERRORCODE CBSurfaceSDL::create(int width, int height) {
warning("SurfaceSDL::Create not ported yet"); //TODO
#if 0
CBRenderSDL *renderer = static_cast<CBRenderSDL *>(Game->_renderer);
@@ -306,11 +306,11 @@ HRESULT CBSurfaceSDL::create(int width, int height) {
_valid = true;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSurfaceSDL::createFromSDLSurface(Graphics::Surface *surface) {
+ERRORCODE CBSurfaceSDL::createFromSDLSurface(Graphics::Surface *surface) {
warning("CBSurfaceSDL::CreateFromSDLSurface not ported yet"); //TODO
#if 0
CBRenderSDL *renderer = static_cast<CBRenderSDL *>(Game->_renderer);
@@ -330,7 +330,7 @@ HRESULT CBSurfaceSDL::createFromSDLSurface(Graphics::Surface *surface) {
#endif
_valid = true;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -407,56 +407,56 @@ bool CBSurfaceSDL::isTransparentAtLite(int x, int y) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSurfaceSDL::startPixelOp() {
+ERRORCODE CBSurfaceSDL::startPixelOp() {
//SDL_LockTexture(_texture, NULL, &_lockPixels, &_lockPitch);
// Any pixel-op makes the caching useless:
CBRenderSDL *renderer = static_cast<CBRenderSDL *>(Game->_renderer);
renderer->invalidateTicketsFromSurface(this);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSurfaceSDL::endPixelOp() {
+ERRORCODE CBSurfaceSDL::endPixelOp() {
//SDL_UnlockTexture(_texture);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSurfaceSDL::display(int x, int y, RECT rect, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
+ERRORCODE CBSurfaceSDL::display(int x, int y, RECT rect, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
return drawSprite(x, y, &rect, 100, 100, 0xFFFFFFFF, true, blendMode, mirrorX, mirrorY);
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSurfaceSDL::displayTrans(int x, int y, RECT rect, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
+ERRORCODE CBSurfaceSDL::displayTrans(int x, int y, RECT rect, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
return drawSprite(x, y, &rect, 100, 100, alpha, false, blendMode, mirrorX, mirrorY);
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSurfaceSDL::displayTransOffset(int x, int y, RECT rect, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX, int offsetY) {
+ERRORCODE CBSurfaceSDL::displayTransOffset(int x, int y, RECT rect, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX, int offsetY) {
return drawSprite(x, y, &rect, 100, 100, alpha, false, blendMode, mirrorX, mirrorY, offsetX, offsetY);
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSurfaceSDL::displayTransZoom(int x, int y, RECT rect, float zoomX, float zoomY, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
+ERRORCODE CBSurfaceSDL::displayTransZoom(int x, int y, RECT rect, float zoomX, float zoomY, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
return drawSprite(x, y, &rect, zoomX, zoomY, alpha, false, blendMode, mirrorX, mirrorY);
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSurfaceSDL::displayZoom(int x, int y, RECT rect, float zoomX, float zoomY, uint32 alpha, bool Transparent, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
+ERRORCODE CBSurfaceSDL::displayZoom(int x, int y, RECT rect, float zoomX, float zoomY, uint32 alpha, bool Transparent, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
return drawSprite(x, y, &rect, zoomX, zoomY, alpha, !Transparent, blendMode, mirrorX, mirrorY);
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSurfaceSDL::displayTransform(int x, int y, int hotX, int hotY, RECT rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
+ERRORCODE CBSurfaceSDL::displayTransform(int x, int y, int hotX, int hotY, RECT rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) {
return drawSprite(x, y, &rect, zoomX, zoomY, alpha, false, blendMode, mirrorX, mirrorY);
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSurfaceSDL::drawSprite(int x, int y, RECT *rect, float zoomX, float zoomY, uint32 alpha, bool alphaDisable, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX, int offsetY) {
+ERRORCODE CBSurfaceSDL::drawSprite(int x, int y, RECT *rect, float zoomX, float zoomY, uint32 alpha, bool alphaDisable, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX, int offsetY) {
CBRenderSDL *renderer = static_cast<CBRenderSDL *>(Game->_renderer);
if (renderer->_forceAlphaColor != 0) alpha = renderer->_forceAlphaColor;
@@ -469,10 +469,10 @@ HRESULT CBSurfaceSDL::drawSprite(int x, int y, RECT *rect, float zoomX, float zo
hasWarned = true;
}
- byte r = D3DCOLGetR(alpha);
- byte g = D3DCOLGetG(alpha);
- byte b = D3DCOLGetB(alpha);
- byte a = D3DCOLGetA(alpha);
+ byte r = RGBCOLGetR(alpha);
+ byte g = RGBCOLGetG(alpha);
+ byte b = RGBCOLGetB(alpha);
+ byte a = RGBCOLGetA(alpha);
renderer->setAlphaMod(a);
renderer->setColorMod(r, g, b);
@@ -531,16 +531,16 @@ HRESULT CBSurfaceSDL::drawSprite(int x, int y, RECT *rect, float zoomX, float zo
SDL_RenderCopy(renderer->GetSdlRenderer(), _texture, &srcRect, &position);
#endif
- return S_OK;
+ return STATUS_OK;
}
-HRESULT CBSurfaceSDL::putSurface(const Graphics::Surface &surface, bool hasAlpha) {
+ERRORCODE CBSurfaceSDL::putSurface(const Graphics::Surface &surface, bool hasAlpha) {
_surface->copyFrom(surface);
_hasAlpha = hasAlpha;
CBRenderSDL *renderer = static_cast<CBRenderSDL *>(Game->_renderer);
renderer->invalidateTicketsFromSurface(this);
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Base/BSurfaceSDL.h b/engines/wintermute/Base/BSurfaceSDL.h
index 50ce364beb..544473ced5 100644
--- a/engines/wintermute/Base/BSurfaceSDL.h
+++ b/engines/wintermute/Base/BSurfaceSDL.h
@@ -40,25 +40,25 @@ public:
CBSurfaceSDL(CBGame *inGame);
~CBSurfaceSDL();
- HRESULT create(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime = -1, bool keepLoaded = false);
- HRESULT create(int width, int height);
+ ERRORCODE create(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime = -1, bool keepLoaded = false);
+ ERRORCODE create(int width, int height);
- HRESULT createFromSDLSurface(Graphics::Surface *surface); //TODO: Rename function
+ ERRORCODE createFromSDLSurface(Graphics::Surface *surface); //TODO: Rename function
bool isTransparentAt(int x, int y);
bool isTransparentAtLite(int x, int y);
- HRESULT startPixelOp();
- HRESULT endPixelOp();
+ ERRORCODE startPixelOp();
+ ERRORCODE endPixelOp();
- HRESULT displayTransZoom(int x, int y, RECT rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false);
- HRESULT displayTrans(int x, int y, RECT rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false);
- HRESULT displayTransOffset(int x, int y, RECT rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0);
- HRESULT display(int x, int y, RECT rect, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false);
- HRESULT displayZoom(int x, int y, RECT rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, bool Transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false);
- HRESULT displayTransform(int x, int y, int hotX, int hotY, RECT Rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false);
- virtual HRESULT putSurface(const Graphics::Surface &surface, bool hasAlpha = false);
+ ERRORCODE displayTransZoom(int x, int y, RECT rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false);
+ ERRORCODE displayTrans(int x, int y, RECT rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false);
+ ERRORCODE displayTransOffset(int x, int y, RECT rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0);
+ ERRORCODE display(int x, int y, RECT rect, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false);
+ ERRORCODE displayZoom(int x, int y, RECT rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, bool Transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false);
+ ERRORCODE displayTransform(int x, int y, int hotX, int hotY, RECT Rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false);
+ virtual ERRORCODE putSurface(const Graphics::Surface &surface, bool hasAlpha = false);
/* static unsigned DLL_CALLCONV ReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle);
static int DLL_CALLCONV SeekProc(fi_handle handle, long offset, int origin);
static long DLL_CALLCONV TellProc(fi_handle handle);*/
@@ -78,7 +78,7 @@ public:
private:
Graphics::Surface *_surface;
- HRESULT drawSprite(int x, int y, RECT *rect, float zoomX, float zoomY, uint32 alpha, bool alphaDisable, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX = 0, int offsetY = 0);
+ ERRORCODE drawSprite(int x, int y, RECT *rect, float zoomX, float zoomY, uint32 alpha, bool alphaDisable, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX = 0, int offsetY = 0);
void genAlphaMask(Graphics::Surface *surface);
uint32 getPixel(Graphics::Surface *surface, int x, int y);
diff --git a/engines/wintermute/Base/BSurfaceStorage.cpp b/engines/wintermute/Base/BSurfaceStorage.cpp
index d6009ac9e3..eedfbca178 100644
--- a/engines/wintermute/Base/BSurfaceStorage.cpp
+++ b/engines/wintermute/Base/BSurfaceStorage.cpp
@@ -51,19 +51,19 @@ CBSurfaceStorage::~CBSurfaceStorage() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSurfaceStorage::cleanup(bool warn) {
+ERRORCODE CBSurfaceStorage::cleanup(bool warn) {
for (int i = 0; i < _surfaces.GetSize(); i++) {
if (warn) Game->LOG(0, "CBSurfaceStorage warning: purging surface '%s', usage:%d", _surfaces[i]->_filename, _surfaces[i]->_referenceCount);
delete _surfaces[i];
}
_surfaces.RemoveAll();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSurfaceStorage::initLoop() {
+ERRORCODE CBSurfaceStorage::initLoop() {
if (Game->_smartCache && Game->_liveTimer - _lastCleanupTime >= Game->_surfaceGCCycleTime) {
_lastCleanupTime = Game->_liveTimer;
sortSurfaces();
@@ -76,12 +76,12 @@ HRESULT CBSurfaceStorage::initLoop() {
}
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////
-HRESULT CBSurfaceStorage::removeSurface(CBSurface *surface) {
+ERRORCODE CBSurfaceStorage::removeSurface(CBSurface *surface) {
for (int i = 0; i < _surfaces.GetSize(); i++) {
if (_surfaces[i] == surface) {
_surfaces[i]->_referenceCount--;
@@ -92,7 +92,7 @@ HRESULT CBSurfaceStorage::removeSurface(CBSurface *surface) {
break;
}
}
- return S_OK;
+ return STATUS_OK;
}
@@ -118,7 +118,7 @@ CBSurface *CBSurfaceStorage::addSurface(const char *filename, bool defaultCK, by
if (!surface) return NULL;
- if (FAILED(surface->create(filename, defaultCK, ckRed, ckGreen, ckBlue, lifeTime, keepLoaded))) {
+ if (DID_FAIL(surface->create(filename, defaultCK, ckRed, ckGreen, ckBlue, lifeTime, keepLoaded))) {
delete surface;
return NULL;
} else {
@@ -130,22 +130,22 @@ CBSurface *CBSurfaceStorage::addSurface(const char *filename, bool defaultCK, by
//////////////////////////////////////////////////////////////////////
-HRESULT CBSurfaceStorage::restoreAll() {
- HRESULT ret;
+ERRORCODE CBSurfaceStorage::restoreAll() {
+ ERRORCODE ret;
for (int i = 0; i < _surfaces.GetSize(); i++) {
ret = _surfaces[i]->restore();
- if (ret != S_OK) {
+ if (ret != STATUS_OK) {
Game->LOG(0, "CBSurfaceStorage::RestoreAll failed");
return ret;
}
}
- return S_OK;
+ return STATUS_OK;
}
/*
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSurfaceStorage::persist(CBPersistMgr *persistMgr)
+ERRORCODE CBSurfaceStorage::persist(CBPersistMgr *persistMgr)
{
if(!persistMgr->_saving) cleanup(false);
@@ -154,15 +154,15 @@ HRESULT CBSurfaceStorage::persist(CBPersistMgr *persistMgr)
//_surfaces.persist(persistMgr);
- return S_OK;
+ return STATUS_OK;
}
*/
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSurfaceStorage::sortSurfaces() {
+ERRORCODE CBSurfaceStorage::sortSurfaces() {
qsort(_surfaces.GetData(), _surfaces.GetSize(), sizeof(CBSurface *), surfaceSortCB);
- return S_OK;
+ return STATUS_OK;
}
diff --git a/engines/wintermute/Base/BSurfaceStorage.h b/engines/wintermute/Base/BSurfaceStorage.h
index cb000cf38c..d93c82bf19 100644
--- a/engines/wintermute/Base/BSurfaceStorage.h
+++ b/engines/wintermute/Base/BSurfaceStorage.h
@@ -38,15 +38,15 @@ class CBSurface;
class CBSurfaceStorage : public CBBase {
public:
uint32 _lastCleanupTime;
- HRESULT initLoop();
- HRESULT sortSurfaces();
+ ERRORCODE initLoop();
+ ERRORCODE sortSurfaces();
static int surfaceSortCB(const void *arg1, const void *arg2);
- HRESULT cleanup(bool Warn = false);
+ ERRORCODE cleanup(bool Warn = false);
//DECLARE_PERSISTENT(CBSurfaceStorage, CBBase);
- HRESULT restoreAll();
+ ERRORCODE restoreAll();
CBSurface *addSurface(const char *filename, bool defaultCK = true, byte ckRed = 0, byte ckGreen = 0, byte ckBlue = 0, int lifeTime = -1, bool keepLoaded = false);
- HRESULT removeSurface(CBSurface *surface);
+ ERRORCODE removeSurface(CBSurface *surface);
CBSurfaceStorage(CBGame *inGame);
virtual ~CBSurfaceStorage();
diff --git a/engines/wintermute/Base/BTransitionMgr.cpp b/engines/wintermute/Base/BTransitionMgr.cpp
index 02d6891528..778ac33a3f 100644
--- a/engines/wintermute/Base/BTransitionMgr.cpp
+++ b/engines/wintermute/Base/BTransitionMgr.cpp
@@ -58,12 +58,12 @@ bool CBTransitionMgr::isReady() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBTransitionMgr::start(TTransitionType type, bool nonInteractive) {
- if (_state != TRANS_MGR_READY) return S_OK;
+ERRORCODE CBTransitionMgr::start(TTransitionType type, bool nonInteractive) {
+ if (_state != TRANS_MGR_READY) return STATUS_OK;
if (type == TRANSITION_NONE || type >= NUM_TRANSITION_TYPES) {
_state = TRANS_MGR_READY;
- return S_OK;
+ return STATUS_OK;
}
if (nonInteractive) {
@@ -77,14 +77,14 @@ HRESULT CBTransitionMgr::start(TTransitionType type, bool nonInteractive) {
_state = TRANS_MGR_RUNNING;
_started = false;
- return S_OK;
+ return STATUS_OK;
}
#define FADE_DURATION 200
//////////////////////////////////////////////////////////////////////////
-HRESULT CBTransitionMgr::update() {
- if (isReady()) return S_OK;
+ERRORCODE CBTransitionMgr::update() {
+ if (isReady()) return STATUS_OK;
if (!_started) {
_started = true;
@@ -125,7 +125,7 @@ HRESULT CBTransitionMgr::update() {
if (_preserveInteractive)
Game->_interactive = _origInteractive;
}
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Base/BTransitionMgr.h b/engines/wintermute/Base/BTransitionMgr.h
index 11949cf8a3..5999ac3391 100644
--- a/engines/wintermute/Base/BTransitionMgr.h
+++ b/engines/wintermute/Base/BTransitionMgr.h
@@ -39,8 +39,8 @@ public:
uint32 _lastTime;
bool _origInteractive;
bool _preserveInteractive;
- HRESULT update();
- HRESULT start(TTransitionType type, bool nonInteractive = false);
+ ERRORCODE update();
+ ERRORCODE start(TTransitionType type, bool nonInteractive = false);
bool isReady();
TTransMgrState _state;
CBTransitionMgr(CBGame *inGame);
diff --git a/engines/wintermute/Base/BViewport.cpp b/engines/wintermute/Base/BViewport.cpp
index 64e138cb33..7542e6bbfc 100644
--- a/engines/wintermute/Base/BViewport.cpp
+++ b/engines/wintermute/Base/BViewport.cpp
@@ -49,7 +49,7 @@ CBViewport::~CBViewport() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBViewport::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CBViewport::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(Game));
@@ -58,12 +58,12 @@ HRESULT CBViewport::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(_offsetY));
persistMgr->transfer(TMEMBER(_rect));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBViewport::setRect(int left, int top, int right, int bottom, bool noCheck) {
+ERRORCODE CBViewport::setRect(int left, int top, int right, int bottom, bool noCheck) {
if (!noCheck) {
left = MAX(left, 0);
top = MAX(top, 0);
@@ -74,7 +74,7 @@ HRESULT CBViewport::setRect(int left, int top, int right, int bottom, bool noChe
CBPlatform::setRect(&_rect, left, top, right, bottom);
_offsetX = left;
_offsetY = top;
- return S_OK;
+ return STATUS_OK;
}
diff --git a/engines/wintermute/Base/BViewport.h b/engines/wintermute/Base/BViewport.h
index 0360cb9957..f2e960943a 100644
--- a/engines/wintermute/Base/BViewport.h
+++ b/engines/wintermute/Base/BViewport.h
@@ -39,7 +39,7 @@ public:
int getHeight();
int getWidth();
RECT *getRect();
- HRESULT setRect(int left, int top, int right, int bottom, bool noCheck = false);
+ ERRORCODE setRect(int left, int top, int right, int bottom, bool noCheck = false);
DECLARE_PERSISTENT(CBViewport, CBBase)
int _offsetY;
int _offsetX;
diff --git a/engines/wintermute/Base/PartEmitter.cpp b/engines/wintermute/Base/PartEmitter.cpp
index b5e12ca6d2..a07b5a90c7 100644
--- a/engines/wintermute/Base/PartEmitter.cpp
+++ b/engines/wintermute/Base/PartEmitter.cpp
@@ -116,44 +116,44 @@ CPartEmitter::~CPartEmitter(void) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CPartEmitter::addSprite(const char *filename) {
- if (!filename) return E_FAIL;
+ERRORCODE CPartEmitter::addSprite(const char *filename) {
+ if (!filename) return STATUS_FAILED;
// do we already have the file?
for (int i = 0; i < _sprites.GetSize(); i++) {
- if (scumm_stricmp(filename, _sprites[i]) == 0) return S_OK;
+ if (scumm_stricmp(filename, _sprites[i]) == 0) return STATUS_OK;
}
// check if file exists
Common::SeekableReadStream *File = Game->_fileManager->openFile(filename);
if (!File) {
Game->LOG(0, "Sprite '%s' not found", filename);
- return E_FAIL;
+ return STATUS_FAILED;
} else Game->_fileManager->closeFile(File);
char *Str = new char[strlen(filename) + 1];
strcpy(Str, filename);
_sprites.Add(Str);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CPartEmitter::removeSprite(const char *filename) {
+ERRORCODE CPartEmitter::removeSprite(const char *filename) {
for (int i = 0; i < _sprites.GetSize(); i++) {
if (scumm_stricmp(filename, _sprites[i]) == 0) {
delete [] _sprites[i];
_sprites.RemoveAt(i);
- return S_OK;
+ return STATUS_OK;
}
}
- return E_FAIL;
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CPartEmitter::initParticle(CPartParticle *particle, uint32 currentTime, uint32 timerDelta) {
- if (!particle) return E_FAIL;
- if (_sprites.GetSize() == 0) return E_FAIL;
+ERRORCODE CPartEmitter::initParticle(CPartParticle *particle, uint32 currentTime, uint32 timerDelta) {
+ if (!particle) return STATUS_FAILED;
+ if (_sprites.GetSize() == 0) return STATUS_FAILED;
int posX = CBUtils::randomInt(_posX, _posX + _width);
int posY = CBUtils::randomInt(_posY, _posY + _height);
@@ -217,22 +217,22 @@ HRESULT CPartEmitter::initParticle(CPartParticle *particle, uint32 currentTime,
particle->_angVelocity = angVelocity;
particle->_growthRate = growthRate;
particle->_exponentialGrowth = _exponentialGrowth;
- particle->_isDead = FAILED(particle->setSprite(_sprites[spriteIndex]));
+ particle->_isDead = DID_FAIL(particle->setSprite(_sprites[spriteIndex]));
particle->fadeIn(currentTime, _fadeInTime);
- if (particle->_isDead) return E_FAIL;
- else return S_OK;
+ if (particle->_isDead) return STATUS_FAILED;
+ else return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CPartEmitter::update() {
- if (!_running) return S_OK;
+ERRORCODE CPartEmitter::update() {
+ if (!_running) return STATUS_OK;
else return updateInternal(Game->_timer, Game->_timerDelta);
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CPartEmitter::updateInternal(uint32 currentTime, uint32 timerDelta) {
+ERRORCODE CPartEmitter::updateInternal(uint32 currentTime, uint32 timerDelta) {
int numLive = 0;
for (int i = 0; i < _particles.GetSize(); i++) {
@@ -250,7 +250,7 @@ HRESULT CPartEmitter::updateInternal(uint32 currentTime, uint32 timerDelta) {
_batchesGenerated++;
if (_maxBatches > 0 && _batchesGenerated > _maxBatches) {
- return S_OK;
+ return STATUS_OK;
}
int toGen = MIN(_genAmount, _maxParticles - numLive);
@@ -284,11 +284,11 @@ HRESULT CPartEmitter::updateInternal(uint32 currentTime, uint32 timerDelta) {
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CPartEmitter::display(CBRegion *region) {
+ERRORCODE CPartEmitter::display(CBRegion *region) {
if (_sprites.GetSize() <= 1) Game->_renderer->startSpriteBatch();
for (int i = 0; i < _particles.GetSize(); i++) {
@@ -301,11 +301,11 @@ HRESULT CPartEmitter::display(CBRegion *region) {
if (_sprites.GetSize() <= 1) Game->_renderer->endSpriteBatch();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CPartEmitter::start() {
+ERRORCODE CPartEmitter::start() {
for (int i = 0; i < _particles.GetSize(); i++) {
_particles[i]->_isDead = true;
}
@@ -325,14 +325,14 @@ HRESULT CPartEmitter::start() {
_overheadTime = 0;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CPartEmitter::sortParticlesByZ() {
+ERRORCODE CPartEmitter::sortParticlesByZ() {
// sort particles by _posY
qsort(_particles.GetData(), _particles.GetSize(), sizeof(CPartParticle *), CPartEmitter::compareZ);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -346,20 +346,20 @@ int CPartEmitter::compareZ(const void *obj1, const void *obj2) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CPartEmitter::setBorder(int x, int y, int width, int height) {
+ERRORCODE CPartEmitter::setBorder(int x, int y, int width, int height) {
CBPlatform::setRect(&_border, x, y, x + width, y + height);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CPartEmitter::setBorderThickness(int thicknessLeft, int thicknessRight, int thicknessTop, int thicknessBottom) {
+ERRORCODE CPartEmitter::setBorderThickness(int thicknessLeft, int thicknessRight, int thicknessTop, int thicknessBottom) {
_borderThicknessLeft = thicknessLeft;
_borderThicknessRight = thicknessRight;
_borderThicknessTop = thicknessTop;
_borderThicknessBottom = thicknessBottom;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -384,9 +384,9 @@ CPartForce *CPartEmitter::addForceByName(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CPartEmitter::addForce(const char *name, CPartForce::TForceType type, int posX, int posY, float angle, float strength) {
+ERRORCODE CPartEmitter::addForce(const char *name, CPartForce::TForceType type, int posX, int posY, float angle, float strength) {
CPartForce *force = addForceByName(name);
- if (!force) return E_FAIL;
+ if (!force) return STATUS_FAILED;
force->_type = type;
force->_pos = Vector2(posX, posY);
@@ -396,26 +396,26 @@ HRESULT CPartEmitter::addForce(const char *name, CPartForce::TForceType type, in
matRot.rotationZ(Common::deg2rad(CBUtils::normalizeAngle(angle - 180)));
matRot.transformVector2(force->_direction);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CPartEmitter::removeForce(const char *name) {
+ERRORCODE CPartEmitter::removeForce(const char *name) {
for (int i = 0; i < _forces.GetSize(); i++) {
if (scumm_stricmp(name, _forces[i]->_name) == 0) {
delete _forces[i];
_forces.RemoveAt(i);
- return S_OK;
+ return STATUS_OK;
}
}
- return E_FAIL;
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-HRESULT CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// SetBorder
//////////////////////////////////////////////////////////////////////////
@@ -426,9 +426,9 @@ HRESULT CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack
int borderWidth = stack->pop()->getInt();
int borderHeight = stack->pop()->getInt();
- stack->pushBool(SUCCEEDED(setBorder(borderX, borderY, borderWidth, borderHeight)));
+ stack->pushBool(DID_SUCCEED(setBorder(borderX, borderY, borderWidth, borderHeight)));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// SetBorderThickness
@@ -440,9 +440,9 @@ HRESULT CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack
int top = stack->pop()->getInt();
int bottom = stack->pop()->getInt();
- stack->pushBool(SUCCEEDED(setBorderThickness(left, right, top, bottom)));
+ stack->pushBool(DID_SUCCEED(setBorderThickness(left, right, top, bottom)));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// AddSprite
@@ -450,9 +450,9 @@ HRESULT CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack
else if (strcmp(name, "AddSprite") == 0) {
stack->correctParams(1);
const char *spriteFile = stack->pop()->getString();
- stack->pushBool(SUCCEEDED(addSprite(spriteFile)));
+ stack->pushBool(DID_SUCCEED(addSprite(spriteFile)));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// RemoveSprite
@@ -460,9 +460,9 @@ HRESULT CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack
else if (strcmp(name, "RemoveSprite") == 0) {
stack->correctParams(1);
const char *spriteFile = stack->pop()->getString();
- stack->pushBool(SUCCEEDED(removeSprite(spriteFile)));
+ stack->pushBool(DID_SUCCEED(removeSprite(spriteFile)));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -471,9 +471,9 @@ HRESULT CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack
else if (strcmp(name, "Start") == 0) {
stack->correctParams(1);
_overheadTime = stack->pop()->getInt();
- stack->pushBool(SUCCEEDED(start()));
+ stack->pushBool(DID_SUCCEED(start()));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -490,7 +490,7 @@ HRESULT CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack
_running = false;
stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -501,7 +501,7 @@ HRESULT CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack
_running = false;
stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -512,7 +512,7 @@ HRESULT CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack
_running = true;
stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -524,9 +524,9 @@ HRESULT CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack
float angle = stack->pop()->getFloat();
float strength = stack->pop()->getFloat();
- stack->pushBool(SUCCEEDED(addForce(forceName, CPartForce::FORCE_GLOBAL, 0, 0, angle, strength)));
+ stack->pushBool(DID_SUCCEED(addForce(forceName, CPartForce::FORCE_GLOBAL, 0, 0, angle, strength)));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -540,9 +540,9 @@ HRESULT CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack
float angle = stack->pop()->getFloat();
float strength = stack->pop()->getFloat();
- stack->pushBool(SUCCEEDED(addForce(forceName, CPartForce::FORCE_GLOBAL, posX, posY, angle, strength)));
+ stack->pushBool(DID_SUCCEED(addForce(forceName, CPartForce::FORCE_GLOBAL, posX, posY, angle, strength)));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -552,9 +552,9 @@ HRESULT CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack
stack->correctParams(1);
const char *forceName = stack->pop()->getString();
- stack->pushBool(SUCCEEDED(removeForce(forceName)));
+ stack->pushBool(DID_SUCCEED(removeForce(forceName)));
- return S_OK;
+ return STATUS_OK;
}
else return CBObject::scCallMethod(script, stack, thisStack, name);
@@ -833,34 +833,34 @@ CScValue *CPartEmitter::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CPartEmitter::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CPartEmitter::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
// X
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "X") == 0) {
_posX = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// Y
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Y") == 0) {
_posY = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// Width
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Width") == 0) {
_width = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// Height
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Height") == 0) {
_height = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -868,21 +868,21 @@ HRESULT CPartEmitter::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Scale1") == 0) {
_scale1 = value->getFloat();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// Scale2
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Scale2") == 0) {
_scale2 = value->getFloat();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// ScaleZBased
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ScaleZBased") == 0) {
_scaleZBased = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -890,21 +890,21 @@ HRESULT CPartEmitter::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Velocity1") == 0) {
_velocity1 = value->getFloat();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// Velocity2
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Velocity2") == 0) {
_velocity2 = value->getFloat();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// VelocityZBased
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "VelocityZBased") == 0) {
_velocityZBased = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -912,21 +912,21 @@ HRESULT CPartEmitter::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "LifeTime1") == 0) {
_lifeTime1 = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// LifeTime2
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "LifeTime2") == 0) {
_lifeTime2 = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// LifeTimeZBased
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "LifeTimeZBased") == 0) {
_lifeTimeZBased = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -934,14 +934,14 @@ HRESULT CPartEmitter::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Angle1") == 0) {
_angle1 = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// Angle2
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Angle2") == 0) {
_angle2 = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -949,14 +949,14 @@ HRESULT CPartEmitter::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "AngVelocity1") == 0) {
_angVelocity1 = value->getFloat();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// AngVelocity2
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "AngVelocity2") == 0) {
_angVelocity2 = value->getFloat();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -964,14 +964,14 @@ HRESULT CPartEmitter::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Rotation1") == 0) {
_rotation1 = value->getFloat();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// Rotation2
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Rotation2") == 0) {
_rotation2 = value->getFloat();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -981,7 +981,7 @@ HRESULT CPartEmitter::scSetProperty(const char *name, CScValue *value) {
_alpha1 = value->getInt();
if (_alpha1 < 0) _alpha1 = 0;
if (_alpha1 > 255) _alpha1 = 255;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// Alpha2
@@ -990,14 +990,14 @@ HRESULT CPartEmitter::scSetProperty(const char *name, CScValue *value) {
_alpha2 = value->getInt();
if (_alpha2 < 0) _alpha2 = 0;
if (_alpha2 > 255) _alpha2 = 255;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// AlphaTimeBased
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "AlphaTimeBased") == 0) {
_alphaTimeBased = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1005,7 +1005,7 @@ HRESULT CPartEmitter::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "MaxParticles") == 0) {
_maxParticles = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1013,21 +1013,21 @@ HRESULT CPartEmitter::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GenerationInterval") == 0) {
_genInterval = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// GenerationAmount
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GenerationAmount") == 0) {
_genAmount = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// MaxBatches
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "MaxBatches") == 0) {
_maxBatches = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1035,14 +1035,14 @@ HRESULT CPartEmitter::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "FadeInTime") == 0) {
_fadeInTime = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// FadeOutTime
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "FadeOutTime") == 0) {
_fadeOutTime = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1050,21 +1050,21 @@ HRESULT CPartEmitter::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GrowthRate1") == 0) {
_growthRate1 = value->getFloat();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// GrowthRate2
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GrowthRate2") == 0) {
_growthRate2 = value->getFloat();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// ExponentialGrowth
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ExponentialGrowth") == 0) {
_exponentialGrowth = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1072,7 +1072,7 @@ HRESULT CPartEmitter::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "UseRegion") == 0) {
_useRegion = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1082,7 +1082,7 @@ HRESULT CPartEmitter::scSetProperty(const char *name, CScValue *value) {
delete[] _emitEvent;
_emitEvent = NULL;
if (!value->isNULL()) CBUtils::setString(&_emitEvent, value->getString());
- return S_OK;
+ return STATUS_OK;
}
else return CBObject::scSetProperty(name, value);
@@ -1098,7 +1098,7 @@ const char *CPartEmitter::scToString() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CPartEmitter::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CPartEmitter::persist(CBPersistMgr *persistMgr) {
CBObject::persist(persistMgr);
persistMgr->transfer(TMEMBER(_width));
@@ -1193,7 +1193,7 @@ HRESULT CPartEmitter::persist(CBPersistMgr *persistMgr) {
}
}
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Base/PartEmitter.h b/engines/wintermute/Base/PartEmitter.h
index 5160b7fb25..984ef78820 100644
--- a/engines/wintermute/Base/PartEmitter.h
+++ b/engines/wintermute/Base/PartEmitter.h
@@ -100,35 +100,35 @@ public:
char *_emitEvent;
CBScriptHolder *_owner;
- HRESULT start();
+ ERRORCODE start();
- HRESULT update();
- HRESULT display() { return display(NULL); } // To avoid shadowing the inherited display-function.
- HRESULT display(CBRegion *region);
+ ERRORCODE update();
+ ERRORCODE display() { return display(NULL); } // To avoid shadowing the inherited display-function.
+ ERRORCODE display(CBRegion *region);
- HRESULT sortParticlesByZ();
- HRESULT addSprite(const char *filename);
- HRESULT removeSprite(const char *filename);
- HRESULT setBorder(int x, int y, int width, int height);
- HRESULT setBorderThickness(int thicknessLeft, int thicknessRight, int thicknessTop, int thicknessBottom);
+ ERRORCODE sortParticlesByZ();
+ ERRORCODE addSprite(const char *filename);
+ ERRORCODE removeSprite(const char *filename);
+ ERRORCODE setBorder(int x, int y, int width, int height);
+ ERRORCODE setBorderThickness(int thicknessLeft, int thicknessRight, int thicknessTop, int thicknessBottom);
- HRESULT addForce(const char *name, CPartForce::TForceType type, int posX, int posY, float angle, float strength);
- HRESULT removeForce(const char *name);
+ ERRORCODE addForce(const char *name, CPartForce::TForceType type, int posX, int posY, float angle, float strength);
+ ERRORCODE removeForce(const char *name);
CBArray<CPartForce *, CPartForce *> _forces;
// scripting interface
virtual CScValue *scGetProperty(const char *name);
- virtual HRESULT scSetProperty(const char *name, CScValue *value);
- virtual HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ERRORCODE scSetProperty(const char *name, CScValue *value);
+ virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
virtual const char *scToString();
private:
CPartForce *addForceByName(const char *name);
int static compareZ(const void *obj1, const void *obj2);
- HRESULT initParticle(CPartParticle *particle, uint32 currentTime, uint32 timerDelta);
- HRESULT updateInternal(uint32 currentTime, uint32 timerDelta);
+ ERRORCODE initParticle(CPartParticle *particle, uint32 currentTime, uint32 timerDelta);
+ ERRORCODE updateInternal(uint32 currentTime, uint32 timerDelta);
uint32 _lastGenTime;
CBArray<CPartParticle *, CPartParticle *> _particles;
CBArray<char *, char *> _sprites;
diff --git a/engines/wintermute/Base/PartForce.cpp b/engines/wintermute/Base/PartForce.cpp
index f6be20be93..b60d5447d9 100644
--- a/engines/wintermute/Base/PartForce.cpp
+++ b/engines/wintermute/Base/PartForce.cpp
@@ -47,13 +47,13 @@ CPartForce::~CPartForce(void) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CPartForce::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CPartForce::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(_name));
persistMgr->transfer(TMEMBER(_pos));
persistMgr->transfer(TMEMBER(_direction));
persistMgr->transfer(TMEMBER_INT(_type));
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Base/PartForce.h b/engines/wintermute/Base/PartForce.h
index 548803a4a8..cf5d697a79 100644
--- a/engines/wintermute/Base/PartForce.h
+++ b/engines/wintermute/Base/PartForce.h
@@ -49,7 +49,7 @@ public:
Vector2 _direction;
TForceType _type;
- HRESULT persist(CBPersistMgr *PersistMgr);
+ ERRORCODE persist(CBPersistMgr *PersistMgr);
};
} // end of namespace WinterMute
diff --git a/engines/wintermute/Base/PartParticle.cpp b/engines/wintermute/Base/PartParticle.cpp
index aad7594775..0cf05e88a1 100644
--- a/engines/wintermute/Base/PartParticle.cpp
+++ b/engines/wintermute/Base/PartParticle.cpp
@@ -72,10 +72,10 @@ CPartParticle::~CPartParticle(void) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CPartParticle::setSprite(const char *filename) {
+ERRORCODE CPartParticle::setSprite(const char *filename) {
if (_sprite && _sprite->_filename && scumm_stricmp(filename, _sprite->_filename) == 0) {
_sprite->reset();
- return S_OK;
+ return STATUS_OK;
}
delete _sprite;
@@ -83,34 +83,34 @@ HRESULT CPartParticle::setSprite(const char *filename) {
CSysClassRegistry::getInstance()->_disabled = true;
_sprite = new CBSprite(Game, Game);
- if (_sprite && SUCCEEDED(_sprite->loadFile(filename))) {
+ if (_sprite && DID_SUCCEED(_sprite->loadFile(filename))) {
CSysClassRegistry::getInstance()->_disabled = false;
- return S_OK;
+ return STATUS_OK;
} else {
delete _sprite;
_sprite = NULL;
CSysClassRegistry::getInstance()->_disabled = false;
- return E_FAIL;
+ return STATUS_FAILED;
}
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CPartParticle::update(CPartEmitter *emitter, uint32 currentTime, uint32 timerDelta) {
+ERRORCODE CPartParticle::update(CPartEmitter *emitter, uint32 currentTime, uint32 timerDelta) {
if (_state == PARTICLE_FADEIN) {
if (currentTime - _fadeStart >= (uint32)_fadeTime) {
_state = PARTICLE_NORMAL;
_currentAlpha = _alpha1;
} else _currentAlpha = (int)(((float)currentTime - (float)_fadeStart) / (float)_fadeTime * _alpha1);
- return S_OK;
+ return STATUS_OK;
} else if (_state == PARTICLE_FADEOUT) {
if (currentTime - _fadeStart >= (uint32)_fadeTime) {
_isDead = true;
- return S_OK;
+ return STATUS_OK;
} else _currentAlpha = _fadeStartAlpha - (int)(((float)currentTime - (float)_fadeStart) / (float)_fadeTime * _fadeStartAlpha);
- return S_OK;
+ return STATUS_OK;
} else {
// time is up
if (_lifeTime > 0) {
@@ -130,7 +130,7 @@ HRESULT CPartParticle::update(CPartEmitter *emitter, uint32 currentTime, uint32
if (!CBPlatform::ptInRect(&_border, p))
fadeOut(currentTime, emitter->_fadeOutTime);
}
- if (_state != PARTICLE_NORMAL) return S_OK;
+ if (_state != PARTICLE_NORMAL) return STATUS_OK;
// update alpha
if (_lifeTime > 0) {
@@ -177,48 +177,48 @@ HRESULT CPartParticle::update(CPartEmitter *emitter, uint32 currentTime, uint32
_isDead = true;
- return S_OK;
+ return STATUS_OK;
}
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CPartParticle::display(CPartEmitter *emitter) {
- if (!_sprite) return E_FAIL;
- if (_isDead) return S_OK;
+ERRORCODE CPartParticle::display(CPartEmitter *emitter) {
+ if (!_sprite) return STATUS_FAILED;
+ if (_isDead) return STATUS_OK;
_sprite->GetCurrentFrame();
return _sprite->display(_pos.x, _pos.y,
NULL,
_scale, _scale,
- DRGBA(255, 255, 255, _currentAlpha),
+ BYTETORGBA(255, 255, 255, _currentAlpha),
_rotation,
emitter->_blendMode);
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CPartParticle::fadeIn(uint32 currentTime, int fadeTime) {
+ERRORCODE CPartParticle::fadeIn(uint32 currentTime, int fadeTime) {
_currentAlpha = 0;
_fadeStart = currentTime;
_fadeTime = fadeTime;
_state = PARTICLE_FADEIN;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CPartParticle::fadeOut(uint32 currentTime, int fadeTime) {
+ERRORCODE CPartParticle::fadeOut(uint32 currentTime, int fadeTime) {
//_currentAlpha = 255;
_fadeStartAlpha = _currentAlpha;
_fadeStart = currentTime;
_fadeTime = fadeTime;
_state = PARTICLE_FADEOUT;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CPartParticle::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CPartParticle::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(_alpha1));
persistMgr->transfer(TMEMBER(_alpha2));
persistMgr->transfer(TMEMBER(_border));
@@ -251,7 +251,7 @@ HRESULT CPartParticle::persist(CBPersistMgr *persistMgr) {
filename = NULL;
}
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Base/PartParticle.h b/engines/wintermute/Base/PartParticle.h
index e6a34c8a21..3f495a432b 100644
--- a/engines/wintermute/Base/PartParticle.h
+++ b/engines/wintermute/Base/PartParticle.h
@@ -68,15 +68,15 @@ public:
bool _isDead;
TParticleState _state;
- HRESULT update(CPartEmitter *emitter, uint32 currentTime, uint32 timerDelta);
- HRESULT display(CPartEmitter *emitter);
+ ERRORCODE update(CPartEmitter *emitter, uint32 currentTime, uint32 timerDelta);
+ ERRORCODE display(CPartEmitter *emitter);
- HRESULT setSprite(const char *filename);
+ ERRORCODE setSprite(const char *filename);
- HRESULT fadeIn(uint32 currentTime, int fadeTime);
- HRESULT fadeOut(uint32 currentTime, int fadeTime);
+ ERRORCODE fadeIn(uint32 currentTime, int fadeTime);
+ ERRORCODE fadeOut(uint32 currentTime, int fadeTime);
- HRESULT persist(CBPersistMgr *PersistMgr);
+ ERRORCODE persist(CBPersistMgr *PersistMgr);
private:
uint32 _fadeStart;
int _fadeTime;
diff --git a/engines/wintermute/Base/file/BFile.h b/engines/wintermute/Base/file/BFile.h
index 16b51a50fc..0a7214f6ba 100644
--- a/engines/wintermute/Base/file/BFile.h
+++ b/engines/wintermute/Base/file/BFile.h
@@ -51,10 +51,10 @@ public:
virtual uint32 getPos() {
return _pos;
};
- virtual HRESULT seek(uint32 pos, TSeek origin = SEEK_TO_BEGIN) = 0;
- virtual HRESULT read(void *buffer, uint32 size) = 0;
- virtual HRESULT close() = 0;
- virtual HRESULT open(const Common::String &filename) = 0;
+ virtual ERRORCODE seek(uint32 pos, TSeek origin = SEEK_TO_BEGIN) = 0;
+ virtual ERRORCODE read(void *buffer, uint32 size) = 0;
+ virtual ERRORCODE close() = 0;
+ virtual ERRORCODE open(const Common::String &filename) = 0;
virtual bool isEOF();
CBFile(CBGame *inGame);
virtual ~CBFile();
diff --git a/engines/wintermute/Base/file/BSaveThumbFile.cpp b/engines/wintermute/Base/file/BSaveThumbFile.cpp
index c51cff366a..6f31a424c0 100644
--- a/engines/wintermute/Base/file/BSaveThumbFile.cpp
+++ b/engines/wintermute/Base/file/BSaveThumbFile.cpp
@@ -51,10 +51,10 @@ CBSaveThumbFile::~CBSaveThumbFile() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSaveThumbFile::open(const Common::String &filename) {
+ERRORCODE CBSaveThumbFile::open(const Common::String &filename) {
close();
- if (scumm_strnicmp(filename.c_str(), "savegame:", 9) != 0) return E_FAIL;
+ if (scumm_strnicmp(filename.c_str(), "savegame:", 9) != 0) return STATUS_FAILED;
char *tempFilename = new char[strlen(filename.c_str()) - 8];
strcpy(tempFilename, filename.c_str() + 9);
@@ -72,24 +72,24 @@ HRESULT CBSaveThumbFile::open(const Common::String &filename) {
char slotFilename[MAX_PATH + 1];
Game->getSaveSlotFilename(slot, slotFilename);
CBPersistMgr *pm = new CBPersistMgr(Game);
- if (!pm) return E_FAIL;
+ if (!pm) return STATUS_FAILED;
Game->_dEBUG_AbsolutePathWarning = false;
- if (FAILED(pm->initLoad(slotFilename))) {
+ if (DID_FAIL(pm->initLoad(slotFilename))) {
Game->_dEBUG_AbsolutePathWarning = true;
delete pm;
- return E_FAIL;
+ return STATUS_FAILED;
}
Game->_dEBUG_AbsolutePathWarning = true;
- HRESULT res;
+ ERRORCODE res;
if (pm->_thumbnailDataSize != 0) {
_data = new byte[pm->_thumbnailDataSize];
memcpy(_data, pm->_thumbnailData, pm->_thumbnailDataSize);
_size = pm->_thumbnailDataSize;
- res = S_OK;
- } else res = E_FAIL;
+ res = STATUS_OK;
+ } else res = STATUS_FAILED;
delete pm;
return res;
@@ -97,31 +97,31 @@ HRESULT CBSaveThumbFile::open(const Common::String &filename) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSaveThumbFile::close() {
+ERRORCODE CBSaveThumbFile::close() {
delete[] _data;
_data = NULL;
_pos = 0;
_size = 0;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSaveThumbFile::read(void *buffer, uint32 size) {
- if (!_data || _pos + size > _size) return E_FAIL;
+ERRORCODE CBSaveThumbFile::read(void *buffer, uint32 size) {
+ if (!_data || _pos + size > _size) return STATUS_FAILED;
memcpy(buffer, (byte *)_data + _pos, size);
_pos += size;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBSaveThumbFile::seek(uint32 pos, TSeek origin) {
- if (!_data) return E_FAIL;
+ERRORCODE CBSaveThumbFile::seek(uint32 pos, TSeek origin) {
+ if (!_data) return STATUS_FAILED;
uint32 newPos = 0;
@@ -137,10 +137,10 @@ HRESULT CBSaveThumbFile::seek(uint32 pos, TSeek origin) {
break;
}
- if (newPos > _size) return E_FAIL;
+ if (newPos > _size) return STATUS_FAILED;
else _pos = newPos;
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/Base/file/BSaveThumbFile.h b/engines/wintermute/Base/file/BSaveThumbFile.h
index 8be98c1cc8..6540438de3 100644
--- a/engines/wintermute/Base/file/BSaveThumbFile.h
+++ b/engines/wintermute/Base/file/BSaveThumbFile.h
@@ -39,10 +39,10 @@ class CBSaveThumbFile : public CBFile {
public:
CBSaveThumbFile(CBGame *Game);
virtual ~CBSaveThumbFile();
- virtual HRESULT seek(uint32 pos, TSeek origin = SEEK_TO_BEGIN);
- virtual HRESULT read(void *buffer, uint32 size);
- virtual HRESULT close();
- virtual HRESULT open(const Common::String &filename);
+ virtual ERRORCODE seek(uint32 pos, TSeek origin = SEEK_TO_BEGIN);
+ virtual ERRORCODE read(void *buffer, uint32 size);
+ virtual ERRORCODE close();
+ virtual ERRORCODE open(const Common::String &filename);
private:
byte *_data;
};
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
diff --git a/engines/wintermute/Sys/SysClassRegistry.cpp b/engines/wintermute/Sys/SysClassRegistry.cpp
index c29bc19578..1ebcccf6e1 100644
--- a/engines/wintermute/Sys/SysClassRegistry.cpp
+++ b/engines/wintermute/Sys/SysClassRegistry.cpp
@@ -167,7 +167,7 @@ bool checkHeader(const char *tag, CBPersistMgr *pm) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CSysClassRegistry::saveTable(CBGame *Game, CBPersistMgr *persistMgr, bool quickSave) {
+ERRORCODE CSysClassRegistry::saveTable(CBGame *Game, CBPersistMgr *persistMgr, bool quickSave) {
persistMgr->putString("<CLASS_REGISTRY_TABLE>");
persistMgr->putDWORD(_classes.size());
@@ -186,12 +186,12 @@ HRESULT CSysClassRegistry::saveTable(CBGame *Game, CBPersistMgr *persistMgr, boo
(it->_value)->saveTable(Game, persistMgr);
}
persistMgr->putString("</CLASS_REGISTRY_TABLE>");
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CSysClassRegistry::loadTable(CBGame *Game, CBPersistMgr *persistMgr) {
+ERRORCODE CSysClassRegistry::loadTable(CBGame *Game, CBPersistMgr *persistMgr) {
checkHeader("<CLASS_REGISTRY_TABLE>", persistMgr);
// reset SavedID of current instances
@@ -221,12 +221,12 @@ HRESULT CSysClassRegistry::loadTable(CBGame *Game, CBPersistMgr *persistMgr) {
checkHeader("</CLASS_REGISTRY_TABLE>", persistMgr);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CSysClassRegistry::saveInstances(CBGame *Game, CBPersistMgr *persistMgr, bool quickSave) {
+ERRORCODE CSysClassRegistry::saveInstances(CBGame *Game, CBPersistMgr *persistMgr, bool quickSave) {
Classes::iterator it;
@@ -254,11 +254,11 @@ HRESULT CSysClassRegistry::saveInstances(CBGame *Game, CBPersistMgr *persistMgr,
(it->_value)->saveInstances(Game, persistMgr);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CSysClassRegistry::loadInstances(CBGame *Game, CBPersistMgr *persistMgr) {
+ERRORCODE CSysClassRegistry::loadInstances(CBGame *Game, CBPersistMgr *persistMgr) {
// get total instances
int numInstances = persistMgr->getDWORD();
@@ -289,17 +289,17 @@ HRESULT CSysClassRegistry::loadInstances(CBGame *Game, CBPersistMgr *persistMgr)
_savedInstanceMap.clear();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CSysClassRegistry::enumInstances(SYS_INSTANCE_CALLBACK lpCallback, const char *className, void *lpData) {
+ERRORCODE CSysClassRegistry::enumInstances(SYS_INSTANCE_CALLBACK lpCallback, const char *className, void *lpData) {
NameMap::iterator mapIt = _nameMap.find(className);
- if (mapIt == _nameMap.end()) return E_FAIL;
+ if (mapIt == _nameMap.end()) return STATUS_FAILED;
(*mapIt)._value->instanceCallback(lpCallback, lpData);
- return S_OK;
+ return STATUS_OK;
}
diff --git a/engines/wintermute/Sys/SysClassRegistry.h b/engines/wintermute/Sys/SysClassRegistry.h
index 92dfa5214b..679c92030e 100644
--- a/engines/wintermute/Sys/SysClassRegistry.h
+++ b/engines/wintermute/Sys/SysClassRegistry.h
@@ -66,11 +66,11 @@ public:
CSysClassRegistry();
virtual ~CSysClassRegistry();
- HRESULT enumInstances(SYS_INSTANCE_CALLBACK lpCallback, const char *className, void *lpData);
- HRESULT loadTable(CBGame *Game, CBPersistMgr *PersistMgr);
- HRESULT saveTable(CBGame *Game, CBPersistMgr *PersistMgr, bool quickSave);
- HRESULT loadInstances(CBGame *Game, CBPersistMgr *PersistMgr);
- HRESULT saveInstances(CBGame *Game, CBPersistMgr *PersistMgr, bool quickSave);
+ ERRORCODE enumInstances(SYS_INSTANCE_CALLBACK lpCallback, const char *className, void *lpData);
+ ERRORCODE loadTable(CBGame *Game, CBPersistMgr *PersistMgr);
+ ERRORCODE saveTable(CBGame *Game, CBPersistMgr *PersistMgr, bool quickSave);
+ ERRORCODE loadInstances(CBGame *Game, CBPersistMgr *PersistMgr);
+ ERRORCODE saveInstances(CBGame *Game, CBPersistMgr *PersistMgr, bool quickSave);
void *idToPointer(int classID, int instanceID);
bool getPointerID(void *pointer, int *classID, int *instanceID);
bool registerClass(CSysClass *classObj);
diff --git a/engines/wintermute/UI/UIButton.cpp b/engines/wintermute/UI/UIButton.cpp
index ce432d8f4a..2dfb688e46 100644
--- a/engines/wintermute/UI/UIButton.cpp
+++ b/engines/wintermute/UI/UIButton.cpp
@@ -95,19 +95,19 @@ CUIButton::~CUIButton() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIButton::loadFile(const char *filename) {
+ERRORCODE CUIButton::loadFile(const char *filename) {
byte *buffer = Game->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
Game->LOG(0, "CUIButton::LoadFile failed for file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
- HRESULT ret;
+ ERRORCODE ret;
_filename = new char [strlen(filename) + 1];
strcpy(_filename, filename);
- if (FAILED(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing BUTTON file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing BUTTON file '%s'", filename);
delete [] buffer;
@@ -154,7 +154,7 @@ TOKEN_DEF(PIXEL_PERFECT)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIButton::loadBuffer(byte *buffer, bool complete) {
+ERRORCODE CUIButton::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(BUTTON)
TOKEN_TABLE(TEMPLATE)
@@ -201,7 +201,7 @@ HRESULT CUIButton::loadBuffer(byte *buffer, bool complete) {
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_BUTTON) {
Game->LOG(0, "'BUTTON' keyword expected.");
- return E_FAIL;
+ return STATUS_FAILED;
}
buffer = params;
}
@@ -209,7 +209,7 @@ HRESULT CUIButton::loadBuffer(byte *buffer, bool complete) {
while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
- if (FAILED(loadFile((char *)params))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(loadFile((char *)params))) cmd = PARSERR_GENERIC;
break;
case TOKEN_NAME:
@@ -223,7 +223,7 @@ HRESULT CUIButton::loadBuffer(byte *buffer, bool complete) {
case TOKEN_BACK:
delete _back;
_back = new CUITiledImage(Game);
- if (!_back || FAILED(_back->loadFile((char *)params))) {
+ if (!_back || DID_FAIL(_back->loadFile((char *)params))) {
delete _back;
_back = NULL;
cmd = PARSERR_GENERIC;
@@ -233,7 +233,7 @@ HRESULT CUIButton::loadBuffer(byte *buffer, bool complete) {
case TOKEN_BACK_HOVER:
delete _backHover;
_backHover = new CUITiledImage(Game);
- if (!_backHover || FAILED(_backHover->loadFile((char *)params))) {
+ if (!_backHover || DID_FAIL(_backHover->loadFile((char *)params))) {
delete _backHover;
_backHover = NULL;
cmd = PARSERR_GENERIC;
@@ -243,7 +243,7 @@ HRESULT CUIButton::loadBuffer(byte *buffer, bool complete) {
case TOKEN_BACK_PRESS:
delete _backPress;
_backPress = new CUITiledImage(Game);
- if (!_backPress || FAILED(_backPress->loadFile((char *)params))) {
+ if (!_backPress || DID_FAIL(_backPress->loadFile((char *)params))) {
delete _backPress;
_backPress = NULL;
cmd = PARSERR_GENERIC;
@@ -253,7 +253,7 @@ HRESULT CUIButton::loadBuffer(byte *buffer, bool complete) {
case TOKEN_BACK_DISABLE:
delete _backDisable;
_backDisable = new CUITiledImage(Game);
- if (!_backDisable || FAILED(_backDisable->loadFile((char *)params))) {
+ if (!_backDisable || DID_FAIL(_backDisable->loadFile((char *)params))) {
delete _backDisable;
_backDisable = NULL;
cmd = PARSERR_GENERIC;
@@ -263,7 +263,7 @@ HRESULT CUIButton::loadBuffer(byte *buffer, bool complete) {
case TOKEN_BACK_FOCUS:
delete _backFocus;
_backFocus = new CUITiledImage(Game);
- if (!_backFocus || FAILED(_backFocus->loadFile((char *)params))) {
+ if (!_backFocus || DID_FAIL(_backFocus->loadFile((char *)params))) {
delete _backFocus;
_backFocus = NULL;
cmd = PARSERR_GENERIC;
@@ -273,7 +273,7 @@ HRESULT CUIButton::loadBuffer(byte *buffer, bool complete) {
case TOKEN_IMAGE:
delete _image;
_image = new CBSprite(Game);
- if (!_image || FAILED(_image->loadFile((char *)params))) {
+ if (!_image || DID_FAIL(_image->loadFile((char *)params))) {
delete _image;
_image = NULL;
cmd = PARSERR_GENERIC;
@@ -283,7 +283,7 @@ HRESULT CUIButton::loadBuffer(byte *buffer, bool complete) {
case TOKEN_IMAGE_HOVER:
delete _imageHover;
_imageHover = new CBSprite(Game);
- if (!_imageHover || FAILED(_imageHover->loadFile((char *)params))) {
+ if (!_imageHover || DID_FAIL(_imageHover->loadFile((char *)params))) {
delete _imageHover;
_imageHover = NULL;
cmd = PARSERR_GENERIC;
@@ -293,7 +293,7 @@ HRESULT CUIButton::loadBuffer(byte *buffer, bool complete) {
case TOKEN_IMAGE_PRESS:
delete _imagePress;
_imagePress = new CBSprite(Game);
- if (!_imagePress || FAILED(_imagePress->loadFile((char *)params))) {
+ if (!_imagePress || DID_FAIL(_imagePress->loadFile((char *)params))) {
delete _imagePress;
_imagePress = NULL;
cmd = PARSERR_GENERIC;
@@ -303,7 +303,7 @@ HRESULT CUIButton::loadBuffer(byte *buffer, bool complete) {
case TOKEN_IMAGE_DISABLE:
delete _imageDisable;
_imageDisable = new CBSprite(Game);
- if (!_imageDisable || FAILED(_imageDisable->loadFile((char *)params))) {
+ if (!_imageDisable || DID_FAIL(_imageDisable->loadFile((char *)params))) {
delete _imageDisable;
_imageDisable = NULL;
cmd = PARSERR_GENERIC;
@@ -313,7 +313,7 @@ HRESULT CUIButton::loadBuffer(byte *buffer, bool complete) {
case TOKEN_IMAGE_FOCUS:
delete _imageFocus;
_imageFocus = new CBSprite(Game);
- if (!_imageFocus || FAILED(_imageFocus->loadFile((char *)params))) {
+ if (!_imageFocus || DID_FAIL(_imageFocus->loadFile((char *)params))) {
delete _imageFocus;
_imageFocus = NULL;
cmd = PARSERR_GENERIC;
@@ -380,7 +380,7 @@ HRESULT CUIButton::loadBuffer(byte *buffer, bool complete) {
case TOKEN_CURSOR:
delete _cursor;
_cursor = new CBSprite(Game);
- if (!_cursor || FAILED(_cursor->loadFile((char *)params))) {
+ if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
delete _cursor;
_cursor = NULL;
cmd = PARSERR_GENERIC;
@@ -426,20 +426,20 @@ HRESULT CUIButton::loadBuffer(byte *buffer, bool complete) {
}
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in BUTTON definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (cmd == PARSERR_GENERIC) {
Game->LOG(0, "Error loading BUTTON definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
correctSize();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIButton::saveAsText(CBDynBuffer *buffer, int indent) {
+ERRORCODE CUIButton::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "BUTTON\n");
buffer->putTextIndent(indent, "{\n");
@@ -534,7 +534,7 @@ HRESULT CUIButton::saveAsText(CBDynBuffer *buffer, int indent) {
CBBase::saveAsText(buffer, indent + 2);
buffer->putTextIndent(indent, "}\n");
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -577,9 +577,9 @@ void CUIButton::correctSize() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIButton::display(int offsetX, int offsetY) {
+ERRORCODE CUIButton::display(int offsetX, int offsetY) {
if (!_visible)
- return S_OK;
+ return STATUS_OK;
CUITiledImage *back = NULL;
CBSprite *image = NULL;
@@ -649,7 +649,7 @@ HRESULT CUIButton::display(int offsetX, int offsetY) {
_press = _hover && Game->_mouseLeftDown && Game->_capturedObject == this;
- return S_OK;
+ return STATUS_OK;
}
@@ -666,7 +666,7 @@ void CUIButton::press() {
//////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// SetDisabledFont
//////////////////////////////////////////////////////////////////////////
@@ -682,7 +682,7 @@ HRESULT CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
_fontDisable = Game->_fontStorage->addFont(Val->getString());
stack->pushBool(_fontDisable != NULL);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -700,7 +700,7 @@ HRESULT CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
_fontHover = Game->_fontStorage->addFont(val->getString());
stack->pushBool(_fontHover != NULL);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -718,7 +718,7 @@ HRESULT CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
_fontPress = Game->_fontStorage->addFont(Val->getString());
stack->pushBool(_fontPress != NULL);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -736,7 +736,7 @@ HRESULT CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
_fontFocus = Game->_fontStorage->addFont(val->getString());
stack->pushBool(_fontFocus != NULL);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -748,13 +748,13 @@ HRESULT CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
delete _imageDisable;
_imageDisable = new CBSprite(Game);
const char *filename = stack->pop()->getString();
- if (!_imageDisable || FAILED(_imageDisable->loadFile(filename))) {
+ if (!_imageDisable || DID_FAIL(_imageDisable->loadFile(filename))) {
delete _imageDisable;
_imageDisable = NULL;
stack->pushBool(false);
} else stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -765,7 +765,7 @@ HRESULT CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
if (!_imageDisable || !_imageDisable->_filename) stack->pushNULL();
else stack->pushString(_imageDisable->_filename);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -776,7 +776,7 @@ HRESULT CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
if (!_imageDisable) stack->pushNULL();
else stack->pushNative(_imageDisable, true);
- return S_OK;
+ return STATUS_OK;
}
@@ -789,13 +789,13 @@ HRESULT CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
delete _imageHover;
_imageHover = new CBSprite(Game);
const char *filename = stack->pop()->getString();
- if (!_imageHover || FAILED(_imageHover->loadFile(filename))) {
+ if (!_imageHover || DID_FAIL(_imageHover->loadFile(filename))) {
delete _imageHover;
_imageHover = NULL;
stack->pushBool(false);
} else stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -806,7 +806,7 @@ HRESULT CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
if (!_imageHover || !_imageHover->_filename) stack->pushNULL();
else stack->pushString(_imageHover->_filename);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -817,7 +817,7 @@ HRESULT CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
if (!_imageHover) stack->pushNULL();
else stack->pushNative(_imageHover, true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -829,13 +829,13 @@ HRESULT CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
delete _imagePress;
_imagePress = new CBSprite(Game);
const char *filename = stack->pop()->getString();
- if (!_imagePress || FAILED(_imagePress->loadFile(filename))) {
+ if (!_imagePress || DID_FAIL(_imagePress->loadFile(filename))) {
delete _imagePress;
_imagePress = NULL;
stack->pushBool(false);
} else stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -846,7 +846,7 @@ HRESULT CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
if (!_imagePress || !_imagePress->_filename) stack->pushNULL();
else stack->pushString(_imagePress->_filename);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -857,7 +857,7 @@ HRESULT CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
if (!_imagePress) stack->pushNULL();
else stack->pushNative(_imagePress, true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -869,13 +869,13 @@ HRESULT CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
delete _imageFocus;
_imageFocus = new CBSprite(Game);
const char *filename = stack->pop()->getString();
- if (!_imageFocus || FAILED(_imageFocus->loadFile(filename))) {
+ if (!_imageFocus || DID_FAIL(_imageFocus->loadFile(filename))) {
delete _imageFocus;
_imageFocus = NULL;
stack->pushBool(false);
} else stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -886,7 +886,7 @@ HRESULT CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
if (!_imageFocus || !_imageFocus->_filename) stack->pushNULL();
else stack->pushString(_imageFocus->_filename);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -897,7 +897,7 @@ HRESULT CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
if (!_imageFocus) stack->pushNULL();
else stack->pushNative(_imageFocus, true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -912,7 +912,7 @@ HRESULT CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
}
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
@@ -967,7 +967,7 @@ CScValue *CUIButton::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIButton::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CUIButton::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
// TextAlign
//////////////////////////////////////////////////////////////////////////
@@ -975,7 +975,7 @@ HRESULT CUIButton::scSetProperty(const char *name, CScValue *value) {
int i = value->getInt();
if (i < 0 || i >= NUM_TEXT_ALIGN) i = 0;
_align = (TTextAlign)i;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -983,21 +983,21 @@ HRESULT CUIButton::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Focusable") == 0) {
_canFocus = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// Pressed
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Pressed") == 0) {
_stayPressed = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// PixelPerfect
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "PixelPerfect") == 0) {
_pixelPerfect = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
else return CUIObject::scSetProperty(name, value);
@@ -1011,7 +1011,7 @@ const char *CUIButton::scToString() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIButton::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CUIButton::persist(CBPersistMgr *persistMgr) {
CUIObject::persist(persistMgr);
@@ -1040,7 +1040,7 @@ HRESULT CUIButton::persist(CBPersistMgr *persistMgr) {
_oneTimePressTime = 0;
}
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/UI/UIButton.h b/engines/wintermute/UI/UIButton.h
index 2c16c4b5d0..a857e8ed2a 100644
--- a/engines/wintermute/UI/UIButton.h
+++ b/engines/wintermute/UI/UIButton.h
@@ -44,7 +44,7 @@ public:
uint32 _oneTimePressTime;
DECLARE_PERSISTENT(CUIButton, CUIObject)
void press();
- virtual HRESULT display(int offsetX = 0, int offsetY = 0);
+ virtual ERRORCODE display(int offsetX = 0, int offsetY = 0);
bool _press;
bool _hover;
void correctSize();
@@ -63,14 +63,14 @@ public:
CUITiledImage *_backFocus;
CUIButton(CBGame *inGame = NULL);
virtual ~CUIButton();
- HRESULT loadFile(const char *filename);
- HRESULT loadBuffer(byte *buffer, bool complete = true);
- virtual HRESULT saveAsText(CBDynBuffer *buffer, int indent);
+ ERRORCODE loadFile(const char *filename);
+ ERRORCODE loadBuffer(byte *buffer, bool complete = true);
+ virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent);
// scripting interface
virtual CScValue *scGetProperty(const char *name);
- virtual HRESULT scSetProperty(const char *name, CScValue *value);
- virtual HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ERRORCODE scSetProperty(const char *name, CScValue *value);
+ virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
virtual const char *scToString();
};
diff --git a/engines/wintermute/UI/UIEdit.cpp b/engines/wintermute/UI/UIEdit.cpp
index 0aac35a366..ca6f3416bc 100644
--- a/engines/wintermute/UI/UIEdit.cpp
+++ b/engines/wintermute/UI/UIEdit.cpp
@@ -94,19 +94,19 @@ CUIEdit::~CUIEdit() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIEdit::loadFile(const char *filename) {
+ERRORCODE CUIEdit::loadFile(const char *filename) {
byte *buffer = Game->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
Game->LOG(0, "CUIEdit::LoadFile failed for file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
- HRESULT ret;
+ ERRORCODE ret;
_filename = new char [strlen(filename) + 1];
strcpy(_filename, filename);
- if (FAILED(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing EDIT file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing EDIT file '%s'", filename);
delete [] buffer;
@@ -139,7 +139,7 @@ TOKEN_DEF(EDIT)
TOKEN_DEF(CAPTION)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIEdit::loadBuffer(byte *buffer, bool complete) {
+ERRORCODE CUIEdit::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(TEMPLATE)
TOKEN_TABLE(DISABLED)
@@ -172,7 +172,7 @@ HRESULT CUIEdit::loadBuffer(byte *buffer, bool complete) {
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_EDIT) {
Game->LOG(0, "'EDIT' keyword expected.");
- return E_FAIL;
+ return STATUS_FAILED;
}
buffer = params;
}
@@ -180,7 +180,7 @@ HRESULT CUIEdit::loadBuffer(byte *buffer, bool complete) {
while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
- if (FAILED(loadFile((char *)params))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(loadFile((char *)params))) cmd = PARSERR_GENERIC;
break;
case TOKEN_NAME:
@@ -190,7 +190,7 @@ HRESULT CUIEdit::loadBuffer(byte *buffer, bool complete) {
case TOKEN_BACK:
delete _back;
_back = new CUITiledImage(Game);
- if (!_back || FAILED(_back->loadFile((char *)params))) {
+ if (!_back || DID_FAIL(_back->loadFile((char *)params))) {
delete _back;
_back = NULL;
cmd = PARSERR_GENERIC;
@@ -200,7 +200,7 @@ HRESULT CUIEdit::loadBuffer(byte *buffer, bool complete) {
case TOKEN_IMAGE:
delete _image;
_image = new CBSprite(Game);
- if (!_image || FAILED(_image->loadFile((char *)params))) {
+ if (!_image || DID_FAIL(_image->loadFile((char *)params))) {
delete _image;
_image = NULL;
cmd = PARSERR_GENERIC;
@@ -251,7 +251,7 @@ HRESULT CUIEdit::loadBuffer(byte *buffer, bool complete) {
case TOKEN_CURSOR:
delete _cursor;
_cursor = new CBSprite(Game);
- if (!_cursor || FAILED(_cursor->loadFile((char *)params))) {
+ if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
delete _cursor;
_cursor = NULL;
cmd = PARSERR_GENERIC;
@@ -289,20 +289,20 @@ HRESULT CUIEdit::loadBuffer(byte *buffer, bool complete) {
}
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in EDIT definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (cmd == PARSERR_GENERIC) {
Game->LOG(0, "Error loading EDIT definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
correctSize();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIEdit::saveAsText(CBDynBuffer *buffer, int indent) {
+ERRORCODE CUIEdit::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "EDIT\n");
buffer->putTextIndent(indent, "{\n");
@@ -355,13 +355,13 @@ HRESULT CUIEdit::saveAsText(CBDynBuffer *buffer, int indent) {
CBBase::saveAsText(buffer, indent + 2);
buffer->putTextIndent(indent, "}\n");
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIEdit::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CUIEdit::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// SetSelectedFont
//////////////////////////////////////////////////////////////////////////
@@ -372,7 +372,7 @@ HRESULT CUIEdit::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
_fontSelected = Game->_fontStorage->addFont(stack->pop()->getString());
stack->pushBool(_fontSelected != NULL);
- return S_OK;
+ return STATUS_OK;
}
else return CUIObject::scCallMethod(script, stack, thisStack, name);
@@ -457,7 +457,7 @@ CScValue *CUIEdit::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIEdit::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CUIEdit::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
// SelStart
//////////////////////////////////////////////////////////////////////////
@@ -465,7 +465,7 @@ HRESULT CUIEdit::scSetProperty(const char *name, CScValue *value) {
_selStart = value->getInt();
_selStart = MAX(_selStart, 0);
_selStart = MIN((size_t)_selStart, strlen(_text));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -475,7 +475,7 @@ HRESULT CUIEdit::scSetProperty(const char *name, CScValue *value) {
_selEnd = value->getInt();
_selEnd = MAX(_selEnd, 0);
_selEnd = MIN((size_t)_selEnd, strlen(_text));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -483,7 +483,7 @@ HRESULT CUIEdit::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "CursorBlinkRate") == 0) {
_cursorBlinkRate = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -491,7 +491,7 @@ HRESULT CUIEdit::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "CursorChar") == 0) {
setCursorChar(value->getString());
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -499,7 +499,7 @@ HRESULT CUIEdit::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "FrameWidth") == 0) {
_frameWidth = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -507,7 +507,7 @@ HRESULT CUIEdit::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "MaxLength") == 0) {
_maxLength = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -520,7 +520,7 @@ HRESULT CUIEdit::scSetProperty(const char *name, CScValue *value) {
} else {
setText(value->getString());
}
- return S_OK;
+ return STATUS_OK;
}
else return CUIObject::scSetProperty(name, value);
@@ -543,8 +543,8 @@ void CUIEdit::setCursorChar(const char *character) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIEdit::display(int offsetX, int offsetY) {
- if (!_visible) return S_OK;
+ERRORCODE CUIEdit::display(int offsetX, int offsetY) {
+ if (!_visible) return STATUS_OK;
// hack!
@@ -681,7 +681,7 @@ HRESULT CUIEdit::display(int offsetX, int offsetY) {
Game->_textEncoding = OrigEncoding;
- return S_OK;
+ return STATUS_OK;
}
@@ -836,7 +836,7 @@ int CUIEdit::insertChars(int pos, byte *chars, int num) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIEdit::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CUIEdit::persist(CBPersistMgr *persistMgr) {
CUIObject::persist(persistMgr);
@@ -854,7 +854,7 @@ HRESULT CUIEdit::persist(CBPersistMgr *persistMgr) {
_lastBlinkTime = 0;
}
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/UI/UIEdit.h b/engines/wintermute/UI/UIEdit.h
index f011072ae3..d47066c8f0 100644
--- a/engines/wintermute/UI/UIEdit.h
+++ b/engines/wintermute/UI/UIEdit.h
@@ -43,7 +43,7 @@ public:
int deleteChars(int start, int end);
bool _cursorVisible;
uint32 _lastBlinkTime;
- virtual HRESULT display(int offsetX, int offsetY);
+ virtual ERRORCODE display(int offsetX, int offsetY);
virtual bool handleKeypress(Common::Event *event, bool printable = false);
int _scrollOffset;
int _frameWidth;
@@ -56,14 +56,14 @@ public:
CUIEdit(CBGame *inGame);
virtual ~CUIEdit();
- HRESULT loadFile(const char *filename);
- HRESULT loadBuffer(byte *buffer, bool complete = true);
- virtual HRESULT saveAsText(CBDynBuffer *buffer, int indent);
+ ERRORCODE loadFile(const char *filename);
+ ERRORCODE loadBuffer(byte *buffer, bool complete = true);
+ virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent);
// scripting interface
virtual CScValue *scGetProperty(const char *name);
- virtual HRESULT scSetProperty(const char *name, CScValue *value);
- virtual HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ERRORCODE scSetProperty(const char *name, CScValue *value);
+ virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
virtual const char *scToString();
};
diff --git a/engines/wintermute/UI/UIEntity.cpp b/engines/wintermute/UI/UIEntity.cpp
index 3d00b9251c..faaaf375c0 100644
--- a/engines/wintermute/UI/UIEntity.cpp
+++ b/engines/wintermute/UI/UIEntity.cpp
@@ -55,19 +55,19 @@ CUIEntity::~CUIEntity() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIEntity::loadFile(const char *filename) {
+ERRORCODE CUIEntity::loadFile(const char *filename) {
byte *buffer = Game->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
Game->LOG(0, "CUIEntity::LoadFile failed for file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
- HRESULT ret;
+ ERRORCODE ret;
_filename = new char [strlen(filename) + 1];
strcpy(_filename, filename);
- if (FAILED(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing ENTITY container file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing ENTITY container file '%s'", filename);
delete [] buffer;
@@ -89,7 +89,7 @@ TOKEN_DEF(SCRIPT)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIEntity::loadBuffer(byte *buffer, bool complete) {
+ERRORCODE CUIEntity::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(ENTITY_CONTAINER)
TOKEN_TABLE(TEMPLATE)
@@ -110,7 +110,7 @@ HRESULT CUIEntity::loadBuffer(byte *buffer, bool complete) {
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_ENTITY_CONTAINER) {
Game->LOG(0, "'ENTITY_CONTAINER' keyword expected.");
- return E_FAIL;
+ return STATUS_FAILED;
}
buffer = params;
}
@@ -118,7 +118,7 @@ HRESULT CUIEntity::loadBuffer(byte *buffer, bool complete) {
while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
- if (FAILED(loadFile((char *)params))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(loadFile((char *)params))) cmd = PARSERR_GENERIC;
break;
case TOKEN_NAME:
@@ -142,7 +142,7 @@ HRESULT CUIEntity::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_ENTITY:
- if (FAILED(setEntity((char *)params))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(setEntity((char *)params))) cmd = PARSERR_GENERIC;
break;
case TOKEN_SCRIPT:
@@ -156,11 +156,11 @@ HRESULT CUIEntity::loadBuffer(byte *buffer, bool complete) {
}
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in ENTITY_CONTAINER definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (cmd == PARSERR_GENERIC) {
Game->LOG(0, "Error loading ENTITY_CONTAINER definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
correctSize();
@@ -170,11 +170,11 @@ HRESULT CUIEntity::loadBuffer(byte *buffer, bool complete) {
_height = 50;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIEntity::saveAsText(CBDynBuffer *buffer, int indent) {
+ERRORCODE CUIEntity::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "ENTITY_CONTAINER\n");
buffer->putTextIndent(indent, "{\n");
@@ -204,29 +204,29 @@ HRESULT CUIEntity::saveAsText(CBDynBuffer *buffer, int indent) {
CBBase::saveAsText(buffer, indent + 2);
buffer->putTextIndent(indent, "}\n");
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIEntity::setEntity(const char *filename) {
+ERRORCODE CUIEntity::setEntity(const char *filename) {
if (_entity) Game->unregisterObject(_entity);
_entity = new CAdEntity(Game);
- if (!_entity || FAILED(_entity->loadFile(filename))) {
+ if (!_entity || DID_FAIL(_entity->loadFile(filename))) {
delete _entity;
_entity = NULL;
- return E_FAIL;
+ return STATUS_FAILED;
} else {
_entity->_nonIntMouseEvents = true;
_entity->_sceneIndependent = true;
_entity->makeFreezable(false);
Game->registerObject(_entity);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIEntity::display(int offsetX, int offsetY) {
- if (!_visible) return S_OK;
+ERRORCODE CUIEntity::display(int offsetX, int offsetY) {
+ if (!_visible) return STATUS_OK;
if (_entity) {
_entity->_posX = offsetX + _posX;
@@ -244,14 +244,14 @@ HRESULT CUIEntity::display(int offsetX, int offsetY) {
_entity->_registrable = origReg;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIEntity::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CUIEntity::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// GetEntity
//////////////////////////////////////////////////////////////////////////
@@ -261,7 +261,7 @@ HRESULT CUIEntity::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
if (_entity) stack->pushNative(_entity, true);
else stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -272,12 +272,12 @@ HRESULT CUIEntity::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
const char *filename = stack->pop()->getString();
- if (SUCCEEDED(setEntity(filename)))
+ if (DID_SUCCEED(setEntity(filename)))
stack->pushBool(true);
else
stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
else return CUIObject::scCallMethod(script, stack, thisStack, name);
@@ -310,13 +310,13 @@ CScValue *CUIEntity::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIEntity::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CUIEntity::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
// Freezable
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "Freezable") == 0) {
if (_entity) _entity->makeFreezable(value->getBool());
- return S_OK;
+ return STATUS_OK;
} else return CUIObject::scSetProperty(name, value);
}
@@ -328,12 +328,12 @@ const char *CUIEntity::scToString() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIEntity::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CUIEntity::persist(CBPersistMgr *persistMgr) {
CUIObject::persist(persistMgr);
persistMgr->transfer(TMEMBER(_entity));
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/UI/UIEntity.h b/engines/wintermute/UI/UIEntity.h
index 59bcc67bf3..bef73b5e05 100644
--- a/engines/wintermute/UI/UIEntity.h
+++ b/engines/wintermute/UI/UIEntity.h
@@ -38,18 +38,18 @@ public:
DECLARE_PERSISTENT(CUIEntity, CUIObject)
CUIEntity(CBGame *inGame);
virtual ~CUIEntity();
- HRESULT loadFile(const char *filename);
- HRESULT loadBuffer(byte *buffer, bool complete);
- virtual HRESULT saveAsText(CBDynBuffer *buffer, int indent);
+ ERRORCODE loadFile(const char *filename);
+ ERRORCODE loadBuffer(byte *buffer, bool complete);
+ virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent);
- virtual HRESULT display(int offsetX = 0, int offsetY = 0);
+ virtual ERRORCODE display(int offsetX = 0, int offsetY = 0);
CAdEntity *_entity;
- HRESULT setEntity(const char *filename);
+ ERRORCODE setEntity(const char *filename);
// scripting interface
virtual CScValue *scGetProperty(const char *name);
- virtual HRESULT scSetProperty(const char *name, CScValue *value);
- virtual HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ERRORCODE scSetProperty(const char *name, CScValue *value);
+ virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
virtual const char *scToString();
};
diff --git a/engines/wintermute/UI/UIObject.cpp b/engines/wintermute/UI/UIObject.cpp
index d56e93e4b4..7ed8ffb74f 100644
--- a/engines/wintermute/UI/UIObject.cpp
+++ b/engines/wintermute/UI/UIObject.cpp
@@ -98,8 +98,8 @@ void CUIObject::setText(const char *text) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIObject::display(int offsetX, int offsetY) {
- return S_OK;
+ERRORCODE CUIObject::display(int offsetX, int offsetY) {
+ return STATUS_OK;
}
@@ -137,7 +137,7 @@ void CUIObject::correctSize() {
//////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CUIObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// SetFont
//////////////////////////////////////////////////////////////////////////
@@ -153,7 +153,7 @@ HRESULT CUIObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
_font = Game->_fontStorage->addFont(Val->getString());
stack->pushBool(_font != NULL);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -169,17 +169,17 @@ HRESULT CUIObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
_image = NULL;
if (val->isNULL()) {
stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
_image = new CBSprite(Game);
- if (!_image || FAILED(_image->loadFile(val->getString()))) {
+ if (!_image || DID_FAIL(_image->loadFile(val->getString()))) {
delete _image;
_image = NULL;
stack->pushBool(false);
} else stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -190,7 +190,7 @@ HRESULT CUIObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
if (!_image || !_image->_filename) stack->pushNULL();
else stack->pushString(_image->_filename);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -201,7 +201,7 @@ HRESULT CUIObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
if (!_image) stack->pushNULL();
else stack->pushNative(_image, true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -211,7 +211,7 @@ HRESULT CUIObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
stack->correctParams(0);
focus();
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -267,7 +267,7 @@ HRESULT CUIObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
} else stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -288,7 +288,7 @@ HRESULT CUIObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
stack->pushBool(true);
} else stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -309,7 +309,7 @@ HRESULT CUIObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
stack->pushBool(true);
} else stack->pushBool(false);
- return S_OK;
+ return STATUS_OK;
}
else return CBObject::scCallMethod(script, stack, thisStack, name);
@@ -418,13 +418,13 @@ CScValue *CUIObject::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIObject::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CUIObject::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
// Name
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "Name") == 0) {
setName(value->getString());
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -432,7 +432,7 @@ HRESULT CUIObject::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ParentNotify") == 0) {
_parentNotify = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -440,7 +440,7 @@ HRESULT CUIObject::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Width") == 0) {
_width = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -448,7 +448,7 @@ HRESULT CUIObject::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Height") == 0) {
_height = value->getInt();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -456,7 +456,7 @@ HRESULT CUIObject::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Visible") == 0) {
_visible = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -464,7 +464,7 @@ HRESULT CUIObject::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Disabled") == 0) {
_disable = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -472,7 +472,7 @@ HRESULT CUIObject::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Text") == 0) {
setText(value->getString());
- return S_OK;
+ return STATUS_OK;
}
else return CBObject::scSetProperty(name, value);
@@ -500,7 +500,7 @@ bool CUIObject::isFocused() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIObject::handleMouse(TMouseEvent event, TMouseButton button) {
+ERRORCODE CUIObject::handleMouse(TMouseEvent event, TMouseButton button) {
// handle focus change
if (event == MOUSE_CLICK && button == MOUSE_BUTTON_LEFT) {
focus();
@@ -510,7 +510,7 @@ HRESULT CUIObject::handleMouse(TMouseEvent event, TMouseButton button) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIObject::focus() {
+ERRORCODE CUIObject::focus() {
CUIObject *obj = this;
bool disabled = false;
while (obj) {
@@ -532,12 +532,12 @@ HRESULT CUIObject::focus() {
obj = obj->_parent;
}
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIObject::getTotalOffset(int *offsetX, int *offsetY) {
+ERRORCODE CUIObject::getTotalOffset(int *offsetX, int *offsetY) {
int offX = 0, offY = 0;
CUIObject *obj = _parent;
@@ -550,12 +550,12 @@ HRESULT CUIObject::getTotalOffset(int *offsetX, int *offsetY) {
if (offsetX) *offsetX = offX;
if (offsetY) *offsetY = offY;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIObject::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CUIObject::persist(CBPersistMgr *persistMgr) {
CBObject::persist(persistMgr);
@@ -578,12 +578,12 @@ HRESULT CUIObject::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(_visible));
persistMgr->transfer(TMEMBER(_width));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIObject::saveAsText(CBDynBuffer *buffer, int indent) {
- return E_FAIL;
+ERRORCODE CUIObject::saveAsText(CBDynBuffer *buffer, int indent) {
+ return STATUS_FAILED;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/UI/UIObject.h b/engines/wintermute/UI/UIObject.h
index 1a682527ac..92dc84eeef 100644
--- a/engines/wintermute/UI/UIObject.h
+++ b/engines/wintermute/UI/UIObject.h
@@ -40,15 +40,15 @@ class CBFont;
class CUIObject : public CBObject {
public:
- HRESULT getTotalOffset(int *offsetX, int *offsetY);
+ ERRORCODE getTotalOffset(int *offsetX, int *offsetY);
bool _canFocus;
- HRESULT focus();
- virtual HRESULT handleMouse(TMouseEvent event, TMouseButton button);
+ ERRORCODE focus();
+ virtual ERRORCODE handleMouse(TMouseEvent event, TMouseButton button);
bool isFocused();
bool _parentNotify;
DECLARE_PERSISTENT(CUIObject, CBObject)
CUIObject *_parent;
- virtual HRESULT display(int offsetX = 0, int offsetY = 0);
+ virtual ERRORCODE display(int offsetX = 0, int offsetY = 0);
virtual void correctSize();
bool _sharedFonts;
bool _sharedImages;
@@ -69,12 +69,12 @@ public:
uint32 _listenerParamDWORD;
CBScriptHolder *_listenerObject;
CUIObject *_focusedWidget;
- virtual HRESULT saveAsText(CBDynBuffer *buffer, int indent);
+ virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent);
// scripting interface
virtual CScValue *scGetProperty(const char *name);
- virtual HRESULT scSetProperty(const char *name, CScValue *value);
- virtual HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ERRORCODE scSetProperty(const char *name, CScValue *value);
+ virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
virtual const char *scToString();
};
diff --git a/engines/wintermute/UI/UIText.cpp b/engines/wintermute/UI/UIText.cpp
index d5f44391ab..884d241e07 100644
--- a/engines/wintermute/UI/UIText.cpp
+++ b/engines/wintermute/UI/UIText.cpp
@@ -62,8 +62,8 @@ CUIText::~CUIText() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIText::display(int offsetX, int offsetY) {
- if (!_visible) return S_OK;
+ERRORCODE CUIText::display(int offsetX, int offsetY) {
+ if (!_visible) return STATUS_OK;
CBFont *font = _font;
@@ -89,25 +89,25 @@ HRESULT CUIText::display(int offsetX, int offsetY) {
//Game->_renderer->_rectList.Add(new CBActiveRect(Game, this, NULL, OffsetX + _posX, OffsetY + _posY, _width, _height, 100, 100, false));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIText::loadFile(const char *filename) {
+ERRORCODE CUIText::loadFile(const char *filename) {
byte *buffer = Game->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
Game->LOG(0, "CUIText::LoadFile failed for file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
- HRESULT ret;
+ ERRORCODE ret;
_filename = new char [strlen(filename) + 1];
strcpy(_filename, filename);
- if (FAILED(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing STATIC file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing STATIC file '%s'", filename);
delete [] buffer;
@@ -138,7 +138,7 @@ TOKEN_DEF(PARENT_NOTIFY)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIText::loadBuffer(byte *buffer, bool complete) {
+ERRORCODE CUIText::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(STATIC)
TOKEN_TABLE(TEMPLATE)
@@ -169,7 +169,7 @@ HRESULT CUIText::loadBuffer(byte *buffer, bool complete) {
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_STATIC) {
Game->LOG(0, "'STATIC' keyword expected.");
- return E_FAIL;
+ return STATUS_FAILED;
}
buffer = params;
}
@@ -177,7 +177,7 @@ HRESULT CUIText::loadBuffer(byte *buffer, bool complete) {
while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
- if (FAILED(loadFile((char *)params))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(loadFile((char *)params))) cmd = PARSERR_GENERIC;
break;
case TOKEN_NAME:
@@ -191,7 +191,7 @@ HRESULT CUIText::loadBuffer(byte *buffer, bool complete) {
case TOKEN_BACK:
delete _back;
_back = new CUITiledImage(Game);
- if (!_back || FAILED(_back->loadFile((char *)params))) {
+ if (!_back || DID_FAIL(_back->loadFile((char *)params))) {
delete _back;
_back = NULL;
cmd = PARSERR_GENERIC;
@@ -201,7 +201,7 @@ HRESULT CUIText::loadBuffer(byte *buffer, bool complete) {
case TOKEN_IMAGE:
delete _image;
_image = new CBSprite(Game);
- if (!_image || FAILED(_image->loadFile((char *)params))) {
+ if (!_image || DID_FAIL(_image->loadFile((char *)params))) {
delete _image;
_image = NULL;
cmd = PARSERR_GENERIC;
@@ -250,7 +250,7 @@ HRESULT CUIText::loadBuffer(byte *buffer, bool complete) {
case TOKEN_CURSOR:
delete _cursor;
_cursor = new CBSprite(Game);
- if (!_cursor || FAILED(_cursor->loadFile((char *)params))) {
+ if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
delete _cursor;
_cursor = NULL;
cmd = PARSERR_GENERIC;
@@ -280,20 +280,20 @@ HRESULT CUIText::loadBuffer(byte *buffer, bool complete) {
}
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in STATIC definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (cmd == PARSERR_GENERIC) {
Game->LOG(0, "Error loading STATIC definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
correctSize();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIText::saveAsText(CBDynBuffer *buffer, int indent) {
+ERRORCODE CUIText::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "STATIC\n");
buffer->putTextIndent(indent, "{\n");
@@ -370,13 +370,13 @@ HRESULT CUIText::saveAsText(CBDynBuffer *buffer, int indent) {
CBBase::saveAsText(buffer, indent + 2);
buffer->putTextIndent(indent, "}\n");
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIText::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CUIText::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// SizeToFit
//////////////////////////////////////////////////////////////////////////
@@ -384,7 +384,7 @@ HRESULT CUIText::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
stack->correctParams(0);
sizeToFit();
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -394,7 +394,7 @@ HRESULT CUIText::scCallMethod(CScScript *script, CScStack *stack, CScStack *this
stack->correctParams(0);
if (_font && _text) _height = _font->getTextHeight((byte *)_text, _width);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
else return CUIObject::scCallMethod(script, stack, thisStack, name);
@@ -434,7 +434,7 @@ CScValue *CUIText::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIText::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CUIText::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
// TextAlign
//////////////////////////////////////////////////////////////////////////
@@ -442,7 +442,7 @@ HRESULT CUIText::scSetProperty(const char *name, CScValue *value) {
int i = value->getInt();
if (i < 0 || i >= NUM_TEXT_ALIGN) i = 0;
_textAlign = (TTextAlign)i;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -452,7 +452,7 @@ HRESULT CUIText::scSetProperty(const char *name, CScValue *value) {
int i = value->getInt();
if (i < 0 || i >= NUM_VERTICAL_ALIGN) i = 0;
_verticalAlign = (TVerticalAlign)i;
- return S_OK;
+ return STATUS_OK;
}
else return CUIObject::scSetProperty(name, value);
@@ -467,23 +467,23 @@ const char *CUIText::scToString() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIText::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CUIText::persist(CBPersistMgr *persistMgr) {
CUIObject::persist(persistMgr);
persistMgr->transfer(TMEMBER_INT(_textAlign));
persistMgr->transfer(TMEMBER_INT(_verticalAlign));
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIText::sizeToFit() {
+ERRORCODE CUIText::sizeToFit() {
if (_font && _text) {
_width = _font->getTextWidth((byte *)_text);
_height = _font->getTextHeight((byte *)_text, _width);
}
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/UI/UIText.h b/engines/wintermute/UI/UIText.h
index 383f15f47d..35428fc283 100644
--- a/engines/wintermute/UI/UIText.h
+++ b/engines/wintermute/UI/UIText.h
@@ -36,22 +36,22 @@ namespace WinterMute {
class CUIText : public CUIObject {
private:
- HRESULT sizeToFit();
+ ERRORCODE sizeToFit();
public:
- virtual HRESULT display(int offsetX, int offsetY);
+ virtual ERRORCODE display(int offsetX, int offsetY);
DECLARE_PERSISTENT(CUIText, CUIObject)
CUIText(CBGame *inGame = NULL);
virtual ~CUIText();
TTextAlign _textAlign;
TVerticalAlign _verticalAlign;
- HRESULT loadFile(const char *filename);
- HRESULT loadBuffer(byte *buffer, bool complete = true);
- virtual HRESULT saveAsText(CBDynBuffer *buffer, int indent);
+ ERRORCODE loadFile(const char *filename);
+ ERRORCODE loadBuffer(byte *buffer, bool complete = true);
+ virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent);
// scripting interface
virtual CScValue *scGetProperty(const char *name);
- virtual HRESULT scSetProperty(const char *name, CScValue *value);
- virtual HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ERRORCODE scSetProperty(const char *name, CScValue *value);
+ virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
virtual const char *scToString();
};
diff --git a/engines/wintermute/UI/UITiledImage.cpp b/engines/wintermute/UI/UITiledImage.cpp
index 4b115c98e3..05f6a0bed5 100644
--- a/engines/wintermute/UI/UITiledImage.cpp
+++ b/engines/wintermute/UI/UITiledImage.cpp
@@ -64,8 +64,8 @@ CUITiledImage::~CUITiledImage() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CUITiledImage::display(int x, int y, int width, int height) {
- if (!_image) return E_FAIL;
+ERRORCODE CUITiledImage::display(int x, int y, int width, int height) {
+ if (!_image) return STATUS_FAILED;
int tileWidth = _middleMiddle.right - _middleMiddle.left;
int tileHeight = _middleMiddle.bottom - _middleMiddle.top;
@@ -114,24 +114,24 @@ HRESULT CUITiledImage::display(int x, int y, int width, int height) {
Game->_renderer->endSpriteBatch();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CUITiledImage::loadFile(const char *filename) {
+ERRORCODE CUITiledImage::loadFile(const char *filename) {
byte *buffer = Game->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
Game->LOG(0, "CUITiledImage::LoadFile failed for file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
- HRESULT ret;
+ ERRORCODE ret;
_filename = new char [strlen(filename) + 1];
strcpy(_filename, filename);
- if (FAILED(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing TILED_IMAGE file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing TILED_IMAGE file '%s'", filename);
delete [] buffer;
@@ -158,7 +158,7 @@ TOKEN_DEF(HORIZONTAL_TILES)
TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-HRESULT CUITiledImage::loadBuffer(byte *buffer, bool complete) {
+ERRORCODE CUITiledImage::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(TILED_IMAGE)
TOKEN_TABLE(TEMPLATE)
@@ -187,7 +187,7 @@ HRESULT CUITiledImage::loadBuffer(byte *buffer, bool complete) {
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_TILED_IMAGE) {
Game->LOG(0, "'TILED_IMAGE' keyword expected.");
- return E_FAIL;
+ return STATUS_FAILED;
}
buffer = params;
}
@@ -195,13 +195,13 @@ HRESULT CUITiledImage::loadBuffer(byte *buffer, bool complete) {
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
switch (cmd) {
case TOKEN_TEMPLATE:
- if (FAILED(loadFile((char *)params))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(loadFile((char *)params))) cmd = PARSERR_GENERIC;
break;
case TOKEN_IMAGE:
delete _image;
_image = new CBSubFrame(Game);
- if (!_image || FAILED(_image->setSurface((char *)params))) {
+ if (!_image || DID_FAIL(_image->setSurface((char *)params))) {
delete _image;
_image = NULL;
cmd = PARSERR_GENERIC;
@@ -261,11 +261,11 @@ HRESULT CUITiledImage::loadBuffer(byte *buffer, bool complete) {
}
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in TILED_IMAGE definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (cmd == PARSERR_GENERIC) {
Game->LOG(0, "Error loading TILED_IMAGE definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (vTiles && hTiles) {
@@ -303,11 +303,11 @@ HRESULT CUITiledImage::loadBuffer(byte *buffer, bool complete) {
if (CBPlatform::isRectEmpty(&_downRight)) CBPlatform::setRect(&_downRight, 2 * width, 2 * height, 3 * width, 3 * height);
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CUITiledImage::saveAsText(CBDynBuffer *buffer, int indent) {
+ERRORCODE CUITiledImage::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "TILED_IMAGE\n");
buffer->putTextIndent(indent, "{\n");
@@ -333,7 +333,7 @@ HRESULT CUITiledImage::saveAsText(CBDynBuffer *buffer, int indent) {
CBBase::saveAsText(buffer, indent + 2);
buffer->putTextIndent(indent, "}\n");
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -350,7 +350,7 @@ void CUITiledImage::correctSize(int *width, int *height) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CUITiledImage::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CUITiledImage::persist(CBPersistMgr *persistMgr) {
CBObject::persist(persistMgr);
persistMgr->transfer(TMEMBER(_downLeft));
@@ -364,7 +364,7 @@ HRESULT CUITiledImage::persist(CBPersistMgr *persistMgr) {
persistMgr->transfer(TMEMBER(_upMiddle));
persistMgr->transfer(TMEMBER(_upRight));
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/UI/UITiledImage.h b/engines/wintermute/UI/UITiledImage.h
index 583184cb51..22f472dc28 100644
--- a/engines/wintermute/UI/UITiledImage.h
+++ b/engines/wintermute/UI/UITiledImage.h
@@ -38,11 +38,11 @@ class CUITiledImage : public CBObject {
public:
DECLARE_PERSISTENT(CUITiledImage, CBObject)
void correctSize(int *width, int *height);
- HRESULT loadFile(const char *filename);
- HRESULT loadBuffer(byte *buffer, bool complete = true);
- virtual HRESULT saveAsText(CBDynBuffer *buffer, int indent);
+ ERRORCODE loadFile(const char *filename);
+ ERRORCODE loadBuffer(byte *buffer, bool complete = true);
+ virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent);
- HRESULT display(int x, int y, int width, int height);
+ ERRORCODE display(int x, int y, int width, int height);
CUITiledImage(CBGame *inGame = NULL);
virtual ~CUITiledImage();
CBSubFrame *_image;
diff --git a/engines/wintermute/UI/UIWindow.cpp b/engines/wintermute/UI/UIWindow.cpp
index c93a00402b..d00d07a819 100644
--- a/engines/wintermute/UI/UIWindow.cpp
+++ b/engines/wintermute/UI/UIWindow.cpp
@@ -113,7 +113,7 @@ void CUIWindow::cleanup() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIWindow::display(int offsetX, int offsetY) {
+ERRORCODE CUIWindow::display(int offsetX, int offsetY) {
// go exclusive
if (_mode == WINDOW_EXCLUSIVE || _mode == WINDOW_SYSTEM_EXCLUSIVE) {
if (!_shieldWindow) _shieldWindow = new CUIWindow(Game);
@@ -141,7 +141,7 @@ HRESULT CUIWindow::display(int offsetX, int offsetY) {
}
if (!_visible)
- return S_OK;
+ return STATUS_OK;
if (_fadeBackground) Game->_renderer->fadeToColor(_fadeColor);
@@ -202,24 +202,24 @@ HRESULT CUIWindow::display(int offsetX, int offsetY) {
if (popViewport)
Game->popViewport();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIWindow::loadFile(const char *filename) {
+ERRORCODE CUIWindow::loadFile(const char *filename) {
byte *buffer = Game->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
Game->LOG(0, "CUIWindow::LoadFile failed for file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
- HRESULT ret;
+ ERRORCODE ret;
_filename = new char [strlen(filename) + 1];
strcpy(_filename, filename);
- if (FAILED(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing WINDOW file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer, true))) Game->LOG(0, "Error parsing WINDOW file '%s'", filename);
delete [] buffer;
@@ -266,7 +266,7 @@ TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF(EDIT)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIWindow::loadBuffer(byte *buffer, bool complete) {
+ERRORCODE CUIWindow::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(WINDOW)
TOKEN_TABLE(ALPHA_COLOR)
@@ -316,7 +316,7 @@ HRESULT CUIWindow::loadBuffer(byte *buffer, bool complete) {
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)&params) != TOKEN_WINDOW) {
Game->LOG(0, "'WINDOW' keyword expected.");
- return E_FAIL;
+ return STATUS_FAILED;
}
buffer = params;
}
@@ -324,7 +324,7 @@ HRESULT CUIWindow::loadBuffer(byte *buffer, bool complete) {
while (cmd >= PARSERR_TOKENNOTFOUND && (cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) >= PARSERR_TOKENNOTFOUND) {
switch (cmd) {
case TOKEN_TEMPLATE:
- if (FAILED(loadFile((char *)params))) cmd = PARSERR_GENERIC;
+ if (DID_FAIL(loadFile((char *)params))) cmd = PARSERR_GENERIC;
break;
case TOKEN_NAME:
@@ -338,7 +338,7 @@ HRESULT CUIWindow::loadBuffer(byte *buffer, bool complete) {
case TOKEN_BACK:
delete _back;
_back = new CUITiledImage(Game);
- if (!_back || FAILED(_back->loadFile((char *)params))) {
+ if (!_back || DID_FAIL(_back->loadFile((char *)params))) {
delete _back;
_back = NULL;
cmd = PARSERR_GENERIC;
@@ -348,7 +348,7 @@ HRESULT CUIWindow::loadBuffer(byte *buffer, bool complete) {
case TOKEN_BACK_INACTIVE:
delete _backInactive;
_backInactive = new CUITiledImage(Game);
- if (!_backInactive || FAILED(_backInactive->loadFile((char *)params))) {
+ if (!_backInactive || DID_FAIL(_backInactive->loadFile((char *)params))) {
delete _backInactive;
_backInactive = NULL;
cmd = PARSERR_GENERIC;
@@ -358,7 +358,7 @@ HRESULT CUIWindow::loadBuffer(byte *buffer, bool complete) {
case TOKEN_IMAGE:
delete _image;
_image = new CBSprite(Game);
- if (!_image || FAILED(_image->loadFile((char *)params))) {
+ if (!_image || DID_FAIL(_image->loadFile((char *)params))) {
delete _image;
_image = NULL;
cmd = PARSERR_GENERIC;
@@ -368,7 +368,7 @@ HRESULT CUIWindow::loadBuffer(byte *buffer, bool complete) {
case TOKEN_IMAGE_INACTIVE:
delete _imageInactive,
_imageInactive = new CBSprite(Game);
- if (!_imageInactive || FAILED(_imageInactive->loadFile((char *)params))) {
+ if (!_imageInactive || DID_FAIL(_imageInactive->loadFile((char *)params))) {
delete _imageInactive;
_imageInactive = NULL;
cmd = PARSERR_GENERIC;
@@ -425,7 +425,7 @@ HRESULT CUIWindow::loadBuffer(byte *buffer, bool complete) {
case TOKEN_CURSOR:
delete _cursor;
_cursor = new CBSprite(Game);
- if (!_cursor || FAILED(_cursor->loadFile((char *)params))) {
+ if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
delete _cursor;
_cursor = NULL;
cmd = PARSERR_GENERIC;
@@ -434,7 +434,7 @@ HRESULT CUIWindow::loadBuffer(byte *buffer, bool complete) {
case TOKEN_BUTTON: {
CUIButton *btn = new CUIButton(Game);
- if (!btn || FAILED(btn->loadBuffer(params, false))) {
+ if (!btn || DID_FAIL(btn->loadBuffer(params, false))) {
delete btn;
btn = NULL;
cmd = PARSERR_GENERIC;
@@ -447,7 +447,7 @@ HRESULT CUIWindow::loadBuffer(byte *buffer, bool complete) {
case TOKEN_STATIC: {
CUIText *text = new CUIText(Game);
- if (!text || FAILED(text->loadBuffer(params, false))) {
+ if (!text || DID_FAIL(text->loadBuffer(params, false))) {
delete text;
text = NULL;
cmd = PARSERR_GENERIC;
@@ -460,7 +460,7 @@ HRESULT CUIWindow::loadBuffer(byte *buffer, bool complete) {
case TOKEN_EDIT: {
CUIEdit *edit = new CUIEdit(Game);
- if (!edit || FAILED(edit->loadBuffer(params, false))) {
+ if (!edit || DID_FAIL(edit->loadBuffer(params, false))) {
delete edit;
edit = NULL;
cmd = PARSERR_GENERIC;
@@ -473,7 +473,7 @@ HRESULT CUIWindow::loadBuffer(byte *buffer, bool complete) {
case TOKEN_WINDOW: {
CUIWindow *win = new CUIWindow(Game);
- if (!win || FAILED(win->loadBuffer(params, false))) {
+ if (!win || DID_FAIL(win->loadBuffer(params, false))) {
delete win;
win = NULL;
cmd = PARSERR_GENERIC;
@@ -545,18 +545,18 @@ HRESULT CUIWindow::loadBuffer(byte *buffer, bool complete) {
default:
- if (FAILED(Game->windowLoadHook(this, (char **)&buffer, (char **)params))) {
+ if (DID_FAIL(Game->windowLoadHook(this, (char **)&buffer, (char **)params))) {
cmd = PARSERR_GENERIC;
}
}
}
if (cmd == PARSERR_TOKENNOTFOUND) {
Game->LOG(0, "Syntax error in WINDOW definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (cmd == PARSERR_GENERIC) {
Game->LOG(0, "Error loading WINDOW definition");
- return E_FAIL;
+ return STATUS_FAILED;
}
correctSize();
@@ -564,18 +564,18 @@ HRESULT CUIWindow::loadBuffer(byte *buffer, bool complete) {
if (alpha != 0 && ar == 0 && ag == 0 && ab == 0) {
ar = ag = ab = 255;
}
- _alphaColor = DRGBA(ar, ag, ab, alpha);
+ _alphaColor = BYTETORGBA(ar, ag, ab, alpha);
if (_fadeBackground)
- _fadeColor = DRGBA(fadeR, fadeG, fadeB, fadeA);
+ _fadeColor = BYTETORGBA(fadeR, fadeG, fadeB, fadeA);
_focusedWidget = NULL;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIWindow::saveAsText(CBDynBuffer *buffer, int indent) {
+ERRORCODE CUIWindow::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "WINDOW\n");
buffer->putTextIndent(indent, "{\n");
@@ -649,12 +649,12 @@ HRESULT CUIWindow::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent + 2, "\n");
if (_fadeBackground) {
- buffer->putTextIndent(indent + 2, "FADE_COLOR { %d, %d, %d }\n", D3DCOLGetR(_fadeColor), D3DCOLGetG(_fadeColor), D3DCOLGetB(_fadeColor));
- buffer->putTextIndent(indent + 2, "FADE_ALPHA=%d\n", D3DCOLGetA(_fadeColor));
+ buffer->putTextIndent(indent + 2, "FADE_COLOR { %d, %d, %d }\n", RGBCOLGetR(_fadeColor), RGBCOLGetG(_fadeColor), RGBCOLGetB(_fadeColor));
+ buffer->putTextIndent(indent + 2, "FADE_ALPHA=%d\n", RGBCOLGetA(_fadeColor));
}
- buffer->putTextIndent(indent + 2, "ALPHA_COLOR { %d, %d, %d }\n", D3DCOLGetR(_alphaColor), D3DCOLGetG(_alphaColor), D3DCOLGetB(_alphaColor));
- buffer->putTextIndent(indent + 2, "ALPHA=%d\n", D3DCOLGetA(_alphaColor));
+ buffer->putTextIndent(indent + 2, "ALPHA_COLOR { %d, %d, %d }\n", RGBCOLGetR(_alphaColor), RGBCOLGetG(_alphaColor), RGBCOLGetB(_alphaColor));
+ buffer->putTextIndent(indent + 2, "ALPHA=%d\n", RGBCOLGetA(_alphaColor));
buffer->putTextIndent(indent + 2, "\n");
@@ -674,31 +674,31 @@ HRESULT CUIWindow::saveAsText(CBDynBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "}\n");
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIWindow::enableWidget(const char *name, bool Enable) {
+ERRORCODE CUIWindow::enableWidget(const char *name, bool Enable) {
for (int i = 0; i < _widgets.GetSize(); i++) {
if (scumm_stricmp(_widgets[i]->_name, name) == 0) _widgets[i]->_disable = !Enable;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIWindow::showWidget(const char *name, bool Visible) {
+ERRORCODE CUIWindow::showWidget(const char *name, bool Visible) {
for (int i = 0; i < _widgets.GetSize(); i++) {
if (scumm_stricmp(_widgets[i]->_name, name) == 0) _widgets[i]->_visible = Visible;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+ERRORCODE CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// GetWidget / GetControl
//////////////////////////////////////////////////////////////////////////
@@ -713,13 +713,13 @@ HRESULT CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
for (int i = 0; i < _widgets.GetSize(); i++) {
if (scumm_stricmp(_widgets[i]->_name, val->getString()) == 0) {
stack->pushNative(_widgets[i], true);
- return S_OK;
+ return STATUS_OK;
}
}
stack->pushNULL();
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -732,7 +732,7 @@ HRESULT CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
_fontInactive = Game->_fontStorage->addFont(stack->pop()->getString());
stack->pushBool(_fontInactive != NULL);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -744,13 +744,13 @@ HRESULT CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
delete _imageInactive;
_imageInactive = new CBSprite(Game);
const char *filename = stack->pop()->getString();
- if (!_imageInactive || FAILED(_imageInactive->loadFile(filename))) {
+ if (!_imageInactive || DID_FAIL(_imageInactive->loadFile(filename))) {
delete _imageInactive;
_imageInactive = NULL;
stack->pushBool(false);
} else stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -761,7 +761,7 @@ HRESULT CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
if (!_imageInactive || !_imageInactive->_filename) stack->pushNULL();
else stack->pushString(_imageInactive->_filename);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -772,7 +772,7 @@ HRESULT CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
if (!_imageInactive) stack->pushNULL();
else stack->pushNative(_imageInactive, true);
- return S_OK;
+ return STATUS_OK;
}
@@ -781,8 +781,8 @@ HRESULT CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Close") == 0) {
stack->correctParams(0);
- stack->pushBool(SUCCEEDED(close()));
- return S_OK;
+ stack->pushBool(DID_SUCCEED(close()));
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -793,7 +793,7 @@ HRESULT CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
goExclusive();
script->waitFor(this);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -804,7 +804,7 @@ HRESULT CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
goSystemExclusive();
script->waitFor(this);
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -815,7 +815,7 @@ HRESULT CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
_posX = (Game->_renderer->_width - _width) / 2;
_posY = (Game->_renderer->_height - _height) / 2;
stack->pushNULL();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -827,10 +827,10 @@ HRESULT CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
CScValue *val = stack->pop();
cleanup();
if (!val->isNULL()) {
- stack->pushBool(SUCCEEDED(loadFile(val->getString())));
+ stack->pushBool(DID_SUCCEED(loadFile(val->getString())));
} else stack->pushBool(true);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -847,7 +847,7 @@ HRESULT CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
btn->_parent = this;
_widgets.Add(btn);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -864,7 +864,7 @@ HRESULT CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
sta->_parent = this;
_widgets.Add(sta);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -881,7 +881,7 @@ HRESULT CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
edi->_parent = this;
_widgets.Add(edi);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -898,7 +898,7 @@ HRESULT CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
win->_parent = this;
_widgets.Add(win);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -917,8 +917,8 @@ HRESULT CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
}
}
stack->pushNULL();
- return S_OK;
- } else if SUCCEEDED(Game->windowScriptMethodHook(this, script, stack, name)) return S_OK;
+ return STATUS_OK;
+ } else if DID_SUCCEED(Game->windowScriptMethodHook(this, script, stack, name)) return STATUS_OK;
else return CUIObject::scCallMethod(script, stack, thisStack, name);
}
@@ -1013,13 +1013,13 @@ CScValue *CUIWindow::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIWindow::scSetProperty(const char *name, CScValue *value) {
+ERRORCODE CUIWindow::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
// Name
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "Name") == 0) {
setName(value->getString());
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1027,7 +1027,7 @@ HRESULT CUIWindow::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Menu") == 0) {
_isMenu = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1035,7 +1035,7 @@ HRESULT CUIWindow::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "InGame") == 0) {
_inGame = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1043,7 +1043,7 @@ HRESULT CUIWindow::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "PauseMusic") == 0) {
_pauseMusic = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1051,7 +1051,7 @@ HRESULT CUIWindow::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "ClipContents") == 0) {
_clipContents = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1059,7 +1059,7 @@ HRESULT CUIWindow::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Transparent") == 0) {
_transparent = value->getBool();
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1068,7 +1068,7 @@ HRESULT CUIWindow::scSetProperty(const char *name, CScValue *value) {
else if (strcmp(name, "FadeColor") == 0) {
_fadeColor = (uint32)value->getInt();
_fadeBackground = (_fadeColor != 0);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1081,7 +1081,7 @@ HRESULT CUIWindow::scSetProperty(const char *name, CScValue *value) {
close();
_visible = true;
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -1094,7 +1094,7 @@ HRESULT CUIWindow::scSetProperty(const char *name, CScValue *value) {
close();
_visible = true;
}
- return S_OK;
+ return STATUS_OK;
}
else return CUIObject::scSetProperty(name, value);
@@ -1111,7 +1111,7 @@ const char *CUIWindow::scToString() {
bool CUIWindow::handleKeypress(Common::Event *event, bool printable) {
//TODO
if (event->type == Common::EVENT_KEYDOWN && event->kbd.keycode == Common::KEYCODE_TAB) {
- return SUCCEEDED(moveFocus(!CBKeyboardState::isShiftDown()));
+ return DID_SUCCEED(moveFocus(!CBKeyboardState::isShiftDown()));
} else {
if (_focusedWidget) return _focusedWidget->handleKeypress(event, printable);
else return false;
@@ -1128,8 +1128,8 @@ bool CUIWindow::handleMouseWheel(int Delta) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIWindow::handleMouse(TMouseEvent event, TMouseButton button) {
- HRESULT res = CUIObject::handleMouse(event, button);
+ERRORCODE CUIWindow::handleMouse(TMouseEvent event, TMouseButton button) {
+ ERRORCODE res = CUIObject::handleMouse(event, button);
// handle window dragging
if (!CBPlatform::isRectEmpty(&_dragRect)) {
@@ -1158,7 +1158,7 @@ HRESULT CUIWindow::handleMouse(TMouseEvent event, TMouseButton button) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIWindow::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CUIWindow::persist(CBPersistMgr *persistMgr) {
CUIObject::persist(persistMgr);
@@ -1184,12 +1184,12 @@ HRESULT CUIWindow::persist(CBPersistMgr *persistMgr) {
_widgets.persist(persistMgr);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIWindow::moveFocus(bool forward) {
+ERRORCODE CUIWindow::moveFocus(bool forward) {
int i;
bool found = false;
for (i = 0; i < _widgets.GetSize(); i++) {
@@ -1202,7 +1202,7 @@ HRESULT CUIWindow::moveFocus(bool forward) {
if (!_focusedWidget) {
if (_widgets.GetSize() > 0) i = 0;
- else return S_OK;
+ else return STATUS_OK;
}
int numTries = 0;
@@ -1225,13 +1225,13 @@ HRESULT CUIWindow::moveFocus(bool forward) {
numTries++;
}
- return done ? S_OK : E_FAIL;
+ return done ? STATUS_OK : STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIWindow::goExclusive() {
- if (_mode == WINDOW_EXCLUSIVE) return S_OK;
+ERRORCODE CUIWindow::goExclusive() {
+ if (_mode == WINDOW_EXCLUSIVE) return STATUS_OK;
if (_mode == WINDOW_NORMAL) {
_ready = false;
@@ -1239,14 +1239,14 @@ HRESULT CUIWindow::goExclusive() {
_visible = true;
_disable = false;
Game->focusWindow(this);
- return S_OK;
- } else return E_FAIL;
+ return STATUS_OK;
+ } else return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIWindow::goSystemExclusive() {
- if (_mode == WINDOW_SYSTEM_EXCLUSIVE) return S_OK;
+ERRORCODE CUIWindow::goSystemExclusive() {
+ if (_mode == WINDOW_SYSTEM_EXCLUSIVE) return STATUS_OK;
makeFreezable(false);
@@ -1257,12 +1257,12 @@ HRESULT CUIWindow::goSystemExclusive() {
Game->focusWindow(this);
Game->freeze(_pauseMusic);
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIWindow::close() {
+ERRORCODE CUIWindow::close() {
if (_mode == WINDOW_SYSTEM_EXCLUSIVE) {
Game->unfreeze();
}
@@ -1271,12 +1271,12 @@ HRESULT CUIWindow::close() {
_visible = false;
_ready = true;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIWindow::listen(CBScriptHolder *param1, uint32 param2) {
+ERRORCODE CUIWindow::listen(CBScriptHolder *param1, uint32 param2) {
CUIObject *obj = (CUIObject *)param1;
switch (obj->_type) {
@@ -1288,7 +1288,7 @@ HRESULT CUIWindow::listen(CBScriptHolder *param1, uint32 param2) {
return CBObject::listen(param1, param2);
}
- return S_OK;
+ return STATUS_OK;
}
@@ -1302,7 +1302,7 @@ void CUIWindow::makeFreezable(bool freezable) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CUIWindow::getWindowObjects(CBArray<CUIObject *, CUIObject *> &objects, bool interactiveOnly) {
+ERRORCODE CUIWindow::getWindowObjects(CBArray<CUIObject *, CUIObject *> &objects, bool interactiveOnly) {
for (int i = 0; i < _widgets.GetSize(); i++) {
CUIObject *control = _widgets[i];
if (control->_disable && interactiveOnly) continue;
@@ -1321,7 +1321,7 @@ HRESULT CUIWindow::getWindowObjects(CBArray<CUIObject *, CUIObject *> &objects,
if (!interactiveOnly) objects.Add(control);
}
}
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/UI/UIWindow.h b/engines/wintermute/UI/UIWindow.h
index a7492ae8ef..80e5761ddc 100644
--- a/engines/wintermute/UI/UIWindow.h
+++ b/engines/wintermute/UI/UIWindow.h
@@ -39,7 +39,7 @@ class CUIButton;
class CBViewport;
class CUIWindow : public CUIObject {
public:
- HRESULT getWindowObjects(CBArray<CUIObject *, CUIObject *> &Objects, bool InteractiveOnly);
+ ERRORCODE getWindowObjects(CBArray<CUIObject *, CUIObject *> &Objects, bool InteractiveOnly);
bool _pauseMusic;
void cleanup();
@@ -53,38 +53,38 @@ public:
virtual bool handleMouseWheel(int delta);
CUIWindow *_shieldWindow;
CUIButton *_shieldButton;
- HRESULT close();
- HRESULT goSystemExclusive();
- HRESULT goExclusive();
+ ERRORCODE close();
+ ERRORCODE goSystemExclusive();
+ ERRORCODE goExclusive();
TWindowMode _mode;
- HRESULT moveFocus(bool forward = true);
- virtual HRESULT handleMouse(TMouseEvent Event, TMouseButton Button);
+ ERRORCODE moveFocus(bool forward = true);
+ virtual ERRORCODE handleMouse(TMouseEvent Event, TMouseButton Button);
POINT _dragFrom;
bool _dragging;
DECLARE_PERSISTENT(CUIWindow, CUIObject)
bool _transparent;
- HRESULT showWidget(const char *name, bool visible = true);
- HRESULT enableWidget(const char *name, bool enable = true);
+ ERRORCODE showWidget(const char *name, bool visible = true);
+ ERRORCODE enableWidget(const char *name, bool enable = true);
RECT _titleRect;
RECT _dragRect;
- virtual HRESULT display(int offsetX = 0, int offsetY = 0);
+ virtual ERRORCODE display(int offsetX = 0, int offsetY = 0);
CUIWindow(CBGame *inGame);
virtual ~CUIWindow();
virtual bool handleKeypress(Common::Event *event, bool printable = false);
CBArray<CUIObject *, CUIObject *> _widgets;
TTextAlign _titleAlign;
- HRESULT loadFile(const char *filename);
- HRESULT loadBuffer(byte *buffer, bool complete = true);
+ ERRORCODE loadFile(const char *filename);
+ ERRORCODE loadBuffer(byte *buffer, bool complete = true);
CUITiledImage *_backInactive;
CBFont *_fontInactive;
CBSprite *_imageInactive;
- virtual HRESULT listen(CBScriptHolder *param1, uint32 param2);
- virtual HRESULT saveAsText(CBDynBuffer *buffer, int indent);
+ virtual ERRORCODE listen(CBScriptHolder *param1, uint32 param2);
+ virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent);
// scripting interface
virtual CScValue *scGetProperty(const char *name);
- virtual HRESULT scSetProperty(const char *name, CScValue *value);
- virtual HRESULT scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ERRORCODE scSetProperty(const char *name, CScValue *value);
+ virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
virtual const char *scToString();
};
diff --git a/engines/wintermute/coll_templ.h b/engines/wintermute/coll_templ.h
index c9e85253e5..59d0241419 100644
--- a/engines/wintermute/coll_templ.h
+++ b/engines/wintermute/coll_templ.h
@@ -88,7 +88,7 @@ public:
// Clean up
void FreeExtra();
void RemoveAll();
- HRESULT persist(CBPersistMgr *persistMgr);
+ ERRORCODE persist(CBPersistMgr *persistMgr);
// Accessing elements
TYPE GetAt(int nIndex) const;
@@ -346,7 +346,7 @@ void CBArray<TYPE, ARG_TYPE>::InsertAt(int nStartIndex, CBArray *pNewArray) {
/////////////////////////////////////////////////////////////////////////////
template<class TYPE, class ARG_TYPE>
-HRESULT CBArray<TYPE, ARG_TYPE>::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CBArray<TYPE, ARG_TYPE>::persist(CBPersistMgr *persistMgr) {
int i, j;
if (persistMgr->_saving) {
j = GetSize();
@@ -364,7 +364,7 @@ HRESULT CBArray<TYPE, ARG_TYPE>::persist(CBPersistMgr *persistMgr) {
Add(obj);
}
}
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/persistent.h b/engines/wintermute/persistent.h
index 5d4acda210..efdd651154 100644
--- a/engines/wintermute/persistent.h
+++ b/engines/wintermute/persistent.h
@@ -37,7 +37,7 @@ class CBPersistMgr;
// persistence support
typedef void *(*PERSISTBUILD)(void);
-typedef HRESULT(*PERSISTLOAD)(void *, CBPersistMgr *);
+typedef ERRORCODE(*PERSISTLOAD)(void *, CBPersistMgr *);
typedef void (*SYS_INSTANCE_CALLBACK)(void *Instance, void *Data);
} // end of namespace WinterMute
@@ -50,9 +50,9 @@ namespace WinterMute {
static const char _className[];\
static void* persistBuild(void);\
virtual const char* getClassName();\
- static HRESULT persistLoad(void* Instance, CBPersistMgr* PersistMgr);\
+ static ERRORCODE persistLoad(void* Instance, CBPersistMgr* PersistMgr);\
class_name(TDynamicConstructor p1, TDynamicConstructor p2):parent_class(p1, p2){ /*memset(this, 0, sizeof(class_name));*/ };\
- virtual HRESULT persist(CBPersistMgr* PersistMgr);\
+ virtual ERRORCODE persist(CBPersistMgr* PersistMgr);\
void* operator new (size_t size);\
void operator delete(void* p);\
@@ -63,7 +63,7 @@ namespace WinterMute {
return ::new class_name(DYNAMIC_CONSTRUCTOR, DYNAMIC_CONSTRUCTOR);\
}\
\
- HRESULT class_name::persistLoad(void* Instance, CBPersistMgr* PersistMgr){\
+ ERRORCODE class_name::persistLoad(void* Instance, CBPersistMgr* PersistMgr){\
return ((class_name*)Instance)->persist(PersistMgr);\
}\
\
diff --git a/engines/wintermute/utils/PathUtil.cpp b/engines/wintermute/utils/PathUtil.cpp
index cc1f2f3d44..cfc3db916e 100644
--- a/engines/wintermute/utils/PathUtil.cpp
+++ b/engines/wintermute/utils/PathUtil.cpp
@@ -166,7 +166,7 @@ AnsiString PathUtil::getUserDirectory() {
buffer[0] = '\0';
LPITEMIDLIST pidl = NULL;
LPMALLOC pMalloc;
- if (SUCCEEDED(SHGetMalloc(&pMalloc))) {
+ if (DID_SUCCEED(SHGetMalloc(&pMalloc))) {
SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA, &pidl);
if (pidl) {
SHGetPathFromIDList(pidl, buffer);
diff --git a/engines/wintermute/utils/utils.cpp b/engines/wintermute/utils/utils.cpp
index 46e5a8da36..ca68b3c691 100644
--- a/engines/wintermute/utils/utils.cpp
+++ b/engines/wintermute/utils/utils.cpp
@@ -256,9 +256,9 @@ char *CBUtils::getFilename(const char *filename) {
//////////////////////////////////////////////////////////////////////////
void CBUtils::RGBtoHSL(uint32 RGBColor, byte *OutH, byte *OutS, byte *OutL) {
- float var_R = (D3DCOLGetR(RGBColor) / 255.0f);
- float var_G = (D3DCOLGetG(RGBColor) / 255.0f);
- float var_B = (D3DCOLGetB(RGBColor) / 255.0f);
+ float var_R = (RGBCOLGetR(RGBColor) / 255.0f);
+ float var_G = (RGBCOLGetG(RGBColor) / 255.0f);
+ float var_B = (RGBCOLGetB(RGBColor) / 255.0f);
//Min. value of RGB
float var_Min = MIN(var_R, var_G);
@@ -328,7 +328,7 @@ uint32 CBUtils::HSLtoRGB(byte InH, byte InS, byte InL) {
G = (byte)(255 * Hue2RGB(var_1, var_2, H));
B = (byte)(255 * Hue2RGB(var_1, var_2, H - (1.0f / 3.0f)));
}
- return DRGBA(255, R, G, B);
+ return BYTETORGBA(255, R, G, B);
}
diff --git a/engines/wintermute/video/VidPlayer.cpp b/engines/wintermute/video/VidPlayer.cpp
index 1e4b25e143..51453fb34b 100644
--- a/engines/wintermute/video/VidPlayer.cpp
+++ b/engines/wintermute/video/VidPlayer.cpp
@@ -45,7 +45,7 @@ CVidPlayer::CVidPlayer(CBGame *inGame): CBBase(inGame) {
//////////////////////////////////////////////////////////////////////////
-HRESULT CVidPlayer::SetDefaults() {
+ERRORCODE CVidPlayer::SetDefaults() {
_playing = false;
/* _aviFile = NULL;
@@ -80,7 +80,7 @@ HRESULT CVidPlayer::SetDefaults() {
_currentSubtitle = 0;
_showSubtitle = false;
- return S_OK;
+ return STATUS_OK;
}
@@ -91,7 +91,7 @@ CVidPlayer::~CVidPlayer() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CVidPlayer::cleanup() {
+ERRORCODE CVidPlayer::cleanup() {
#if 0
if (_sound) _sound->Stop();
if (_videoPGF) AVIStreamGetFrameClose(_videoPGF);
@@ -124,7 +124,7 @@ HRESULT CVidPlayer::cleanup() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CVidPlayer::initialize(const char *inFilename, const char *SubtitleFile) {
+ERRORCODE CVidPlayer::initialize(const char *inFilename, const char *SubtitleFile) {
#if 0
cleanup();
@@ -134,13 +134,13 @@ HRESULT CVidPlayer::initialize(const char *inFilename, const char *SubtitleFile)
// open file
if (AVIFileOpen(&_aviFile, Filename, OF_READ, NULL) != 0) {
Game->LOG(0, "Error opening AVI file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
// get video stream
if (AVIFileGetStream(_aviFile, &_videoStream, streamtypeVIDEO, 0) != 0) {
Game->LOG(0, "Error finding video stream in AVI file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
_totalVideoTime = AVIStreamEndTime(_videoStream);
@@ -156,7 +156,7 @@ HRESULT CVidPlayer::initialize(const char *inFilename, const char *SubtitleFile)
// get video format
if (AVIStreamReadFormat(m_VideoStream, 0, NULL, &Size)) {
Game->LOG(0, "Error obtaining video stream format in AVI file '%s'", filename);
- return E_FAIL;
+ return STATUS_FAILED;
}
_videoFormat = (LPBITMAPINFO)new BYTE[Size];
AVIStreamReadFormat(m_VideoStream, 0, m_VideoFormat, &Size);
@@ -175,19 +175,19 @@ HRESULT CVidPlayer::initialize(const char *inFilename, const char *SubtitleFile)
else
m_VidRenderer = new CVidRendererDD(Game);
- if (!m_VidRenderer || FAILED(m_VidRenderer->Initialize(m_VideoFormat, m_TargetFormat))) {
+ if (!m_VidRenderer || DID_FAIL(m_VidRenderer->Initialize(m_VideoFormat, m_TargetFormat))) {
Game->LOG(0, "Error initializing video renderer for AVI file '%s'", filename);
SAFE_DELETE(m_VidRenderer);
- return E_FAIL;
+ return STATUS_FAILED;
}
// create sound buffer
- HRESULT res;
+ ERRORCODE res;
if (_soundAvailable) {
_sound = new CBSoundAVI(Game);
- if (FAILED(res = _sound->InitializeBuffer(_audioStream))) {
+ if (DID_FAIL(res = _sound->InitializeBuffer(_audioStream))) {
SAFE_DELETE(_sound);
_soundAvailable = false;
Game->LOG(res, "Error initializing sound buffer for AVI file '%s'", filename);
@@ -199,20 +199,20 @@ HRESULT CVidPlayer::initialize(const char *inFilename, const char *SubtitleFile)
_filename = new char[strlen(filename) + 1];
if (_filename) strcpy(_filename, filename);
#endif
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CVidPlayer::update() {
+ERRORCODE CVidPlayer::update() {
#if 0
- if (!m_Playing) return S_OK;
+ if (!m_Playing) return STATUS_OK;
- HRESULT res;
+ ERRORCODE res;
if (_soundAvailable && m_Sound) {
res = _sound->update();
- if (FAILED(res)) return res;
+ if (DID_FAIL(res)) return res;
}
@@ -231,7 +231,7 @@ HRESULT CVidPlayer::update() {
if (CurrentTime >= _totalVideoTime) {
Stop();
- return S_OK;
+ return STATUS_OK;
}
@@ -266,21 +266,21 @@ HRESULT CVidPlayer::update() {
if (FrameData) {
if (_slowRendering) return _vidRenderer->ProcessFrameSlow(FrameData);
else return _vidRenderer->ProcessFrame(FrameData);
- } else return E_FAIL;
- } else return S_OK;
+ } else return STATUS_FAILED;
+ } else return STATUS_OK;
#endif
return 0;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CVidPlayer::display() {
+ERRORCODE CVidPlayer::display() {
#if 0
- if (!m_Playing) return S_OK;
+ if (!m_Playing) return STATUS_OK;
- HRESULT res;
+ ERRORCODE res;
if (_vidRenderer) res = _vidRenderer->display(m_PlayPosX, m_PlayPosY, m_PlayZoom);
- else res = E_FAIL;
+ else res = STATUS_FAILED;
// display subtitle
if (m_ShowSubtitle) {
@@ -298,9 +298,9 @@ HRESULT CVidPlayer::display() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CVidPlayer::play(TVideoPlayback Type, int X, int Y, bool FreezeMusic) {
+ERRORCODE CVidPlayer::play(TVideoPlayback Type, int X, int Y, bool FreezeMusic) {
#if 0
- if (!_videoStream || !_vidRenderer) return E_FAIL;
+ if (!_videoStream || !_vidRenderer) return STATUS_FAILED;
switch (Type) {
case VID_PLAY_POS:
@@ -335,7 +335,7 @@ HRESULT CVidPlayer::play(TVideoPlayback Type, int X, int Y, bool FreezeMusic) {
if (!_videoPGF) {
Game->LOG(0, "Error: Unsupported AVI format (file '%s')", m_Filename);
cleanup();
- return E_FAIL;
+ return STATUS_FAILED;
} else {
Game->LOG(0, "Performance warning: non-optimal AVI format, using generic (i.e. slow) rendering routines (file '%s')", m_Filename);
_slowRendering = true;
@@ -354,20 +354,20 @@ HRESULT CVidPlayer::play(TVideoPlayback Type, int X, int Y, bool FreezeMusic) {
if (_sound) _sound->Play();
_startTime = timeGetTime();
#endif
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CVidPlayer::stop() {
+ERRORCODE CVidPlayer::stop() {
#if 0
- if (!_playing) return S_OK;
+ if (!_playing) return STATUS_OK;
cleanup();
Game->Unfreeze();
#endif
- return S_OK;
+ return STATUS_OK;
}
@@ -378,9 +378,9 @@ bool CVidPlayer::isPlaying() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CVidPlayer::loadSubtitles(const char *filename, const char *SubtitleFile) {
+ERRORCODE CVidPlayer::loadSubtitles(const char *filename, const char *SubtitleFile) {
#if 0
- if (!Filename) return S_OK;
+ if (!Filename) return STATUS_OK;
char NewFile[MAX_PATH];
char drive[_MAX_DRIVE];
@@ -396,7 +396,7 @@ HRESULT CVidPlayer::loadSubtitles(const char *filename, const char *SubtitleFile
DWORD Size;
BYTE *Buffer = Game->m_FileManager->readWholeFile(NewFile, &Size, false);
- if (Buffer == NULL) return S_OK; // no subtitles
+ if (Buffer == NULL) return STATUS_OK; // no subtitles
LONG Start, End;
@@ -464,7 +464,7 @@ HRESULT CVidPlayer::loadSubtitles(const char *filename, const char *SubtitleFile
delete [] Buffer;
#endif
- return S_OK;
+ return STATUS_OK;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/video/VidPlayer.h b/engines/wintermute/video/VidPlayer.h
index b1afa080bd..6b729cac20 100644
--- a/engines/wintermute/video/VidPlayer.h
+++ b/engines/wintermute/video/VidPlayer.h
@@ -46,23 +46,23 @@ class CVidPlayer : public CBBase {
public:
bool _showSubtitle;
int _currentSubtitle;
- HRESULT loadSubtitles(const char *filename, const char *SubtitleFile);
+ ERRORCODE loadSubtitles(const char *filename, const char *SubtitleFile);
bool _slowRendering;
bool isPlaying();
char *_filename;
- HRESULT stop();
- HRESULT play(TVideoPlayback Type = VID_PLAY_CENTER, int X = 0, int Y = 0, bool FreezeMusic = true);
+ ERRORCODE stop();
+ ERRORCODE play(TVideoPlayback Type = VID_PLAY_CENTER, int X = 0, int Y = 0, bool FreezeMusic = true);
uint32 _totalVideoTime;
uint32 _startTime;
//CVidRenderer *_vidRenderer;
//CBSoundAVI *_sound;
bool _soundAvailable;
- HRESULT SetDefaults();
+ ERRORCODE SetDefaults();
bool _playing;
- HRESULT display();
- HRESULT update();
- HRESULT initialize(const char *inFilename, const char *SubtitleFile = NULL);
- HRESULT cleanup();
+ ERRORCODE display();
+ ERRORCODE update();
+ ERRORCODE initialize(const char *inFilename, const char *SubtitleFile = NULL);
+ ERRORCODE cleanup();
CVidPlayer(CBGame *inGame);
virtual ~CVidPlayer();
diff --git a/engines/wintermute/video/VidTheoraPlayer.cpp b/engines/wintermute/video/VidTheoraPlayer.cpp
index f1c3de9283..6b71c2a2fd 100644
--- a/engines/wintermute/video/VidTheoraPlayer.cpp
+++ b/engines/wintermute/video/VidTheoraPlayer.cpp
@@ -133,23 +133,23 @@ void CVidTheoraPlayer::cleanup() {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CVidTheoraPlayer::initialize(const Common::String &filename, const Common::String &subtitleFile) {
+ERRORCODE CVidTheoraPlayer::initialize(const Common::String &filename, const Common::String &subtitleFile) {
cleanup();
_filename = filename;
_file = Game->_fileManager->openFile(filename, true, false);
- if (!_file) return E_FAIL;
+ if (!_file) return STATUS_FAILED;
//if (Filename != _filename) CBUtils::setString(&_filename, filename);
#if defined (USE_THEORADEC)
_theoraDecoder = new TheoraDecoder();
#else
- return E_FAIL;
+ return STATUS_FAILED;
#endif
_theoraDecoder->loadStream(_file);
if (!_theoraDecoder->isVideoLoaded())
- return E_FAIL;
+ return STATUS_FAILED;
_state = THEORA_STATE_PAUSED;
@@ -160,12 +160,12 @@ HRESULT CVidTheoraPlayer::initialize(const Common::String &filename, const Commo
_state = THEORA_STATE_PLAYING;
_playZoom = 100;
- return S_OK;
+ return STATUS_OK;
#if 0
cleanup();
_file = Game->_fileManager->openFile(filename);
- if (!_file) return E_FAIL;
+ if (!_file) return STATUS_FAILED;
if (Filename != _filename) CBUtils::setString(&_filename, filename);
@@ -233,11 +233,11 @@ HRESULT CVidTheoraPlayer::initialize(const Common::String &filename, const Commo
while (m_TheoraStreams && (m_TheoraStreams < 3) && (Ret = ogg_stream_packetout(&m_TheoraStreamState, &TempOggPacket))) {
if (Ret < 0) {
Game->LOG(0, "Error parsing Theora stream headers; corrupt stream?");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (theora_decode_header(&m_TheoraInfo, &m_TheoraComment, &TempOggPacket)) {
Game->LOG(0, "Error parsing Theora stream headers; corrupt stream?");
- return E_FAIL;
+ return STATUS_FAILED;
}
m_TheoraStreams++;
if (m_TheoraStreams == 3) break;
@@ -247,11 +247,11 @@ HRESULT CVidTheoraPlayer::initialize(const Common::String &filename, const Commo
while (m_VorbisStreams && (m_VorbisStreams < 3) && (Ret = ogg_stream_packetout(&m_VorbisStreamState, &TempOggPacket))) {
if (Ret < 0) {
Game->LOG(0, "Error parsing Vorbis stream headers; corrupt stream?");
- return E_FAIL;
+ return STATUS_FAILED;
}
if (vorbis_synthesis_headerin(&m_VorbisInfo, &m_VorbisComment, &TempOggPacket)) {
Game->LOG(0, "Error parsing Vorbis stream headers; corrupt stream?");
- return E_FAIL;
+ return STATUS_FAILED;
}
m_VorbisStreams++;
if (m_VorbisStreams == 3) break;
@@ -268,7 +268,7 @@ HRESULT CVidTheoraPlayer::initialize(const Common::String &filename, const Commo
int Ret = BufferData(&m_OggSyncState); // someone needs more data
if (Ret == 0) {
Game->LOG(0, "End of file while searching for codec headers");
- return E_FAIL;
+ return STATUS_FAILED;
}
}
}
@@ -294,13 +294,13 @@ HRESULT CVidTheoraPlayer::initialize(const Common::String &filename, const Commo
vorbis_comment_clear(&m_VorbisComment);
}
- HRESULT Res = S_OK;
+ ERRORCODE Res = STATUS_OK;
// create sound buffer
if (m_VorbisStreams && Game->m_SoundMgr->m_SoundAvailable) {
m_Sound = new CBSoundTheora(Game);
Game->m_SoundMgr->AddSound(m_Sound);
- if (FAILED(Res = m_Sound->InitializeBuffer(this))) {
+ if (DID_FAIL(Res = m_Sound->InitializeBuffer(this))) {
Game->m_SoundMgr->RemoveSound(m_Sound);
m_Sound = NULL;
Game->LOG(Res, "Error initializing sound buffer for Theora file '%s'", filename);
@@ -318,7 +318,7 @@ HRESULT CVidTheoraPlayer::initialize(const Common::String &filename, const Commo
else
m_Texture = new CBSurfaceDD(Game);
- if (!m_Texture || FAILED(Res = m_Texture->Create(m_TheoraInfo.width, m_TheoraInfo.height))) {
+ if (!m_Texture || DID_FAIL(Res = m_Texture->Create(m_TheoraInfo.width, m_TheoraInfo.height))) {
SAFE_DELETE(m_Texture);
}
}
@@ -329,12 +329,12 @@ HRESULT CVidTheoraPlayer::initialize(const Common::String &filename, const Commo
return Res;
#endif
- return E_FAIL;
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CVidTheoraPlayer::resetStream() {
+ERRORCODE CVidTheoraPlayer::resetStream() {
warning("VidTheoraPlayer::resetStream - stubbed");
#if 0
if (_sound) _sound->Stop();
@@ -343,11 +343,11 @@ HRESULT CVidTheoraPlayer::resetStream() {
Initialize(m_Filename);
Play(m_PlaybackType, m_PosX, m_PosY, false, false, m_Looping, 0, m_PlayZoom);
#endif
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CVidTheoraPlayer::play(TVideoPlayback type, int x, int y, bool freezeGame, bool freezeMusic, bool looping, uint32 startTime, float forceZoom, int volume) {
+ERRORCODE CVidTheoraPlayer::play(TVideoPlayback type, int x, int y, bool freezeGame, bool freezeMusic, bool looping, uint32 startTime, float forceZoom, int volume) {
if (forceZoom < 0.0f)
forceZoom = 100.0f;
if (volume < 0)
@@ -402,7 +402,7 @@ HRESULT CVidTheoraPlayer::play(TVideoPlayback type, int x, int y, bool freezeGam
_posY = (int)((Game->_renderer->_height - height) / 2);
break;
}
- return S_OK;
+ return STATUS_OK;
#if 0
m_State = THEORA_STATE_PLAYING;
@@ -447,11 +447,11 @@ HRESULT CVidTheoraPlayer::play(TVideoPlayback type, int x, int y, bool freezeGam
Update();
#endif
- return E_FAIL;
+ return STATUS_FAILED;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CVidTheoraPlayer::stop() {
+ERRORCODE CVidTheoraPlayer::stop() {
_theoraDecoder->close();
_state = THEORA_STATE_FINISHED;
if (_freezeGame) {
@@ -462,18 +462,18 @@ HRESULT CVidTheoraPlayer::stop() {
m_State = THEORA_STATE_FINISHED;
if (m_FreezeGame) Game->Unfreeze();
#endif
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CVidTheoraPlayer::update() {
+ERRORCODE CVidTheoraPlayer::update() {
_currentTime = _freezeGame ? Game->_liveTimer : Game->_timer;
- if (!isPlaying()) return S_OK;
+ if (!isPlaying()) return STATUS_OK;
- if (_playbackStarted /*&& m_Sound && !m_Sound->IsPlaying()*/) return S_OK;
+ if (_playbackStarted /*&& m_Sound && !m_Sound->IsPlaying()*/) return STATUS_OK;
- if (_playbackStarted && !_freezeGame && Game->_state == GAME_FROZEN) return S_OK;
+ if (_playbackStarted && !_freezeGame && Game->_state == GAME_FROZEN) return STATUS_OK;
if (_theoraDecoder) {
if (_theoraDecoder->endOfVideo() && _looping) {
@@ -492,7 +492,7 @@ HRESULT CVidTheoraPlayer::update() {
WriteVideo();
}
}
- return S_OK;
+ return STATUS_OK;
}
}
// Skip the busy-loop?
@@ -501,21 +501,21 @@ HRESULT CVidTheoraPlayer::update() {
if (!_looping) {
_state = THEORA_STATE_FINISHED;
if (_freezeGame) Game->unfreeze();
- return S_OK;
+ return STATUS_OK;
} else {
resetStream();
- return S_OK;
+ return STATUS_OK;
}
}
#if 0
m_CurrentTime = m_FreezeGame ? Game->m_LiveTimer : Game->m_Timer;
- if (!IsPlaying()) return S_OK;
+ if (!IsPlaying()) return STATUS_OK;
- if (m_PlaybackStarted && m_Sound && !m_Sound->IsPlaying()) return S_OK;
+ if (m_PlaybackStarted && m_Sound && !m_Sound->IsPlaying()) return STATUS_OK;
- if (m_PlaybackStarted && !m_FreezeGame && Game->m_State == GAME_FROZEN) return S_OK;
+ if (m_PlaybackStarted && !m_FreezeGame && Game->m_State == GAME_FROZEN) return STATUS_OK;
int Counter = 0;
while (true) {
@@ -534,7 +534,7 @@ HRESULT CVidTheoraPlayer::update() {
break;
} else {
ResetStream();
- return S_OK;
+ return STATUS_OK;
}
}
@@ -585,7 +585,7 @@ HRESULT CVidTheoraPlayer::update() {
if (m_Subtitler && Game->m_VideoSubtitles) m_Subtitler->update(GetMovieFrame());
#endif
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -614,8 +614,8 @@ uint32 CVidTheoraPlayer::getMovieFrame() {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CVidTheoraPlayer::WriteVideo() {
- if (!_texture) return E_FAIL;
+ERRORCODE CVidTheoraPlayer::WriteVideo() {
+ if (!_texture) return STATUS_FAILED;
_texture->startPixelOp();
@@ -630,7 +630,7 @@ HRESULT CVidTheoraPlayer::WriteVideo() {
_texture->endPixelOp();
_videoFrameReady = true;
- return S_OK;
+ return STATUS_OK;
}
void CVidTheoraPlayer::writeAlpha() {
@@ -651,15 +651,15 @@ void CVidTheoraPlayer::writeAlpha() {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CVidTheoraPlayer::display(uint32 alpha) {
+ERRORCODE CVidTheoraPlayer::display(uint32 alpha) {
RECT rc;
- HRESULT res;
+ ERRORCODE res;
if (_texture && _videoFrameReady) {
CBPlatform::setRect(&rc, 0, 0, _texture->getWidth(), _texture->getHeight());
if (_playZoom == 100.0f) res = _texture->displayTrans(_posX, _posY, rc, alpha);
else res = _texture->displayTransZoom(_posX, _posY, rc, _playZoom, _playZoom, alpha);
- } else res = E_FAIL;
+ } else res = STATUS_FAILED;
#if 0
if (m_Subtitler && Game->m_VideoSubtitles) m_Subtitler->display();
#endif
@@ -667,16 +667,16 @@ HRESULT CVidTheoraPlayer::display(uint32 alpha) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CVidTheoraPlayer::setAlphaImage(const Common::String &filename) {
+ERRORCODE CVidTheoraPlayer::setAlphaImage(const Common::String &filename) {
warning("CVidTheoraPlayer::SetAlphaImage(%s) - Not implemented", filename.c_str());
delete _alphaImage;
_alphaImage = new CBImage(Game);
- if (!_alphaImage || FAILED(_alphaImage->loadFile(filename))) {
+ if (!_alphaImage || DID_FAIL(_alphaImage->loadFile(filename))) {
delete _alphaImage;
_alphaImage = NULL;
_alphaFilename = "";
- return E_FAIL;
+ return STATUS_FAILED;
}
if (_alphaFilename != filename) {
@@ -686,15 +686,15 @@ HRESULT CVidTheoraPlayer::setAlphaImage(const Common::String &filename) {
#if 0
SAFE_DELETE(m_AlphaImage);
m_AlphaImage = new CBImage(Game);
- if (!m_AlphaImage || FAILED(m_AlphaImage->loadFile(filename))) {
+ if (!m_AlphaImage || DID_FAIL(m_AlphaImage->loadFile(filename))) {
SAFE_DELETE(m_AlphaImage);
SAFE_DELETE_ARRAY(m_AlphaFilename);
- return E_FAIL;
+ return STATUS_FAILED;
}
if (m_AlphaFilename != Filename) CBUtils::setString(&m_AlphaFilename, filename);
m_AlphaImage->Convert(IMG_TRUECOLOR);
#endif
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
@@ -716,10 +716,10 @@ inline int intlog(int num) {
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CVidTheoraPlayer::SeekToTime(uint32 time) {
+ERRORCODE CVidTheoraPlayer::SeekToTime(uint32 time) {
warning("CVidTheoraPlayer::SeekToTime(%d) - not supported", time);
#if 0
- if (!m_TheoraStreams) return E_FAIL;
+ if (!m_TheoraStreams) return STATUS_FAILED;
float TargetTime = Time / 1000.0f;
@@ -776,33 +776,33 @@ finish:
//theora_packet_iskeyframe
#endif
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CVidTheoraPlayer::pause() {
+ERRORCODE CVidTheoraPlayer::pause() {
if (_state == THEORA_STATE_PLAYING) {
_state = THEORA_STATE_PAUSED;
_theoraDecoder->pauseVideo(true);
- return S_OK;
+ return STATUS_OK;
} else {
- return E_FAIL;
+ return STATUS_FAILED;
}
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CVidTheoraPlayer::resume() {
+ERRORCODE CVidTheoraPlayer::resume() {
if (_state == THEORA_STATE_PAUSED) {
_state = THEORA_STATE_PLAYING;
_theoraDecoder->pauseVideo(false);
- return S_OK;
+ return STATUS_OK;
} else {
- return E_FAIL;
+ return STATUS_FAILED;
}
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CVidTheoraPlayer::persist(CBPersistMgr *persistMgr) {
+ERRORCODE CVidTheoraPlayer::persist(CBPersistMgr *persistMgr) {
//CBBase::persist(persistMgr);
if (persistMgr->_saving) {
@@ -828,17 +828,17 @@ HRESULT CVidTheoraPlayer::persist(CBPersistMgr *persistMgr) {
initializeSimple();
}
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CVidTheoraPlayer::initializeSimple() {
- if (SUCCEEDED(initialize(_filename))) {
+ERRORCODE CVidTheoraPlayer::initializeSimple() {
+ if (DID_SUCCEED(initialize(_filename))) {
if (_alphaFilename != "") setAlphaImage(_alphaFilename);
play(_playbackType, _posX, _posY, false, false, _looping, _savedPos, _playZoom);
} else _state = THEORA_STATE_FINISHED;
- return S_OK;
+ return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/wintermute/video/VidTheoraPlayer.h b/engines/wintermute/video/VidTheoraPlayer.h
index 437a72db67..6061ad3199 100644
--- a/engines/wintermute/video/VidTheoraPlayer.h
+++ b/engines/wintermute/video/VidTheoraPlayer.h
@@ -63,16 +63,16 @@ public:
//CVidSubtitler *_subtitler;
// control methods
- HRESULT initialize(const Common::String &filename, const Common::String &subtitleFile = NULL);
- HRESULT initializeSimple();
- HRESULT update();
- HRESULT play(TVideoPlayback type = VID_PLAY_CENTER, int x = 0, int y = 0, bool freezeGame = false, bool freezeMusic = true, bool Looping = false, uint32 startTime = 0, float forceZoom = -1.0f, int volume = -1);
- HRESULT stop();
- HRESULT display(uint32 alpha = 0xFFFFFFFF);
- //HRESULT RenderFrame(CBSurface *Texture, yuv_buffer *yuv);
+ ERRORCODE initialize(const Common::String &filename, const Common::String &subtitleFile = NULL);
+ ERRORCODE initializeSimple();
+ ERRORCODE update();
+ ERRORCODE play(TVideoPlayback type = VID_PLAY_CENTER, int x = 0, int y = 0, bool freezeGame = false, bool freezeMusic = true, bool Looping = false, uint32 startTime = 0, float forceZoom = -1.0f, int volume = -1);
+ ERRORCODE stop();
+ ERRORCODE display(uint32 alpha = 0xFFFFFFFF);
+ //ERRORCODE RenderFrame(CBSurface *Texture, yuv_buffer *yuv);
- HRESULT pause();
- HRESULT resume();
+ ERRORCODE pause();
+ ERRORCODE resume();
bool isPlaying() {
return _state == THEORA_STATE_PLAYING;
@@ -99,15 +99,15 @@ public:
// alpha related
CBImage *_alphaImage;
Common::String _alphaFilename;
- HRESULT setAlphaImage(const Common::String &filename);
+ ERRORCODE setAlphaImage(const Common::String &filename);
__inline byte getAlphaAt(int x, int y);
void writeAlpha();
- HRESULT SeekToTime(uint32 Time);
+ ERRORCODE SeekToTime(uint32 Time);
void cleanup();
- HRESULT resetStream();
+ ERRORCODE resetStream();
// video properties
TVideoPlayback _playbackType;
@@ -137,7 +137,7 @@ private:
bool _videoFrameReady;
float _videobufTime;
- HRESULT WriteVideo();
+ ERRORCODE WriteVideo();
bool _playbackStarted;
diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp
index 7745589f55..b6330ff01f 100644
--- a/engines/wintermute/wintermute.cpp
+++ b/engines/wintermute/wintermute.cpp
@@ -189,7 +189,7 @@ int WinterMuteEngine::init() {
_game->initialize1();
- if (FAILED(_game->loadSettings("startup.settings"))) {
+ if (DID_FAIL(_game->loadSettings("startup.settings"))) {
_game->LOG(0, "Error loading game settings.");
delete _game;
_game = NULL;
@@ -205,11 +205,11 @@ int WinterMuteEngine::init() {
- HRESULT ret;
+ ERRORCODE ret;
// initialize the renderer
ret = _game->_renderer->initRenderer(_game->_settingsResWidth, _game->_settingsResHeight, windowedMode);
- if (FAILED(ret)) {
+ if (DID_FAIL(ret)) {
_game->LOG(ret, "Error initializing renderer. Exiting.");
delete _game;
@@ -225,7 +225,7 @@ int WinterMuteEngine::init() {
// initialize sound manager (non-fatal if we fail)
ret = _game->_soundMgr->initialize();
- if (FAILED(ret)) {
+ if (DID_FAIL(ret)) {
_game->LOG(ret, "Sound is NOT available.");
}
@@ -233,7 +233,7 @@ int WinterMuteEngine::init() {
// load game
uint32 DataInitStart = CBPlatform::getTime();
- if (FAILED(_game->loadFile(_game->_settingsGameFile ? _game->_settingsGameFile : "default.game"))) {
+ if (DID_FAIL(_game->loadFile(_game->_settingsGameFile ? _game->_settingsGameFile : "default.game"))) {
_game->LOG(ret, "Error loading game file. Exiting.");
delete _game;
_game = NULL;
diff --git a/engines/wintermute/wintypes.h b/engines/wintermute/wintypes.h
index e15ba1c329..b4d2830c20 100644
--- a/engines/wintermute/wintypes.h
+++ b/engines/wintermute/wintypes.h
@@ -31,17 +31,24 @@
#include "common/scummsys.h"
-//namespace WinterMute {
+namespace WinterMute {
-#ifndef __WIN32__
+#define BYTETORGBA(r,g,b,a) ((uint32)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff)))
+
+#define RGBCOLGetB(rgb) ((byte )(rgb))
+#define RGBCOLGetG(rgb) ((byte )(((uint16)(rgb)) >> 8))
+#define RGBCOLGetR(rgb) ((byte )((rgb)>>16))
+#define RGBCOLGetA(rgb) ((byte )((rgb)>>24))
+
+typedef bool ERRORCODE;
+
+#define DID_SUCCEED(hr) ((ERRORCODE)(hr))
+#define DID_FAIL(hr) (!((ERRORCODE)(hr)))
-#define PI ((float) 3.141592653589793f)
-#define DRGBA(r,g,b,a) ((uint32)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff)))
+#define STATUS_OK (true)
+#define STATUS_FAILED (false)
-#define D3DCOLGetB(rgb) ((byte )(rgb))
-#define D3DCOLGetG(rgb) ((byte )(((uint16)(rgb)) >> 8))
-#define D3DCOLGetR(rgb) ((byte )((rgb)>>16))
-#define D3DCOLGetA(rgb) ((byte )((rgb)>>24))
+#ifndef __WIN32__
#define MAX_PATH 512
@@ -64,17 +71,10 @@ typedef struct tagPOINT {
int32 y;
} POINT, *LPPOINT;
-typedef int32 HRESULT;
-
-#define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0)
-#define FAILED(hr) (((HRESULT)(hr)) < 0)
+#endif // __WIN32__
-#define S_OK ((HRESULT)0)
-//#define S_FALSE ((HRESULT)1)
-#define E_FAIL ((HRESULT)-1)
-#endif // __WIN32__
-//} // end of namespace WinterMute
+} // end of namespace WinterMute
#endif // WINTERMUTE_WINTYPES_H