From 136ae9857f3401f5dea13c63c3c0702b08040e2a Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Wed, 18 Jul 2012 18:31:56 +0200 Subject: WINTERMUTE: Rename ERRORCODE (formerly HRESULT) to bool --- engines/wintermute/Ad/AdActor.cpp | 26 ++-- engines/wintermute/Ad/AdActor.h | 18 +-- engines/wintermute/Ad/AdEntity.cpp | 20 +-- engines/wintermute/Ad/AdEntity.h | 16 +-- engines/wintermute/Ad/AdGame.cpp | 100 +++++++------- engines/wintermute/Ad/AdGame.h | 82 ++++++------ engines/wintermute/Ad/AdInventory.cpp | 8 +- engines/wintermute/Ad/AdInventory.h | 6 +- engines/wintermute/Ad/AdInventoryBox.cpp | 14 +- engines/wintermute/Ad/AdInventoryBox.h | 10 +- engines/wintermute/Ad/AdItem.cpp | 18 +-- engines/wintermute/Ad/AdItem.h | 12 +- engines/wintermute/Ad/AdLayer.cpp | 14 +- engines/wintermute/Ad/AdLayer.h | 10 +- engines/wintermute/Ad/AdNodeState.cpp | 4 +- engines/wintermute/Ad/AdNodeState.h | 2 +- engines/wintermute/Ad/AdObject.cpp | 44 +++---- engines/wintermute/Ad/AdObject.h | 36 ++--- engines/wintermute/Ad/AdPath.cpp | 2 +- engines/wintermute/Ad/AdPathPoint.cpp | 2 +- engines/wintermute/Ad/AdRegion.cpp | 14 +- engines/wintermute/Ad/AdRegion.h | 10 +- engines/wintermute/Ad/AdResponse.cpp | 10 +- engines/wintermute/Ad/AdResponse.h | 8 +- engines/wintermute/Ad/AdResponseBox.cpp | 24 ++-- engines/wintermute/Ad/AdResponseBox.h | 20 +-- engines/wintermute/Ad/AdResponseContext.cpp | 2 +- engines/wintermute/Ad/AdRotLevel.cpp | 10 +- engines/wintermute/Ad/AdRotLevel.h | 6 +- engines/wintermute/Ad/AdScaleLevel.cpp | 10 +- engines/wintermute/Ad/AdScaleLevel.h | 6 +- engines/wintermute/Ad/AdScene.cpp | 62 ++++----- engines/wintermute/Ad/AdScene.h | 58 ++++---- engines/wintermute/Ad/AdSceneNode.cpp | 6 +- engines/wintermute/Ad/AdSceneNode.h | 4 +- engines/wintermute/Ad/AdSceneState.cpp | 2 +- engines/wintermute/Ad/AdSentence.cpp | 10 +- engines/wintermute/Ad/AdSentence.h | 8 +- engines/wintermute/Ad/AdSpriteSet.cpp | 10 +- engines/wintermute/Ad/AdSpriteSet.h | 6 +- engines/wintermute/Ad/AdTalkDef.cpp | 12 +- engines/wintermute/Ad/AdTalkDef.h | 8 +- engines/wintermute/Ad/AdTalkHolder.cpp | 10 +- engines/wintermute/Ad/AdTalkHolder.h | 6 +- engines/wintermute/Ad/AdTalkNode.cpp | 8 +- engines/wintermute/Ad/AdTalkNode.h | 6 +- engines/wintermute/Ad/AdWaypointGroup.cpp | 14 +- engines/wintermute/Ad/AdWaypointGroup.h | 10 +- engines/wintermute/Base/BBase.cpp | 6 +- engines/wintermute/Base/BBase.h | 6 +- engines/wintermute/Base/BDebugger.cpp | 32 ++--- engines/wintermute/Base/BDebugger.h | 36 ++--- engines/wintermute/Base/BDynBuffer.cpp | 6 +- engines/wintermute/Base/BDynBuffer.h | 6 +- engines/wintermute/Base/BFader.cpp | 12 +- engines/wintermute/Base/BFader.h | 10 +- engines/wintermute/Base/BFileManager.cpp | 22 ++-- engines/wintermute/Base/BFileManager.h | 22 ++-- engines/wintermute/Base/BFrame.cpp | 16 +-- engines/wintermute/Base/BFrame.h | 12 +- engines/wintermute/Base/BGame.cpp | 146 ++++++++++----------- engines/wintermute/Base/BGame.h | 132 +++++++++---------- engines/wintermute/Base/BImage.cpp | 8 +- engines/wintermute/Base/BImage.h | 8 +- engines/wintermute/Base/BKeyboardState.cpp | 8 +- engines/wintermute/Base/BKeyboardState.h | 6 +- engines/wintermute/Base/BObject.cpp | 42 +++--- engines/wintermute/Base/BObject.h | 46 +++---- engines/wintermute/Base/BPackage.cpp | 8 +- engines/wintermute/Base/BPackage.h | 6 +- engines/wintermute/Base/BPersistMgr.cpp | 42 +++--- engines/wintermute/Base/BPersistMgr.h | 42 +++--- engines/wintermute/Base/BPoint.cpp | 2 +- engines/wintermute/Base/BRegion.cpp | 18 +-- engines/wintermute/Base/BRegion.h | 14 +- engines/wintermute/Base/BRenderSDL.cpp | 16 +-- engines/wintermute/Base/BRenderSDL.h | 16 +-- engines/wintermute/Base/BRenderer.cpp | 32 ++--- engines/wintermute/Base/BRenderer.h | 42 +++--- engines/wintermute/Base/BSaveThumbHelper.cpp | 2 +- engines/wintermute/Base/BSaveThumbHelper.h | 2 +- engines/wintermute/Base/BScriptHolder.cpp | 26 ++-- engines/wintermute/Base/BScriptHolder.h | 18 +-- engines/wintermute/Base/BScriptable.cpp | 6 +- engines/wintermute/Base/BScriptable.h | 4 +- engines/wintermute/Base/BSound.cpp | 32 ++--- engines/wintermute/Base/BSound.h | 26 ++-- engines/wintermute/Base/BSoundBuffer.cpp | 24 ++-- engines/wintermute/Base/BSoundBuffer.h | 22 ++-- engines/wintermute/Base/BSoundMgr.cpp | 24 ++-- engines/wintermute/Base/BSoundMgr.h | 22 ++-- engines/wintermute/Base/BSprite.cpp | 20 +-- engines/wintermute/Base/BSprite.h | 18 +-- engines/wintermute/Base/BStringTable.cpp | 4 +- engines/wintermute/Base/BStringTable.h | 4 +- engines/wintermute/Base/BSubFrame.cpp | 18 +-- engines/wintermute/Base/BSubFrame.h | 16 +-- engines/wintermute/Base/BSurface.cpp | 22 ++-- engines/wintermute/Base/BSurface.h | 34 ++--- engines/wintermute/Base/BSurfaceSDL.cpp | 26 ++-- engines/wintermute/Base/BSurfaceSDL.h | 26 ++-- engines/wintermute/Base/BSurfaceStorage.cpp | 14 +- engines/wintermute/Base/BSurfaceStorage.h | 10 +- engines/wintermute/Base/BTransitionMgr.cpp | 4 +- engines/wintermute/Base/BTransitionMgr.h | 4 +- engines/wintermute/Base/BViewport.cpp | 4 +- engines/wintermute/Base/BViewport.h | 2 +- engines/wintermute/Base/file/BFile.h | 8 +- engines/wintermute/Base/file/BSaveThumbFile.cpp | 10 +- engines/wintermute/Base/file/BSaveThumbFile.h | 8 +- engines/wintermute/Base/font/BFont.cpp | 8 +- engines/wintermute/Base/font/BFont.h | 4 +- engines/wintermute/Base/font/BFontBitmap.cpp | 10 +- engines/wintermute/Base/font/BFontBitmap.h | 6 +- engines/wintermute/Base/font/BFontStorage.cpp | 8 +- engines/wintermute/Base/font/BFontStorage.h | 6 +- engines/wintermute/Base/font/BFontTT.cpp | 12 +- engines/wintermute/Base/font/BFontTT.h | 10 +- engines/wintermute/Base/particles/PartEmitter.cpp | 30 ++--- engines/wintermute/Base/particles/PartEmitter.h | 30 ++--- engines/wintermute/Base/particles/PartForce.cpp | 2 +- engines/wintermute/Base/particles/PartForce.h | 2 +- engines/wintermute/Base/particles/PartParticle.cpp | 12 +- engines/wintermute/Base/particles/PartParticle.h | 12 +- engines/wintermute/Base/scriptables/SXArray.cpp | 8 +- engines/wintermute/Base/scriptables/SXArray.h | 6 +- engines/wintermute/Base/scriptables/SXDate.cpp | 6 +- engines/wintermute/Base/scriptables/SXDate.h | 4 +- engines/wintermute/Base/scriptables/SXFile.cpp | 10 +- engines/wintermute/Base/scriptables/SXFile.h | 4 +- engines/wintermute/Base/scriptables/SXMath.cpp | 4 +- engines/wintermute/Base/scriptables/SXMath.h | 2 +- .../wintermute/Base/scriptables/SXMemBuffer.cpp | 8 +- engines/wintermute/Base/scriptables/SXMemBuffer.h | 6 +- engines/wintermute/Base/scriptables/SXString.cpp | 6 +- engines/wintermute/Base/scriptables/SXString.h | 4 +- engines/wintermute/Base/scriptables/ScEngine.cpp | 38 +++--- engines/wintermute/Base/scriptables/ScEngine.h | 36 ++--- engines/wintermute/Base/scriptables/ScScript.cpp | 50 +++---- engines/wintermute/Base/scriptables/ScScript.h | 36 ++--- engines/wintermute/Base/scriptables/ScStack.cpp | 2 +- engines/wintermute/Base/scriptables/ScValue.cpp | 12 +- engines/wintermute/Base/scriptables/ScValue.h | 8 +- engines/wintermute/Base/scriptables/SxObject.cpp | 2 +- engines/wintermute/Sys/SysClassRegistry.cpp | 10 +- engines/wintermute/Sys/SysClassRegistry.h | 10 +- engines/wintermute/UI/UIButton.cpp | 16 +-- engines/wintermute/UI/UIButton.h | 12 +- engines/wintermute/UI/UIEdit.cpp | 16 +-- engines/wintermute/UI/UIEdit.h | 12 +- engines/wintermute/UI/UIEntity.cpp | 18 +-- engines/wintermute/UI/UIEntity.h | 14 +- engines/wintermute/UI/UIObject.cpp | 16 +-- engines/wintermute/UI/UIObject.h | 14 +- engines/wintermute/UI/UIText.cpp | 18 +-- engines/wintermute/UI/UIText.h | 14 +- engines/wintermute/UI/UITiledImage.cpp | 12 +- engines/wintermute/UI/UITiledImage.h | 8 +- engines/wintermute/UI/UIWindow.cpp | 36 ++--- engines/wintermute/UI/UIWindow.h | 30 ++--- engines/wintermute/coll_templ.h | 4 +- engines/wintermute/persistent.h | 8 +- engines/wintermute/video/VidPlayer.cpp | 22 ++-- engines/wintermute/video/VidPlayer.h | 16 +-- engines/wintermute/video/VidTheoraPlayer.cpp | 30 ++--- engines/wintermute/video/VidTheoraPlayer.h | 26 ++-- engines/wintermute/wintermute.cpp | 2 +- engines/wintermute/wintypes.h | 6 +- 168 files changed, 1428 insertions(+), 1430 deletions(-) (limited to 'engines/wintermute') diff --git a/engines/wintermute/Ad/AdActor.cpp b/engines/wintermute/Ad/AdActor.cpp index 55a8ac8443..17bd166796 100644 --- a/engines/wintermute/Ad/AdActor.cpp +++ b/engines/wintermute/Ad/AdActor.cpp @@ -76,7 +76,7 @@ CAdActor::CAdActor(CBGame *inGame): CAdTalkHolder(inGame) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdActor::setDefaultAnimNames() { +bool CAdActor::setDefaultAnimNames() { _talkAnimName = "talk"; _idleAnimName = "idle"; _walkAnimName = "walk"; @@ -123,14 +123,14 @@ CAdActor::~CAdActor() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdActor::loadFile(const char *filename) { +bool CAdActor::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { _gameRef->LOG(0, "CAdActor::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } - ERRORCODE ret; + bool ret; _filename = new char [strlen(filename) + 1]; strcpy(_filename, filename); @@ -183,7 +183,7 @@ TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF(ANIMATION) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdActor::loadBuffer(byte *buffer, bool complete) { +bool CAdActor::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(ACTOR) TOKEN_TABLE(X) @@ -504,7 +504,7 @@ void CAdActor::goTo(int x, int y, TDirection afterWalkDir) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdActor::display() { +bool CAdActor::display() { if (_active) updateSounds(); uint32 alpha; @@ -547,7 +547,7 @@ ERRORCODE CAdActor::display() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdActor::update() { +bool CAdActor::update() { _currentSprite = NULL; if (_state == STATE_READY) { @@ -850,7 +850,7 @@ void CAdActor::initLine(CBPoint startPt, CBPoint endPt) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdActor::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CAdActor::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // GoTo / GoToAsync ////////////////////////////////////////////////////////////////////////// @@ -1035,7 +1035,7 @@ CScValue *CAdActor::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdActor::scSetProperty(const char *name, CScValue *value) { +bool CAdActor::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// // Direction ////////////////////////////////////////////////////////////////////////// @@ -1108,7 +1108,7 @@ CBSprite *CAdActor::getTalkStance(const char *stance) { delete _animSprite; _animSprite = new CBSprite(_gameRef, this); if (_animSprite) { - ERRORCODE res = _animSprite->loadFile(_forcedTalkAnimName); + bool res = _animSprite->loadFile(_forcedTalkAnimName); if (DID_FAIL(res)) { _gameRef->LOG(res, "CAdActor::GetTalkStance: error loading talk sprite (object:\"%s\" sprite:\"%s\")", _name, _forcedTalkAnimName); delete _animSprite; @@ -1187,7 +1187,7 @@ CBSprite *CAdActor::getTalkStanceOld(const char *stance) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdActor::persist(CBPersistMgr *persistMgr) { +bool CAdActor::persist(CBPersistMgr *persistMgr) { CAdTalkHolder::persist(persistMgr); persistMgr->transfer(TMEMBER_INT(_dir)); @@ -1262,7 +1262,7 @@ CAdSpriteSet *CAdActor::getAnimByName(const Common::String &animName) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdActor::mergeAnims(const char *animsFilename) { +bool CAdActor::mergeAnims(const char *animsFilename) { TOKEN_TABLE_START(commands) TOKEN_TABLE(ANIMATION) TOKEN_TABLE_END @@ -1279,7 +1279,7 @@ ERRORCODE CAdActor::mergeAnims(const char *animsFilename) { int cmd; CBParser parser(_gameRef); - ERRORCODE Ret = STATUS_OK; + bool Ret = STATUS_OK; while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)¶ms)) > 0) { switch (cmd) { @@ -1298,7 +1298,7 @@ ERRORCODE CAdActor::mergeAnims(const char *animsFilename) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdActor::playAnim(const char *filename) { +bool CAdActor::playAnim(const char *filename) { // if we have an anim with this name, use it CAdSpriteSet *Anim = getAnimByName(filename); if (Anim) { diff --git a/engines/wintermute/Ad/AdActor.h b/engines/wintermute/Ad/AdActor.h index d767ecd381..114ee04ae8 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 ERRORCODE update(); - virtual ERRORCODE display(); + virtual bool update(); + virtual bool display(); TDirection _targetDir; TDirection _afterWalkDir; virtual void turnTo(TDirection dir); @@ -67,8 +67,8 @@ public: TDirection _dir; CAdActor(CBGame *inGame/*=NULL*/); virtual ~CAdActor(); - ERRORCODE loadFile(const char *filename); - ERRORCODE loadBuffer(byte *buffer, bool complete = true); + bool loadFile(const char *filename); + bool loadBuffer(byte *buffer, bool complete = true); // new anim system Common::String _talkAnimName; @@ -77,19 +77,19 @@ public: Common::String _turnLeftAnimName; Common::String _turnRightAnimName; CBArray _anims; - virtual ERRORCODE playAnim(const char *filename); + virtual bool playAnim(const char *filename); CAdSpriteSet *getAnimByName(const Common::String &animName); // scripting interface virtual CScValue *scGetProperty(const char *name); - virtual ERRORCODE scSetProperty(const char *name, CScValue *value); - virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual bool scSetProperty(const char *name, CScValue *value); + virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); virtual const char *scToString(); private: - ERRORCODE setDefaultAnimNames(); + bool setDefaultAnimNames(); CBSprite *getTalkStanceOld(const char *stance); - ERRORCODE mergeAnims(const char *animsFilename); + bool 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 ccffe58efe..20c16e3dd5 100644 --- a/engines/wintermute/Ad/AdEntity.cpp +++ b/engines/wintermute/Ad/AdEntity.cpp @@ -84,14 +84,14 @@ CAdEntity::~CAdEntity() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdEntity::loadFile(const char *filename) { +bool CAdEntity::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { _gameRef->LOG(0, "CAdEntity::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } - ERRORCODE ret; + bool ret; _filename = new char [strlen(filename) + 1]; strcpy(_filename, filename); @@ -150,7 +150,7 @@ TOKEN_DEF(WALK_TO_DIR) TOKEN_DEF(SAVE_STATE) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdEntity::loadBuffer(byte *buffer, bool complete) { +bool CAdEntity::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(ENTITY) TOKEN_TABLE(SPRITE) @@ -481,7 +481,7 @@ ERRORCODE CAdEntity::loadBuffer(byte *buffer, bool complete) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdEntity::display() { +bool CAdEntity::display() { if (_active) { updateSounds(); @@ -529,7 +529,7 @@ ERRORCODE CAdEntity::display() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdEntity::update() { +bool CAdEntity::update() { _currentSprite = NULL; if (_state == STATE_READY && _animSprite) { @@ -625,7 +625,7 @@ ERRORCODE CAdEntity::update() { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdEntity::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CAdEntity::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // StopSound ////////////////////////////////////////////////////////////////////////// @@ -831,7 +831,7 @@ CScValue *CAdEntity::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdEntity::scSetProperty(const char *name, CScValue *value) { +bool CAdEntity::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// // Item @@ -877,7 +877,7 @@ const char *CAdEntity::scToString() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdEntity::saveAsText(CBDynBuffer *buffer, int indent) { +bool CAdEntity::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent, "ENTITY {\n"); buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", _name); if (_subtype == ENTITY_SOUND) @@ -977,7 +977,7 @@ void CAdEntity::updatePosition() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdEntity::persist(CBPersistMgr *persistMgr) { +bool CAdEntity::persist(CBPersistMgr *persistMgr) { CAdTalkHolder::persist(persistMgr); persistMgr->transfer(TMEMBER(_item)); @@ -1003,7 +1003,7 @@ void CAdEntity::setItem(const char *itemName) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdEntity::setSprite(const char *filename) { +bool CAdEntity::setSprite(const char *filename) { bool setCurrent = false; if (_currentSprite == _sprite) { _currentSprite = NULL; diff --git a/engines/wintermute/Ad/AdEntity.h b/engines/wintermute/Ad/AdEntity.h index 9a53f8195b..43007c645a 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; - ERRORCODE setSprite(const char *filename); + bool setSprite(const char *filename); int _walkToX; int _walkToY; TDirection _walkToDir; @@ -46,19 +46,19 @@ public: void updatePosition(); virtual int getHeight(); CBRegion *_region; - virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent); - virtual ERRORCODE update(); - virtual ERRORCODE display(); + virtual bool saveAsText(CBDynBuffer *buffer, int indent); + virtual bool update(); + virtual bool display(); CAdEntity(CBGame *inGame); virtual ~CAdEntity(); - ERRORCODE loadFile(const char *filename); - ERRORCODE loadBuffer(byte *buffer, bool complete = true); + bool loadFile(const char *filename); + bool loadBuffer(byte *buffer, bool complete = true); TEntityType _subtype; // scripting interface virtual CScValue *scGetProperty(const char *name); - virtual ERRORCODE scSetProperty(const char *name, CScValue *value); - virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual bool scSetProperty(const char *name, CScValue *value); + virtual bool 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 b5c049dc75..af752e3ced 100644 --- a/engines/wintermute/Ad/AdGame.cpp +++ b/engines/wintermute/Ad/AdGame.cpp @@ -117,7 +117,7 @@ CAdGame::~CAdGame() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::cleanup() { +bool CAdGame::cleanup() { int i; for (i = 0; i < _objects.getSize(); i++) { @@ -195,7 +195,7 @@ ERRORCODE CAdGame::cleanup() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::initLoop() { +bool CAdGame::initLoop() { if (_scheduledScene && _transMgr->isReady()) { changeScene(_scheduledScene, _scheduledFadeIn); delete[] _scheduledScene; @@ -205,7 +205,7 @@ ERRORCODE CAdGame::initLoop() { } - ERRORCODE res; + bool res; res = CBGame::initLoop(); if (DID_FAIL(res)) return res; @@ -218,17 +218,17 @@ ERRORCODE CAdGame::initLoop() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::addObject(CAdObject *object) { +bool CAdGame::addObject(CAdObject *object) { _objects.add(object); return registerObject(object); } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::removeObject(CAdObject *object) { +bool CAdGame::removeObject(CAdObject *object) { // in case the user called Scene.CreateXXX() and Game.DeleteXXX() if (_scene) { - ERRORCODE Res = _scene->removeObject(object); + bool Res = _scene->removeObject(object); if (DID_SUCCEED(Res)) return Res; } @@ -243,7 +243,7 @@ ERRORCODE CAdGame::removeObject(CAdObject *object) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::changeScene(const char *filename, bool fadeIn) { +bool CAdGame::changeScene(const char *filename, bool fadeIn) { if (_scene == NULL) { _scene = new CAdScene(_gameRef); registerObject(_scene); @@ -265,7 +265,7 @@ ERRORCODE CAdGame::changeScene(const char *filename, bool fadeIn) { _scene->_sFXVolume = 100; if (_scene->_scProp) _scene->_scProp->cleanup(); - ERRORCODE ret; + bool ret; if (_initialScene && _debugDebugMode && _debugStartupScene) { _initialScene = false; ret = _scene->loadFile(_debugStartupScene); @@ -293,7 +293,7 @@ void CAdGame::addSentence(CAdSentence *sentence) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::displaySentences(bool frozen) { +bool CAdGame::displaySentences(bool frozen) { for (int i = 0; i < _sentences.getSize(); i++) { if (frozen && _sentences[i]->_freezable) continue; else _sentences[i]->display(); @@ -316,7 +316,7 @@ void CAdGame::finishSentences() { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // ChangeScene ////////////////////////////////////////////////////////////////////////// @@ -334,7 +334,7 @@ ERRORCODE CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *th stack->pushNULL(); - //ERRORCODE ret = ChangeScene(stack->pop()->getString()); + //bool ret = ChangeScene(stack->pop()->getString()); //if(DID_FAIL(ret)) stack->pushBool(false); //else stack->pushBool(true); @@ -743,7 +743,7 @@ ERRORCODE CAdGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *th const char *filename = stack->pop()->getString(); bool merge = stack->pop()->getBool(false); - ERRORCODE ret = loadItemsFile(filename, merge); + bool ret = loadItemsFile(filename, merge); stack->pushBool(DID_SUCCEED(ret)); return STATUS_OK; @@ -952,7 +952,7 @@ CScValue *CAdGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::scSetProperty(const char *name, CScValue *value) { +bool CAdGame::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// // SelectedItem @@ -1047,7 +1047,7 @@ ERRORCODE CAdGame::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStack, char *name) { +bool CAdGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStack, char *name) { CScValue *this_obj; ////////////////////////////////////////////////////////////////////////// @@ -1083,7 +1083,7 @@ ERRORCODE CAdGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *th ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::showCursor() { +bool CAdGame::showCursor() { if (_cursorHidden) return STATUS_OK; if (_selectedItem && _gameRef->_state == GAME_RUNNING && _stateEx == GAME_NORMAL && _interactive) { @@ -1103,14 +1103,14 @@ ERRORCODE CAdGame::showCursor() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::loadFile(const char *filename) { +bool CAdGame::loadFile(const char *filename) { byte *buffer = _fileManager->readWholeFile(filename); if (buffer == NULL) { _gameRef->LOG(0, "CAdGame::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } - ERRORCODE ret; + bool ret; _filename = new char [strlen(filename) + 1]; strcpy(_filename, filename); @@ -1139,7 +1139,7 @@ TOKEN_DEF(STARTUP_SCENE) TOKEN_DEF(DEBUG_STARTUP_SCENE) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::loadBuffer(byte *buffer, bool complete) { +bool CAdGame::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(GAME) TOKEN_TABLE(AD_GAME) @@ -1252,7 +1252,7 @@ ERRORCODE CAdGame::loadBuffer(byte *buffer, bool complete) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::persist(CBPersistMgr *persistMgr) { +bool CAdGame::persist(CBPersistMgr *persistMgr) { if (!persistMgr->_saving) cleanup(); CBGame::persist(persistMgr); @@ -1303,14 +1303,14 @@ ERRORCODE CAdGame::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::loadGame(const char *filename) { - ERRORCODE ret = CBGame::loadGame(filename); +bool CAdGame::loadGame(const char *filename) { + bool ret = CBGame::loadGame(filename); if (DID_SUCCEED(ret)) CSysClassRegistry::getInstance()->enumInstances(afterLoadRegion, "CAdRegion", NULL); return ret; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::initAfterLoad() { +bool CAdGame::initAfterLoad() { CBGame::initAfterLoad(); CSysClassRegistry::getInstance()->enumInstances(afterLoadScene, "CAdScene", NULL); return STATUS_OK; @@ -1345,7 +1345,7 @@ void CAdGame::setPrevSceneFilename(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::scheduleChangeScene(const char *filename, bool fadeIn) { +bool CAdGame::scheduleChangeScene(const char *filename, bool fadeIn) { delete[] _scheduledScene; _scheduledScene = NULL; @@ -1362,7 +1362,7 @@ ERRORCODE CAdGame::scheduleChangeScene(const char *filename, bool fadeIn) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor) { +bool CAdGame::getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor) { CBGame::getVersion(verMajor, verMinor, NULL, NULL); if (extMajor) *extMajor = 0; @@ -1373,14 +1373,14 @@ ERRORCODE CAdGame::getVersion(byte *verMajor, byte *verMinor, byte *extMajor, by ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::loadItemsFile(const char *filename, bool merge) { +bool CAdGame::loadItemsFile(const char *filename, bool merge) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { _gameRef->LOG(0, "CAdGame::LoadItemsFile failed for file '%s'", filename); return STATUS_FAILED; } - ERRORCODE ret; + bool ret; //_filename = new char [strlen(filename)+1]; //strcpy(_filename, filename); @@ -1395,7 +1395,7 @@ ERRORCODE CAdGame::loadItemsFile(const char *filename, bool merge) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::loadItemsBuffer(byte *buffer, bool merge) { +bool CAdGame::loadItemsBuffer(byte *buffer, bool merge) { TOKEN_TABLE_START(commands) TOKEN_TABLE(ITEM) TOKEN_TABLE_END @@ -1473,7 +1473,7 @@ CAdSceneState *CAdGame::getSceneState(const char *filename, bool saving) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::windowLoadHook(CUIWindow *win, char **buffer, char **params) { +bool CAdGame::windowLoadHook(CUIWindow *win, char **buffer, char **params) { TOKEN_TABLE_START(commands) TOKEN_TABLE(ENTITY_CONTAINER) TOKEN_TABLE_END @@ -1507,7 +1507,7 @@ ERRORCODE CAdGame::windowLoadHook(CUIWindow *win, char **buffer, char **params) ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::windowScriptMethodHook(CUIWindow *win, CScScript *script, CScStack *stack, const char *name) { +bool CAdGame::windowScriptMethodHook(CUIWindow *win, CScScript *script, CScStack *stack, const char *name) { if (strcmp(name, "CreateEntityContainer") == 0) { stack->correctParams(1); CScValue *val = stack->pop(); @@ -1525,7 +1525,7 @@ ERRORCODE CAdGame::windowScriptMethodHook(CUIWindow *win, CScScript *script, CSc ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::startDlgBranch(const char *branchName, const char *scriptName, const char *eventName) { +bool 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); @@ -1536,7 +1536,7 @@ ERRORCODE CAdGame::startDlgBranch(const char *branchName, const char *scriptName ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::endDlgBranch(const char *branchName, const char *scriptName, const char *eventName) { +bool CAdGame::endDlgBranch(const char *branchName, const char *scriptName, const char *eventName) { char *name = NULL; bool deleteName = false; if (branchName == NULL && _dlgPendingBranches.getSize() > 0) { @@ -1583,7 +1583,7 @@ ERRORCODE CAdGame::endDlgBranch(const char *branchName, const char *scriptName, ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::clearBranchResponses(char *name) { +bool CAdGame::clearBranchResponses(char *name) { for (int i = 0; i < _responsesBranch.getSize(); i++) { if (scumm_stricmp(name, _responsesBranch[i]->_context) == 0) { delete _responsesBranch[i]; @@ -1596,7 +1596,7 @@ ERRORCODE CAdGame::clearBranchResponses(char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::addBranchResponse(int ID) { +bool CAdGame::addBranchResponse(int ID) { if (branchResponseUsed(ID)) return STATUS_OK; CAdResponseContext *r = new CAdResponseContext(_gameRef); r->_iD = ID; @@ -1619,7 +1619,7 @@ bool CAdGame::branchResponseUsed(int ID) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::addGameResponse(int ID) { +bool CAdGame::addGameResponse(int ID) { if (gameResponseUsed(ID)) return STATUS_OK; CAdResponseContext *r = new CAdResponseContext(_gameRef); r->_iD = ID; @@ -1643,7 +1643,7 @@ bool CAdGame::gameResponseUsed(int ID) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::resetResponse(int ID) { +bool CAdGame::resetResponse(int ID) { char *Context = _dlgPendingBranches.getSize() > 0 ? _dlgPendingBranches[_dlgPendingBranches.getSize() - 1] : NULL; int i; @@ -1672,7 +1672,7 @@ ERRORCODE CAdGame::resetResponse(int ID) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::displayContent(bool doUpdate, bool displayAll) { +bool CAdGame::displayContent(bool doUpdate, bool displayAll) { // init if (doUpdate) initLoop(); @@ -1740,7 +1740,7 @@ ERRORCODE CAdGame::displayContent(bool doUpdate, bool displayAll) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::registerInventory(CAdInventory *inv) { +bool CAdGame::registerInventory(CAdInventory *inv) { for (int i = 0; i < _inventories.getSize(); i++) { if (_inventories[i] == inv) return STATUS_OK; } @@ -1751,7 +1751,7 @@ ERRORCODE CAdGame::registerInventory(CAdInventory *inv) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::unregisterInventory(CAdInventory *inv) { +bool CAdGame::unregisterInventory(CAdInventory *inv) { for (int i = 0; i < _inventories.getSize(); i++) { if (_inventories[i] == inv) { unregisterObject(_inventories[i]); @@ -1786,14 +1786,14 @@ CAdItem *CAdGame::getItemByName(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::addItem(CAdItem *item) { +bool CAdGame::addItem(CAdItem *item) { _items.add(item); return _gameRef->registerObject(item); } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::resetContent() { +bool CAdGame::resetContent() { // clear pending dialogs for (int i = 0; i < _dlgPendingBranches.getSize(); i++) { delete [] _dlgPendingBranches[i]; @@ -1828,7 +1828,7 @@ ERRORCODE CAdGame::resetContent() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::deleteItem(CAdItem *item) { +bool CAdGame::deleteItem(CAdItem *item) { if (!item) return STATUS_FAILED; if (_selectedItem == item) _selectedItem = NULL; @@ -1853,7 +1853,7 @@ ERRORCODE CAdGame::deleteItem(CAdItem *item) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::addSpeechDir(const char *dir) { +bool CAdGame::addSpeechDir(const char *dir) { if (!dir || dir[0] == '\0') return STATUS_FAILED; char *temp = new char[strlen(dir) + 2]; @@ -1874,7 +1874,7 @@ ERRORCODE CAdGame::addSpeechDir(const char *dir) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::removeSpeechDir(const char *dir) { +bool CAdGame::removeSpeechDir(const char *dir) { if (!dir || dir[0] == '\0') return STATUS_FAILED; char *temp = new char[strlen(dir) + 2]; @@ -1931,7 +1931,7 @@ bool CAdGame::validMouse() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::onMouseLeftDown() { +bool CAdGame::onMouseLeftDown() { if (!validMouse()) return STATUS_OK; if (_state == GAME_RUNNING && !_interactive) { if (_talkSkipButton == TALK_SKIP_LEFT || _talkSkipButton == TALK_SKIP_BOTH) { @@ -1959,7 +1959,7 @@ ERRORCODE CAdGame::onMouseLeftDown() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::onMouseLeftUp() { +bool CAdGame::onMouseLeftUp() { if (_activeObject) _activeObject->handleMouse(MOUSE_RELEASE, MOUSE_BUTTON_LEFT); CBPlatform::releaseCapture(); @@ -1978,7 +1978,7 @@ ERRORCODE CAdGame::onMouseLeftUp() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::onMouseLeftDblClick() { +bool CAdGame::onMouseLeftDblClick() { if (!validMouse()) return STATUS_OK; if (_state == GAME_RUNNING && !_interactive) return STATUS_OK; @@ -1997,7 +1997,7 @@ ERRORCODE CAdGame::onMouseLeftDblClick() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::onMouseRightDown() { +bool CAdGame::onMouseRightDown() { if (!validMouse()) return STATUS_OK; if (_state == GAME_RUNNING && !_interactive) { if (_talkSkipButton == TALK_SKIP_RIGHT || _talkSkipButton == TALK_SKIP_BOTH) { @@ -2022,7 +2022,7 @@ ERRORCODE CAdGame::onMouseRightDown() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::onMouseRightUp() { +bool CAdGame::onMouseRightUp() { if (_activeObject) _activeObject->handleMouse(MOUSE_RELEASE, MOUSE_BUTTON_RIGHT); bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("RightRelease")); @@ -2037,7 +2037,7 @@ ERRORCODE CAdGame::onMouseRightUp() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::displayDebugInfo() { +bool CAdGame::displayDebugInfo() { char str[100]; if (_gameRef->_debugDebugMode) { sprintf(str, "Mouse: %d, %d (scene: %d, %d)", _mousePos.x, _mousePos.y, _mousePos.x + _scene->getOffsetLeft(), _mousePos.y + _scene->getOffsetTop()); @@ -2051,7 +2051,7 @@ ERRORCODE CAdGame::displayDebugInfo() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdGame::onScriptShutdown(CScScript *script) { +bool CAdGame::onScriptShutdown(CScScript *script) { if (_responseBox && _responseBox->_waitingScript == script) _responseBox->_waitingScript = NULL; diff --git a/engines/wintermute/Ad/AdGame.h b/engines/wintermute/Ad/AdGame.h index 80a7bb7ea0..d677083db0 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 ERRORCODE onScriptShutdown(CScScript *script); + virtual bool onScriptShutdown(CScScript *script); - virtual ERRORCODE onMouseLeftDown(); - virtual ERRORCODE onMouseLeftUp(); - virtual ERRORCODE onMouseLeftDblClick(); - virtual ERRORCODE onMouseRightDown(); - virtual ERRORCODE onMouseRightUp(); + virtual bool onMouseLeftDown(); + virtual bool onMouseLeftUp(); + virtual bool onMouseLeftDblClick(); + virtual bool onMouseRightDown(); + virtual bool onMouseRightUp(); - virtual ERRORCODE displayDebugInfo(); + virtual bool displayDebugInfo(); - virtual ERRORCODE initAfterLoad(); + virtual bool initAfterLoad(); static void afterLoadScene(void *scene, void *data); bool _smartItemCursor; CBArray _speechDirs; - ERRORCODE addSpeechDir(const char *dir); - ERRORCODE removeSpeechDir(const char *dir); + bool addSpeechDir(const char *dir); + bool removeSpeechDir(const char *dir); char *findSpeechFile(char *StringID); - ERRORCODE deleteItem(CAdItem *Item); + bool deleteItem(CAdItem *Item); char *_itemsFile; bool _tempDisableSaveState; - virtual ERRORCODE resetContent(); - ERRORCODE addItem(CAdItem *item); + virtual bool resetContent(); + bool addItem(CAdItem *item); CAdItem *getItemByName(const char *name); CBArray _items; CAdObject *_inventoryOwner; bool isItemTaken(char *itemName); - ERRORCODE registerInventory(CAdInventory *inv); - ERRORCODE unregisterInventory(CAdInventory *inv); + bool registerInventory(CAdInventory *inv); + bool unregisterInventory(CAdInventory *inv); CAdObject *_invObject; CBArray _inventories; - virtual ERRORCODE displayContent(bool update = true, bool displayAll = false); + virtual bool displayContent(bool update = true, bool displayAll = false); char *_debugStartupScene; char *_startupScene; bool _initialScene; bool gameResponseUsed(int ID); - ERRORCODE addGameResponse(int ID); - ERRORCODE resetResponse(int ID); + bool addGameResponse(int ID); + bool resetResponse(int ID); bool branchResponseUsed(int ID); - 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); + bool addBranchResponse(int ID); + bool clearBranchResponses(char *name); + bool startDlgBranch(const char *branchName, const char *scriptName, const char *eventName); + bool endDlgBranch(const char *branchName, const char *scriptName, const char *eventName); + virtual bool windowLoadHook(CUIWindow *win, char **buf, char **params); + virtual bool 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 ERRORCODE getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor); - ERRORCODE scheduleChangeScene(const char *filename, bool fadeIn); + virtual bool getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor); + bool 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 ERRORCODE loadGame(const char *filename); + virtual bool loadGame(const char *filename); CAdItem *_selectedItem; - ERRORCODE cleanup(); + bool cleanup(); DECLARE_PERSISTENT(CAdGame, CBGame) void finishSentences(); - ERRORCODE showCursor(); + bool showCursor(); TGameStateEx _stateEx; CAdResponseBox *_responseBox; CAdInventoryBox *_inventoryBox; - ERRORCODE displaySentences(bool frozen); + bool displaySentences(bool frozen); void addSentence(CAdSentence *sentence); - ERRORCODE changeScene(const char *filename, bool fadeIn); - ERRORCODE removeObject(CAdObject *object); - ERRORCODE addObject(CAdObject *object); + bool changeScene(const char *filename, bool fadeIn); + bool removeObject(CAdObject *object); + bool addObject(CAdObject *object); CAdScene *_scene; - ERRORCODE initLoop(); + bool initLoop(); CAdGame(); virtual ~CAdGame(); CBArray _objects; @@ -140,19 +140,19 @@ public: CBArray _responsesBranch; CBArray _responsesGame; - virtual ERRORCODE loadFile(const char *filename); - virtual ERRORCODE loadBuffer(byte *buffer, bool complete = true); + virtual bool loadFile(const char *filename); + virtual bool loadBuffer(byte *buffer, bool complete = true); - ERRORCODE loadItemsFile(const char *filename, bool merge = false); - ERRORCODE loadItemsBuffer(byte *buffer, bool merge = false); + bool loadItemsFile(const char *filename, bool merge = false); + bool loadItemsBuffer(byte *buffer, bool merge = false); - virtual ERRORCODE ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStack, char *name); + virtual bool ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStack, char *name); // scripting interface virtual CScValue *scGetProperty(const char *name); - virtual ERRORCODE scSetProperty(const char *name, CScValue *value); - virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual bool scSetProperty(const char *name, CScValue *value); + virtual bool 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 24cf919165..30cb5e5b77 100644 --- a/engines/wintermute/Ad/AdInventory.cpp +++ b/engines/wintermute/Ad/AdInventory.cpp @@ -49,7 +49,7 @@ CAdInventory::~CAdInventory() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdInventory::insertItem(const char *name, const char *insertAfter) { +bool CAdInventory::insertItem(const char *name, const char *insertAfter) { if (name == NULL) return STATUS_FAILED; CAdItem *item = ((CAdGame *)_gameRef)->getItemByName(name); @@ -74,7 +74,7 @@ ERRORCODE CAdInventory::insertItem(const char *name, const char *insertAfter) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdInventory::removeItem(const char *name) { +bool CAdInventory::removeItem(const char *name) { if (name == NULL) return STATUS_FAILED; for (int i = 0; i < _takenItems.getSize(); i++) { @@ -91,7 +91,7 @@ ERRORCODE CAdInventory::removeItem(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdInventory::removeItem(CAdItem *item) { +bool CAdInventory::removeItem(CAdItem *item) { if (item == NULL) return STATUS_FAILED; for (int i = 0; i < _takenItems.getSize(); i++) { @@ -106,7 +106,7 @@ ERRORCODE CAdInventory::removeItem(CAdItem *item) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdInventory::persist(CBPersistMgr *persistMgr) { +bool CAdInventory::persist(CBPersistMgr *persistMgr) { CBObject::persist(persistMgr); diff --git a/engines/wintermute/Ad/AdInventory.h b/engines/wintermute/Ad/AdInventory.h index d78b78d89d..14929c8c4b 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) - ERRORCODE removeItem(const char *name); - ERRORCODE removeItem(CAdItem *Item); - ERRORCODE insertItem(const char *name, const char *insertAfter = NULL); + bool removeItem(const char *name); + bool removeItem(CAdItem *Item); + bool insertItem(const char *name, const char *insertAfter = NULL); CAdInventory(CBGame *inGame); virtual ~CAdInventory(); CBArray _takenItems; diff --git a/engines/wintermute/Ad/AdInventoryBox.cpp b/engines/wintermute/Ad/AdInventoryBox.cpp index 3b38903bbf..2e767574da 100644 --- a/engines/wintermute/Ad/AdInventoryBox.cpp +++ b/engines/wintermute/Ad/AdInventoryBox.cpp @@ -74,7 +74,7 @@ CAdInventoryBox::~CAdInventoryBox() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdInventoryBox::listen(CBScriptHolder *param1, uint32 param2) { +bool CAdInventoryBox::listen(CBScriptHolder *param1, uint32 param2) { CUIObject *obj = (CUIObject *)param1; switch (obj->_type) { @@ -98,7 +98,7 @@ ERRORCODE CAdInventoryBox::listen(CBScriptHolder *param1, uint32 param2) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdInventoryBox::display() { +bool CAdInventoryBox::display() { CAdGame *adGame = (CAdGame *)_gameRef; if (!_visible) return STATUS_OK; @@ -155,14 +155,14 @@ ERRORCODE CAdInventoryBox::display() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdInventoryBox::loadFile(const char *filename) { +bool CAdInventoryBox::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { _gameRef->LOG(0, "CAdInventoryBox::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } - ERRORCODE ret; + bool ret; _filename = new char [strlen(filename) + 1]; strcpy(_filename, filename); @@ -193,7 +193,7 @@ TOKEN_DEF(HIDE_SELECTED) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdInventoryBox::loadBuffer(byte *buffer, bool complete) { +bool CAdInventoryBox::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(INVENTORY_BOX) TOKEN_TABLE(TEMPLATE) @@ -318,7 +318,7 @@ ERRORCODE CAdInventoryBox::loadBuffer(byte *buffer, bool complete) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdInventoryBox::saveAsText(CBDynBuffer *buffer, int indent) { +bool CAdInventoryBox::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent, "INVENTORY_BOX\n"); buffer->putTextIndent(indent, "{\n"); @@ -351,7 +351,7 @@ ERRORCODE CAdInventoryBox::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdInventoryBox::persist(CBPersistMgr *persistMgr) { +bool CAdInventoryBox::persist(CBPersistMgr *persistMgr) { CBObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_closeButton)); diff --git a/engines/wintermute/Ad/AdInventoryBox.h b/engines/wintermute/Ad/AdInventoryBox.h index 857abd5d35..f6beae2d46 100644 --- a/engines/wintermute/Ad/AdInventoryBox.h +++ b/engines/wintermute/Ad/AdInventoryBox.h @@ -45,18 +45,18 @@ public: int _itemHeight; int _itemWidth; bool _visible; - virtual ERRORCODE display(); + virtual bool display(); CUIButton *_closeButton; int _spacing; int _scrollOffset; Rect32 _itemsArea; - ERRORCODE listen(CBScriptHolder *param1, uint32 param2); + bool listen(CBScriptHolder *param1, uint32 param2); CUIWindow *_window; CAdInventoryBox(CBGame *inGame); virtual ~CAdInventoryBox(); - ERRORCODE loadFile(const char *filename); - ERRORCODE loadBuffer(byte *buffer, bool complete = true); - virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent); + bool loadFile(const char *filename); + bool loadBuffer(byte *buffer, bool complete = true); + virtual bool saveAsText(CBDynBuffer *buffer, int indent); }; } // end of namespace WinterMute diff --git a/engines/wintermute/Ad/AdItem.cpp b/engines/wintermute/Ad/AdItem.cpp index 1727950191..be2177456f 100644 --- a/engines/wintermute/Ad/AdItem.cpp +++ b/engines/wintermute/Ad/AdItem.cpp @@ -84,14 +84,14 @@ CAdItem::~CAdItem() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdItem::loadFile(const char *filename) { +bool CAdItem::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { _gameRef->LOG(0, "CAdItem::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } - ERRORCODE ret; + bool ret; _filename = new char [strlen(filename) + 1]; strcpy(_filename, filename); @@ -134,7 +134,7 @@ TOKEN_DEF(AMOUNT_STRING) TOKEN_DEF(AMOUNT) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdItem::loadBuffer(byte *buffer, bool complete) { +bool CAdItem::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(ITEM) TOKEN_TABLE(TEMPLATE) @@ -319,7 +319,7 @@ ERRORCODE CAdItem::loadBuffer(byte *buffer, bool complete) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdItem::update() { +bool CAdItem::update() { _currentSprite = NULL; if (_state == STATE_READY && _animSprite) { @@ -386,7 +386,7 @@ ERRORCODE CAdItem::update() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdItem::display(int x, int y) { +bool CAdItem::display(int x, int y) { int width = 0; if (_currentSprite) { Rect32 rc; @@ -397,7 +397,7 @@ ERRORCODE CAdItem::display(int x, int y) { _posX = x + width / 2; _posY = y; - ERRORCODE ret; + bool ret; if (_currentSprite) ret = _currentSprite->draw(x, y, this, 100, 100, _alphaColor); else ret = STATUS_OK; @@ -430,7 +430,7 @@ ERRORCODE CAdItem::display(int x, int y) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdItem::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CAdItem::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // SetHoverSprite ////////////////////////////////////////////////////////////////////////// @@ -649,7 +649,7 @@ CScValue *CAdItem::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdItem::scSetProperty(const char *name, CScValue *value) { +bool CAdItem::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// // Name ////////////////////////////////////////////////////////////////////////// @@ -730,7 +730,7 @@ const char *CAdItem::scToString() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdItem::persist(CBPersistMgr *persistMgr) { +bool CAdItem::persist(CBPersistMgr *persistMgr) { CAdTalkHolder::persist(persistMgr); diff --git a/engines/wintermute/Ad/AdItem.h b/engines/wintermute/Ad/AdItem.h index f0810d95d1..fbbcd608d1 100644 --- a/engines/wintermute/Ad/AdItem.h +++ b/engines/wintermute/Ad/AdItem.h @@ -44,9 +44,9 @@ public: char *_amountString; - ERRORCODE update(); + bool update(); DECLARE_PERSISTENT(CAdItem, CAdTalkHolder) - ERRORCODE display(int x, int y); + bool 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(); - ERRORCODE loadFile(const char *filename); - ERRORCODE loadBuffer(byte *buffer, bool complete = true); + bool loadFile(const char *filename); + bool loadBuffer(byte *buffer, bool complete = true); // scripting interface virtual CScValue *scGetProperty(const char *name); - virtual ERRORCODE scSetProperty(const char *name, CScValue *value); - virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual bool scSetProperty(const char *name, CScValue *value); + virtual bool 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 b7d8eb3cc2..1dd1efb8a6 100644 --- a/engines/wintermute/Ad/AdLayer.cpp +++ b/engines/wintermute/Ad/AdLayer.cpp @@ -61,14 +61,14 @@ CAdLayer::~CAdLayer() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdLayer::loadFile(const char *filename) { +bool CAdLayer::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { _gameRef->LOG(0, "CAdLayer::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } - ERRORCODE ret; + bool ret; _filename = new char [strlen(filename) + 1]; strcpy(_filename, filename); @@ -99,7 +99,7 @@ TOKEN_DEF(CLOSE_UP) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdLayer::loadBuffer(byte *buffer, bool complete) { +bool CAdLayer::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(LAYER) TOKEN_TABLE(TEMPLATE) @@ -226,7 +226,7 @@ ERRORCODE CAdLayer::loadBuffer(byte *buffer, bool complete) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdLayer::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CAdLayer::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // GetNode ////////////////////////////////////////////////////////////////////////// @@ -420,7 +420,7 @@ CScValue *CAdLayer::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdLayer::scSetProperty(const char *name, CScValue *value) { +bool CAdLayer::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// // Name ////////////////////////////////////////////////////////////////////////// @@ -477,7 +477,7 @@ const char *CAdLayer::scToString() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdLayer::saveAsText(CBDynBuffer *buffer, int indent) { +bool 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()); @@ -520,7 +520,7 @@ ERRORCODE CAdLayer::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdLayer::persist(CBPersistMgr *persistMgr) { +bool CAdLayer::persist(CBPersistMgr *persistMgr) { CBObject::persist(persistMgr); diff --git a/engines/wintermute/Ad/AdLayer.h b/engines/wintermute/Ad/AdLayer.h index 29df4c0c34..0ccdb13ae7 100644 --- a/engines/wintermute/Ad/AdLayer.h +++ b/engines/wintermute/Ad/AdLayer.h @@ -42,14 +42,14 @@ public: CAdLayer(CBGame *inGame); virtual ~CAdLayer(); CBArray _nodes; - ERRORCODE loadFile(const char *filename); - ERRORCODE loadBuffer(byte *buffer, bool complete = true); - virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent); + bool loadFile(const char *filename); + bool loadBuffer(byte *buffer, bool complete = true); + virtual bool saveAsText(CBDynBuffer *buffer, int indent); // scripting interface virtual CScValue *scGetProperty(const char *name); - virtual ERRORCODE scSetProperty(const char *name, CScValue *value); - virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual bool scSetProperty(const char *name, CScValue *value); + virtual bool 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 6d96c041a1..5037ec0272 100644 --- a/engines/wintermute/Ad/AdNodeState.cpp +++ b/engines/wintermute/Ad/AdNodeState.cpp @@ -92,7 +92,7 @@ void CAdNodeState::setCursor(const char *filename) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdNodeState::persist(CBPersistMgr *persistMgr) { +bool CAdNodeState::persist(CBPersistMgr *persistMgr) { persistMgr->transfer(TMEMBER(_gameRef)); persistMgr->transfer(TMEMBER(_active)); @@ -129,7 +129,7 @@ char *CAdNodeState::getCaption(int caseVal) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdNodeState::transferEntity(CAdEntity *entity, bool includingSprites, bool saving) { +bool CAdNodeState::transferEntity(CAdEntity *entity, bool includingSprites, bool saving) { if (!entity) return STATUS_FAILED; // hack! diff --git a/engines/wintermute/Ad/AdNodeState.h b/engines/wintermute/Ad/AdNodeState.h index fcd1f1402b..186f2ebbb2 100644 --- a/engines/wintermute/Ad/AdNodeState.h +++ b/engines/wintermute/Ad/AdNodeState.h @@ -35,7 +35,7 @@ class CAdEntity; class CAdNodeState : public CBBase { public: - ERRORCODE transferEntity(CAdEntity *entity, bool includingSprites, bool saving); + bool 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 3321e5871f..451fca7fa6 100644 --- a/engines/wintermute/Ad/AdObject.cpp +++ b/engines/wintermute/Ad/AdObject.cpp @@ -151,7 +151,7 @@ CAdObject::~CAdObject() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdObject::playAnim(const char *filename) { +bool CAdObject::playAnim(const char *filename) { delete _animSprite; _animSprite = NULL; _animSprite = new CBSprite(_gameRef, this); @@ -159,7 +159,7 @@ ERRORCODE CAdObject::playAnim(const char *filename) { _gameRef->LOG(0, "CAdObject::PlayAnim: error creating temp sprite (object:\"%s\" sprite:\"%s\")", _name, filename); return STATUS_FAILED; } - ERRORCODE res = _animSprite->loadFile(filename); + bool res = _animSprite->loadFile(filename); if (DID_FAIL(res)) { _gameRef->LOG(res, "CAdObject::PlayAnim: error loading temp sprite (object:\"%s\" sprite:\"%s\")", _name, filename); delete _animSprite; @@ -173,13 +173,13 @@ ERRORCODE CAdObject::playAnim(const char *filename) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdObject::display() { +bool CAdObject::display() { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdObject::update() { +bool CAdObject::update() { return STATUS_OK; } @@ -187,7 +187,7 @@ ERRORCODE CAdObject::update() { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // PlayAnim / PlayAnimAsync @@ -488,7 +488,7 @@ ERRORCODE CAdObject::scCallMethod(CScScript *script, CScStack *stack, CScStack * int offsetX = stack->pop()->getInt(); int offsetY = stack->pop()->getInt(); - ERRORCODE res; + bool res; CAdEntity *ent = new CAdEntity(_gameRef); if (DID_FAIL(res = ent->loadFile(filename))) { delete ent; @@ -715,7 +715,7 @@ CScValue *CAdObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdObject::scSetProperty(const char *name, CScValue *value) { +bool CAdObject::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// // Active @@ -792,7 +792,7 @@ const char *CAdObject::scToString() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdObject::SetFont(const char *filename) { +bool CAdObject::SetFont(const char *filename) { if (_font) _gameRef->_fontStorage->removeFont(_font); if (filename) { _font = _gameRef->_fontStorage->addFont(filename); @@ -936,7 +936,7 @@ void CAdObject::talk(const char *text, const char *sound, uint32 duration, const ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdObject::reset() { +bool CAdObject::reset() { if (_state == STATE_PLAYING_ANIM && _animSprite != NULL) { delete _animSprite; _animSprite = NULL; @@ -953,7 +953,7 @@ ERRORCODE CAdObject::reset() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdObject::persist(CBPersistMgr *persistMgr) { +bool CAdObject::persist(CBPersistMgr *persistMgr) { CBObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_active)); @@ -998,7 +998,7 @@ ERRORCODE CAdObject::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdObject::updateSounds() { +bool CAdObject::updateSounds() { if (_sentence && _sentence->_sound) updateOneSound(_sentence->_sound); @@ -1007,7 +1007,7 @@ ERRORCODE CAdObject::updateSounds() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdObject::resetSoundPan() { +bool CAdObject::resetSoundPan() { if (_sentence && _sentence->_sound) { _sentence->_sound->setPan(0.0f); } @@ -1025,7 +1025,7 @@ bool CAdObject::getExtendedFlag(const char *flagName) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdObject::saveAsText(CBDynBuffer *buffer, int indent) { +bool CAdObject::saveAsText(CBDynBuffer *buffer, int indent) { if (_blockRegion) _blockRegion->saveAsText(buffer, indent + 2, "BLOCKED_REGION"); if (_wptGroup) _wptGroup->saveAsText(buffer, indent + 2); @@ -1036,7 +1036,7 @@ ERRORCODE CAdObject::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdObject::updateBlockRegion() { +bool CAdObject::updateBlockRegion() { CAdGame *adGame = (CAdGame *)_gameRef; if (adGame->_scene) { if (_blockRegion && _currentBlockRegion) @@ -1059,7 +1059,7 @@ CAdInventory *CAdObject::getInventory() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdObject::afterMove() { +bool CAdObject::afterMove() { CAdRegion *newRegions[MAX_NUM_REGIONS]; ((CAdGame *)_gameRef)->_scene->getRegionsAt(_posX, _posY, newRegions, MAX_NUM_REGIONS); @@ -1087,14 +1087,14 @@ ERRORCODE CAdObject::afterMove() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdObject::invalidateCurrRegions() { +bool CAdObject::invalidateCurrRegions() { for (int i = 0; i < MAX_NUM_REGIONS; i++) _currentRegions[i] = NULL; return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdObject::getScale(float *scaleX, float *scaleY) { +bool CAdObject::getScale(float *scaleX, float *scaleY) { if (_zoomable) { if (_scaleX >= 0 || _scaleY >= 0) { *scaleX = _scaleX < 0 ? 100 : _scaleX; @@ -1108,7 +1108,7 @@ ERRORCODE CAdObject::getScale(float *scaleX, float *scaleY) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdObject::updateSpriteAttachments() { +bool CAdObject::updateSpriteAttachments() { for (int i = 0; i < _attachmentsPre.getSize(); i++) { _attachmentsPre[i]->update(); } @@ -1119,7 +1119,7 @@ ERRORCODE CAdObject::updateSpriteAttachments() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdObject::displaySpriteAttachments(bool preDisplay) { +bool CAdObject::displaySpriteAttachments(bool preDisplay) { if (preDisplay) { for (int i = 0; i < _attachmentsPre.getSize(); i++) { displaySpriteAttachment(_attachmentsPre[i]); @@ -1133,7 +1133,7 @@ ERRORCODE CAdObject::displaySpriteAttachments(bool preDisplay) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdObject::displaySpriteAttachment(CAdObject *attachment) { +bool CAdObject::displaySpriteAttachment(CAdObject *attachment) { if (!attachment->_active) return STATUS_OK; float scaleX, scaleY; @@ -1162,7 +1162,7 @@ ERRORCODE CAdObject::displaySpriteAttachment(CAdObject *attachment) { attachment->_registerAlias = this; attachment->_registrable = this->_registrable; - ERRORCODE ret = attachment->display(); + bool ret = attachment->display(); attachment->_posX = origX; attachment->_posY = origY; @@ -1187,7 +1187,7 @@ CPartEmitter *CAdObject::createParticleEmitter(bool followParent, int offsetX, i } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdObject::updatePartEmitter() { +bool CAdObject::updatePartEmitter() { if (!_partEmitter) return STATUS_FAILED; if (_partFollowParent) { diff --git a/engines/wintermute/Ad/AdObject.h b/engines/wintermute/Ad/AdObject.h index 546089bada..6fb7c02b0f 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 ERRORCODE updatePartEmitter(); + virtual bool updatePartEmitter(); bool _partFollowParent; int _partOffsetX; int _partOffsetY; - ERRORCODE invalidateCurrRegions(); + bool invalidateCurrRegions(); bool _subtitlesModRelative; bool _subtitlesModXCenter; int _subtitlesModX; @@ -61,23 +61,23 @@ public: CAdRegion *_stickRegion; bool _sceneIndependent; bool _ignoreItems; - ERRORCODE updateBlockRegion(); + bool updateBlockRegion(); bool _forcedTalkAnimUsed; char *_forcedTalkAnimName; virtual bool getExtendedFlag(const char *flagName); - virtual ERRORCODE resetSoundPan(); - virtual ERRORCODE updateSounds(); - ERRORCODE reset(); + virtual bool resetSoundPan(); + virtual bool updateSounds(); + bool 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; - ERRORCODE SetFont(const char *filename); - virtual ERRORCODE update(); - virtual ERRORCODE display(); + bool SetFont(const char *filename); + virtual bool update(); + virtual bool display(); bool _drawn; bool _active; - virtual ERRORCODE playAnim(const char *filename); + virtual bool playAnim(const char *filename); CBSprite *_animSprite; CBSprite *_currentSprite; TObjectState _state; @@ -93,29 +93,29 @@ public: CAdWaypointGroup *_currentWptGroup; CAdInventory *getInventory(); - virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent); + virtual bool saveAsText(CBDynBuffer *buffer, int indent); - virtual ERRORCODE afterMove(); + virtual bool afterMove(); CAdRegion *_currentRegions[MAX_NUM_REGIONS]; // scripting interface virtual CScValue *scGetProperty(const char *name); - virtual ERRORCODE scSetProperty(const char *name, CScValue *value); - virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual bool scSetProperty(const char *name, CScValue *value); + virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); virtual const char *scToString(); CBArray _attachmentsPre; CBArray _attachmentsPost; - ERRORCODE updateSpriteAttachments(); - ERRORCODE displaySpriteAttachments(bool preDisplay); + bool updateSpriteAttachments(); + bool displaySpriteAttachments(bool preDisplay); CAdObject *_registerAlias; private: - ERRORCODE displaySpriteAttachment(CAdObject *attachment); + bool displaySpriteAttachment(CAdObject *attachment); CAdInventory *_inventory; protected: - ERRORCODE getScale(float *scaleX, float *scaleY); + bool getScale(float *scaleX, float *scaleY); }; } // end of namespace WinterMute diff --git a/engines/wintermute/Ad/AdPath.cpp b/engines/wintermute/Ad/AdPath.cpp index 0aced4cabc..4f0c996157 100644 --- a/engines/wintermute/Ad/AdPath.cpp +++ b/engines/wintermute/Ad/AdPath.cpp @@ -98,7 +98,7 @@ bool CAdPath::setReady(bool ready) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdPath::persist(CBPersistMgr *persistMgr) { +bool CAdPath::persist(CBPersistMgr *persistMgr) { persistMgr->transfer(TMEMBER(_gameRef)); diff --git a/engines/wintermute/Ad/AdPathPoint.cpp b/engines/wintermute/Ad/AdPathPoint.cpp index 17c2e41fb1..25e62b80e9 100644 --- a/engines/wintermute/Ad/AdPathPoint.cpp +++ b/engines/wintermute/Ad/AdPathPoint.cpp @@ -61,7 +61,7 @@ CAdPathPoint::~CAdPathPoint() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdPathPoint::persist(CBPersistMgr *persistMgr) { +bool CAdPathPoint::persist(CBPersistMgr *persistMgr) { CBPoint::persist(persistMgr); diff --git a/engines/wintermute/Ad/AdRegion.cpp b/engines/wintermute/Ad/AdRegion.cpp index a37386e7b3..2c481db96d 100644 --- a/engines/wintermute/Ad/AdRegion.cpp +++ b/engines/wintermute/Ad/AdRegion.cpp @@ -54,14 +54,14 @@ CAdRegion::~CAdRegion() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdRegion::loadFile(const char *filename) { +bool CAdRegion::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { _gameRef->LOG(0, "CAdRegion::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } - ERRORCODE ret; + bool ret; _filename = new char [strlen(filename) + 1]; strcpy(_filename, filename); @@ -95,7 +95,7 @@ TOKEN_DEF(PROPERTY) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdRegion::loadBuffer(byte *buffer, bool complete) { +bool CAdRegion::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(REGION) TOKEN_TABLE(TEMPLATE) @@ -219,7 +219,7 @@ ERRORCODE CAdRegion::loadBuffer(byte *buffer, bool complete) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdRegion::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CAdRegion::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { /* ////////////////////////////////////////////////////////////////////////// // SkipTo @@ -294,7 +294,7 @@ CScValue *CAdRegion::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdRegion::scSetProperty(const char *name, CScValue *value) { +bool CAdRegion::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// // Name ////////////////////////////////////////////////////////////////////////// @@ -346,7 +346,7 @@ const char *CAdRegion::scToString() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdRegion::saveAsText(CBDynBuffer *buffer, int indent) { +bool 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()); @@ -378,7 +378,7 @@ ERRORCODE CAdRegion::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdRegion::persist(CBPersistMgr *persistMgr) { +bool CAdRegion::persist(CBPersistMgr *persistMgr) { CBRegion::persist(persistMgr); persistMgr->transfer(TMEMBER(_alpha)); diff --git a/engines/wintermute/Ad/AdRegion.h b/engines/wintermute/Ad/AdRegion.h index 2b8d13b587..a565641de4 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(); - ERRORCODE loadFile(const char *filename); - ERRORCODE loadBuffer(byte *buffer, bool complete = true); - virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent); + bool loadFile(const char *filename); + bool loadBuffer(byte *buffer, bool complete = true); + virtual bool saveAsText(CBDynBuffer *buffer, int indent); // scripting interface virtual CScValue *scGetProperty(const char *name); - virtual ERRORCODE scSetProperty(const char *name, CScValue *value); - virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual bool scSetProperty(const char *name, CScValue *value); + virtual bool 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 0fd2245282..a74d1b960e 100644 --- a/engines/wintermute/Ad/AdResponse.cpp +++ b/engines/wintermute/Ad/AdResponse.cpp @@ -72,7 +72,7 @@ void CAdResponse::setText(const char *text) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdResponse::setIcon(const char *filename) { +bool CAdResponse::setIcon(const char *filename) { delete _icon; _icon = new CBSprite(_gameRef); if (!_icon || DID_FAIL(_icon->loadFile(filename))) { @@ -85,7 +85,7 @@ ERRORCODE CAdResponse::setIcon(const char *filename) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdResponse::setFont(const char *filename) { +bool CAdResponse::setFont(const char *filename) { if (_font) _gameRef->_fontStorage->removeFont(_font); _font = _gameRef->_fontStorage->addFont(filename); if (!_font) { @@ -96,7 +96,7 @@ ERRORCODE CAdResponse::setFont(const char *filename) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdResponse::setIconHover(const char *filename) { +bool CAdResponse::setIconHover(const char *filename) { delete _iconHover; _iconHover = new CBSprite(_gameRef); if (!_iconHover || DID_FAIL(_iconHover->loadFile(filename))) { @@ -110,7 +110,7 @@ ERRORCODE CAdResponse::setIconHover(const char *filename) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdResponse::setIconPressed(const char *filename) { +bool CAdResponse::setIconPressed(const char *filename) { delete _iconPressed; _iconPressed = new CBSprite(_gameRef); if (!_iconPressed || DID_FAIL(_iconPressed->loadFile(filename))) { @@ -124,7 +124,7 @@ ERRORCODE CAdResponse::setIconPressed(const char *filename) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdResponse::persist(CBPersistMgr *persistMgr) { +bool CAdResponse::persist(CBPersistMgr *persistMgr) { CBObject::persist(persistMgr); diff --git a/engines/wintermute/Ad/AdResponse.h b/engines/wintermute/Ad/AdResponse.h index 46f16ea98f..f5ca08639b 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) - ERRORCODE setIcon(const char *filename); - ERRORCODE setFont(const char *filename); - ERRORCODE setIconHover(const char *filename); - ERRORCODE setIconPressed(const char *filename); + bool setIcon(const char *filename); + bool setFont(const char *filename); + bool setIconHover(const char *filename); + bool 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 ef9d3a32c6..4e0bab38c7 100644 --- a/engines/wintermute/Ad/AdResponseBox.cpp +++ b/engines/wintermute/Ad/AdResponseBox.cpp @@ -111,7 +111,7 @@ void CAdResponseBox::clearButtons() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdResponseBox::invalidateButtons() { +bool CAdResponseBox::invalidateButtons() { for (int i = 0; i < _respButtons.getSize(); i++) { _respButtons[i]->_image = NULL; _respButtons[i]->_cursor = NULL; @@ -125,7 +125,7 @@ ERRORCODE CAdResponseBox::invalidateButtons() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdResponseBox::createButtons() { +bool CAdResponseBox::createButtons() { clearButtons(); _scrollOffset = 0; @@ -187,14 +187,14 @@ ERRORCODE CAdResponseBox::createButtons() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdResponseBox::loadFile(const char *filename) { +bool CAdResponseBox::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { _gameRef->LOG(0, "CAdResponseBox::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } - ERRORCODE ret; + bool ret; _filename = new char [strlen(filename) + 1]; strcpy(_filename, filename); @@ -223,7 +223,7 @@ TOKEN_DEF(VERTICAL_ALIGN) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdResponseBox::loadBuffer(byte *buffer, bool complete) { +bool CAdResponseBox::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(RESPONSE_BOX) TOKEN_TABLE(TEMPLATE) @@ -335,7 +335,7 @@ ERRORCODE CAdResponseBox::loadBuffer(byte *buffer, bool complete) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdResponseBox::saveAsText(CBDynBuffer *buffer, int indent) { +bool CAdResponseBox::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent, "RESPONSE_BOX\n"); buffer->putTextIndent(indent, "{\n"); @@ -396,7 +396,7 @@ ERRORCODE CAdResponseBox::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdResponseBox::display() { +bool CAdResponseBox::display() { Rect32 rect = _responseArea; if (_window) { CBPlatform::offsetRect(&rect, _window->_posX, _window->_posY); @@ -482,7 +482,7 @@ ERRORCODE CAdResponseBox::display() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdResponseBox::listen(CBScriptHolder *param1, uint32 param2) { +bool CAdResponseBox::listen(CBScriptHolder *param1, uint32 param2) { CUIObject *obj = (CUIObject *)param1; switch (obj->_type) { @@ -511,7 +511,7 @@ ERRORCODE CAdResponseBox::listen(CBScriptHolder *param1, uint32 param2) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdResponseBox::persist(CBPersistMgr *persistMgr) { +bool CAdResponseBox::persist(CBPersistMgr *persistMgr) { CBObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_font)); @@ -536,7 +536,7 @@ ERRORCODE CAdResponseBox::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdResponseBox::weedResponses() { +bool CAdResponseBox::weedResponses() { CAdGame *adGame = (CAdGame *)_gameRef; for (int i = 0; i < _responses.getSize(); i++) { @@ -573,7 +573,7 @@ void CAdResponseBox::setLastResponseText(const char *text, const char *textOrig) ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdResponseBox::handleResponse(CAdResponse *response) { +bool CAdResponseBox::handleResponse(CAdResponse *response) { setLastResponseText(response->_text, response->_textOrig); CAdGame *adGame = (CAdGame *)_gameRef; @@ -635,7 +635,7 @@ CBObject *CAdResponseBox::getPrevAccessObject(CBObject *currObject) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdResponseBox::getObjects(CBArray &objects, bool interactiveOnly) { +bool CAdResponseBox::getObjects(CBArray &objects, bool interactiveOnly) { for (int i = 0; i < _respButtons.getSize(); i++) { objects.add(_respButtons[i]); } diff --git a/engines/wintermute/Ad/AdResponseBox.h b/engines/wintermute/Ad/AdResponseBox.h index 86fe8ed947..ba2962a8f7 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); - ERRORCODE getObjects(CBArray &objects, bool interactiveOnly); + bool getObjects(CBArray &objects, bool interactiveOnly); - ERRORCODE handleResponse(CAdResponse *response); + bool handleResponse(CAdResponse *response); void setLastResponseText(const char *text, const char *textOrig); char *_lastResponseText; char *_lastResponseTextOrig; DECLARE_PERSISTENT(CAdResponseBox, CBObject) CScScript *_waitingScript; - virtual ERRORCODE listen(CBScriptHolder *param1, uint32 param2); + virtual bool listen(CBScriptHolder *param1, uint32 param2); typedef enum { EVENT_PREV, EVENT_NEXT, EVENT_RESPONSE } TResponseEvent; - ERRORCODE weedResponses(); - ERRORCODE display(); + bool weedResponses(); + bool display(); int _spacing; int _scrollOffset; CBFont *_fontHover; CBFont *_font; - ERRORCODE createButtons(); - ERRORCODE invalidateButtons(); + bool createButtons(); + bool invalidateButtons(); void clearButtons(); void clearResponses(); CAdResponseBox(CBGame *inGame); @@ -77,9 +77,9 @@ public: Rect32 _responseArea; int _verticalAlign; TTextAlign _align; - ERRORCODE loadFile(const char *filename); - ERRORCODE loadBuffer(byte *buffer, bool complete = true); - virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent); + bool loadFile(const char *filename); + bool loadBuffer(byte *buffer, bool complete = true); + virtual bool saveAsText(CBDynBuffer *buffer, int indent); }; } // end of namespace WinterMute diff --git a/engines/wintermute/Ad/AdResponseContext.cpp b/engines/wintermute/Ad/AdResponseContext.cpp index d44eb33403..77a84e651d 100644 --- a/engines/wintermute/Ad/AdResponseContext.cpp +++ b/engines/wintermute/Ad/AdResponseContext.cpp @@ -49,7 +49,7 @@ CAdResponseContext::~CAdResponseContext() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdResponseContext::persist(CBPersistMgr *persistMgr) { +bool CAdResponseContext::persist(CBPersistMgr *persistMgr) { persistMgr->transfer(TMEMBER(_gameRef)); persistMgr->transfer(TMEMBER(_context)); persistMgr->transfer(TMEMBER(_iD)); diff --git a/engines/wintermute/Ad/AdRotLevel.cpp b/engines/wintermute/Ad/AdRotLevel.cpp index aa1727cc3e..956a3efcab 100644 --- a/engines/wintermute/Ad/AdRotLevel.cpp +++ b/engines/wintermute/Ad/AdRotLevel.cpp @@ -53,14 +53,14 @@ CAdRotLevel::~CAdRotLevel() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdRotLevel::loadFile(const char *filename) { +bool CAdRotLevel::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { _gameRef->LOG(0, "CAdRotLevel::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } - ERRORCODE ret; + bool ret; _filename = new char [strlen(filename) + 1]; strcpy(_filename, filename); @@ -82,7 +82,7 @@ TOKEN_DEF(ROTATION) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdRotLevel::loadBuffer(byte *buffer, bool complete) { +bool CAdRotLevel::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(ROTATION_LEVEL) TOKEN_TABLE(TEMPLATE) @@ -135,7 +135,7 @@ ERRORCODE CAdRotLevel::loadBuffer(byte *buffer, bool complete) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdRotLevel::saveAsText(CBDynBuffer *buffer, int indent) { +bool 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); @@ -147,7 +147,7 @@ ERRORCODE CAdRotLevel::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdRotLevel::persist(CBPersistMgr *persistMgr) { +bool CAdRotLevel::persist(CBPersistMgr *persistMgr) { CBObject::persist(persistMgr); diff --git a/engines/wintermute/Ad/AdRotLevel.h b/engines/wintermute/Ad/AdRotLevel.h index 76e2484b07..88b0b08aeb 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 ERRORCODE saveAsText(CBDynBuffer *buffer, int indent); - ERRORCODE loadFile(const char *filename); - ERRORCODE loadBuffer(byte *buffer, bool complete = true); + virtual bool saveAsText(CBDynBuffer *buffer, int indent); + bool loadFile(const char *filename); + bool 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 c756219382..58e62bd9b4 100644 --- a/engines/wintermute/Ad/AdScaleLevel.cpp +++ b/engines/wintermute/Ad/AdScaleLevel.cpp @@ -51,14 +51,14 @@ CAdScaleLevel::~CAdScaleLevel() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScaleLevel::loadFile(const char *filename) { +bool CAdScaleLevel::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { _gameRef->LOG(0, "CAdScaleLevel::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } - ERRORCODE ret; + bool ret; _filename = new char [strlen(filename) + 1]; strcpy(_filename, filename); @@ -80,7 +80,7 @@ TOKEN_DEF(SCALE) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScaleLevel::loadBuffer(byte *buffer, bool complete) { +bool CAdScaleLevel::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(SCALE_LEVEL) TOKEN_TABLE(TEMPLATE) @@ -133,7 +133,7 @@ ERRORCODE CAdScaleLevel::loadBuffer(byte *buffer, bool complete) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScaleLevel::saveAsText(CBDynBuffer *buffer, int indent) { +bool 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); @@ -145,7 +145,7 @@ ERRORCODE CAdScaleLevel::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScaleLevel::persist(CBPersistMgr *persistMgr) { +bool CAdScaleLevel::persist(CBPersistMgr *persistMgr) { CBObject::persist(persistMgr); diff --git a/engines/wintermute/Ad/AdScaleLevel.h b/engines/wintermute/Ad/AdScaleLevel.h index b62e18e344..5377325ed5 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 ERRORCODE saveAsText(CBDynBuffer *buffer, int indent); - ERRORCODE loadFile(const char *filename); - ERRORCODE loadBuffer(byte *buffer, bool complete = true); + virtual bool saveAsText(CBDynBuffer *buffer, int indent); + bool loadFile(const char *filename); + bool 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 e72b3211de..aad3ffdd1d 100644 --- a/engines/wintermute/Ad/AdScene.cpp +++ b/engines/wintermute/Ad/AdScene.cpp @@ -481,7 +481,7 @@ void CAdScene::pathFinderStep() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::initLoop() { +bool CAdScene::initLoop() { #ifdef _DEBUGxxxx int nu_steps = 0; uint32 start = _gameRef->_currentTime; @@ -500,14 +500,14 @@ ERRORCODE CAdScene::initLoop() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::loadFile(const char *filename) { +bool CAdScene::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { _gameRef->LOG(0, "CAdScene::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } - ERRORCODE ret; + bool ret; delete[] _filename; _filename = new char [strlen(filename) + 1]; @@ -565,7 +565,7 @@ TOKEN_DEF(PERSISTENT_STATE) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::loadBuffer(byte *buffer, bool complete) { +bool CAdScene::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(SCENE) TOKEN_TABLE(TEMPLATE) @@ -856,7 +856,7 @@ ERRORCODE CAdScene::loadBuffer(byte *buffer, bool complete) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::traverseNodes(bool doUpdate) { +bool CAdScene::traverseNodes(bool doUpdate) { if (!_initialized) return STATUS_OK; int j, k; @@ -1030,12 +1030,12 @@ ERRORCODE CAdScene::traverseNodes(bool doUpdate) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::display() { +bool CAdScene::display() { return traverseNodes(false); } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::updateFreeObjects() { +bool CAdScene::updateFreeObjects() { CAdGame *adGame = (CAdGame *)_gameRef; bool is3DSet; @@ -1067,7 +1067,7 @@ ERRORCODE CAdScene::updateFreeObjects() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::displayRegionContent(CAdRegion *region, bool display3DOnly) { +bool CAdScene::displayRegionContent(CAdRegion *region, bool display3DOnly) { CAdGame *adGame = (CAdGame *)_gameRef; CBArray objects; CAdObject *obj; @@ -1130,7 +1130,7 @@ int CAdScene::compareObjs(const void *obj1, const void *obj2) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::displayRegionContentOld(CAdRegion *region) { +bool CAdScene::displayRegionContentOld(CAdRegion *region) { CAdGame *adGame = (CAdGame *)_gameRef; CAdObject *obj; @@ -1180,7 +1180,7 @@ ERRORCODE CAdScene::displayRegionContentOld(CAdRegion *region) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::update() { +bool CAdScene::update() { return traverseNodes(true); } @@ -1240,7 +1240,7 @@ void CAdScene::skipTo(int offsetX, int offsetY) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CAdScene::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // LoadActor ////////////////////////////////////////////////////////////////////////// @@ -1834,7 +1834,7 @@ CScValue *CAdScene::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::scSetProperty(const char *name, CScValue *value) { +bool CAdScene::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// // Name ////////////////////////////////////////////////////////////////////////// @@ -1942,14 +1942,14 @@ const char *CAdScene::scToString() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::addObject(CAdObject *object) { +bool CAdScene::addObject(CAdObject *object) { _objects.add(object); return _gameRef->registerObject(object); } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::removeObject(CAdObject *object) { +bool CAdScene::removeObject(CAdObject *object) { for (int i = 0; i < _objects.getSize(); i++) { if (_objects[i] == object) { _objects.removeAt(i); @@ -1961,7 +1961,7 @@ ERRORCODE CAdScene::removeObject(CAdObject *object) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::saveAsText(CBDynBuffer *buffer, int indent) { +bool CAdScene::saveAsText(CBDynBuffer *buffer, int indent) { int i; buffer->putTextIndent(indent, "SCENE {\n"); @@ -2059,7 +2059,7 @@ ERRORCODE CAdScene::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::sortScaleLevels() { +bool CAdScene::sortScaleLevels() { bool changed; do { changed = false; @@ -2080,7 +2080,7 @@ ERRORCODE CAdScene::sortScaleLevels() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::sortRotLevels() { +bool CAdScene::sortRotLevels() { bool changed; do { changed = false; @@ -2127,7 +2127,7 @@ float CAdScene::getScaleAt(int Y) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::persist(CBPersistMgr *persistMgr) { +bool CAdScene::persist(CBPersistMgr *persistMgr) { CBObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_autoScroll)); @@ -2187,12 +2187,12 @@ ERRORCODE CAdScene::persist(CBPersistMgr *persistMgr) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::afterLoad() { +bool CAdScene::afterLoad() { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::correctTargetPoint2(int startX, int startY, int *targetX, int *targetY, bool checkFreeObjects, CBObject *requester) { +bool 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; @@ -2251,7 +2251,7 @@ ERRORCODE CAdScene::correctTargetPoint2(int startX, int startY, int *targetX, in } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::correctTargetPoint(int startX, int startY, int *argX, int *argY, bool checkFreeObjects, CBObject *requester) { +bool CAdScene::correctTargetPoint(int startX, int startY, int *argX, int *argY, bool checkFreeObjects, CBObject *requester) { int x = *argX; int y = *argY; @@ -2350,7 +2350,7 @@ void CAdScene::pfPointsAdd(int x, int y, int distance) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::getViewportOffset(int *offsetX, int *offsetY) { +bool CAdScene::getViewportOffset(int *offsetX, int *offsetY) { CAdGame *adGame = (CAdGame *)_gameRef; if (_viewport && !_gameRef->_editorMode) { if (offsetX) *offsetX = _viewport->_offsetX; @@ -2367,7 +2367,7 @@ ERRORCODE CAdScene::getViewportOffset(int *offsetX, int *offsetY) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::getViewportSize(int *width, int *height) { +bool CAdScene::getViewportSize(int *width, int *height) { CAdGame *adGame = (CAdGame *)_gameRef; if (_viewport && !_gameRef->_editorMode) { if (width) *width = _viewport->getWidth(); @@ -2464,19 +2464,19 @@ CBObject *CAdScene::getNodeByName(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::saveState() { +bool CAdScene::saveState() { return persistState(true); } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::loadState() { +bool CAdScene::loadState() { return persistState(false); } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::persistState(bool saving) { +bool CAdScene::persistState(bool saving) { if (!_persistentState) return STATUS_OK; CAdGame *adGame = (CAdGame *)_gameRef; @@ -2568,7 +2568,7 @@ float CAdScene::getRotationAt(int x, int y) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::handleItemAssociations(const char *itemName, bool show) { +bool 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++) { @@ -2592,7 +2592,7 @@ ERRORCODE CAdScene::handleItemAssociations(const char *itemName, bool show) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::getRegionsAt(int x, int y, CAdRegion **regionList, int numRegions) { +bool 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--) { @@ -2613,7 +2613,7 @@ ERRORCODE CAdScene::getRegionsAt(int x, int y, CAdRegion **regionList, int numRe } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::restoreDeviceObjects() { +bool CAdScene::restoreDeviceObjects() { return STATUS_OK; } @@ -2660,7 +2660,7 @@ CBObject *CAdScene::getPrevAccessObject(CBObject *currObject) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::getSceneObjects(CBArray &objects, bool interactiveOnly) { +bool CAdScene::getSceneObjects(CBArray &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(); @@ -2719,7 +2719,7 @@ ERRORCODE CAdScene::getSceneObjects(CBArray &objects, ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdScene::getRegionObjects(CAdRegion *region, CBArray &objects, bool interactiveOnly) { +bool CAdScene::getRegionObjects(CAdRegion *region, CBArray &objects, bool interactiveOnly) { CAdGame *adGame = (CAdGame *)_gameRef; CAdObject *obj; diff --git a/engines/wintermute/Ad/AdScene.h b/engines/wintermute/Ad/AdScene.h index d47d727884..72c69e668a 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); - ERRORCODE getSceneObjects(CBArray &Objects, bool InteractiveOnly); - ERRORCODE getRegionObjects(CAdRegion *Region, CBArray &Objects, bool InteractiveOnly); + bool getSceneObjects(CBArray &Objects, bool InteractiveOnly); + bool getRegionObjects(CAdRegion *Region, CBArray &Objects, bool InteractiveOnly); - ERRORCODE afterLoad(); + bool afterLoad(); - ERRORCODE getRegionsAt(int X, int Y, CAdRegion **RegionList, int NumRegions); - ERRORCODE handleItemAssociations(const char *ItemName, bool Show); + bool getRegionsAt(int X, int Y, CAdRegion **RegionList, int NumRegions); + bool handleItemAssociations(const char *ItemName, bool Show); CUIWindow *_shieldWindow; float getRotationAt(int X, int Y); - ERRORCODE loadState(); - ERRORCODE saveState(); + bool loadState(); + bool 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(); - ERRORCODE getViewportSize(int *Width = NULL, int *Height = NULL); - ERRORCODE getViewportOffset(int *OffsetX = NULL, int *OffsetY = NULL); + bool getViewportSize(int *Width = NULL, int *Height = NULL); + bool 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; - 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); + bool correctTargetPoint(int StartX, int StartY, int *X, int *Y, bool CheckFreeObjects = false, CBObject *Requester = NULL); + bool correctTargetPoint2(int StartX, int StartY, int *TargetX, int *TargetY, bool CheckFreeObjects, CBObject *Requester); DECLARE_PERSISTENT(CAdScene, CBObject) - ERRORCODE displayRegionContent(CAdRegion *Region = NULL, bool Display3DOnly = false); - ERRORCODE displayRegionContentOld(CAdRegion *Region = NULL); + bool displayRegionContent(CAdRegion *Region = NULL, bool Display3DOnly = false); + bool displayRegionContentOld(CAdRegion *Region = NULL); static int compareObjs(const void *Obj1, const void *Obj2); - ERRORCODE updateFreeObjects(); - ERRORCODE traverseNodes(bool Update = false); + bool updateFreeObjects(); + bool traverseNodes(bool Update = false); float getScaleAt(int Y); - ERRORCODE sortScaleLevels(); - ERRORCODE sortRotLevels(); - virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent); + bool sortScaleLevels(); + bool sortRotLevels(); + virtual bool 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 ERRORCODE update(); + virtual bool update(); bool _autoScroll; int _targetOffsetTop; int _targetOffsetLeft; @@ -109,9 +109,9 @@ public: uint32 _scrollTimeH; uint32 _lastTimeH; - virtual ERRORCODE display(); + virtual bool display(); uint32 _pfMaxTime; - ERRORCODE initLoop(); + bool 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 _layers; CBArray _objects; CBArray _waypointGroups; - ERRORCODE loadFile(const char *filename); - ERRORCODE loadBuffer(byte *buffer, bool complete = true); + bool loadFile(const char *filename); + bool loadBuffer(byte *buffer, bool complete = true); int _width; int _height; - ERRORCODE addObject(CAdObject *Object); - ERRORCODE removeObject(CAdObject *Object); + bool addObject(CAdObject *Object); + bool removeObject(CAdObject *Object); int _editorMarginH; int _editorMarginV; uint32 _editorColFrame; @@ -152,18 +152,18 @@ public: CBArray _scaleLevels; CBArray _rotLevels; - virtual ERRORCODE restoreDeviceObjects(); + virtual bool restoreDeviceObjects(); int getPointsDist(CBPoint p1, CBPoint p2, CBObject *requester = NULL); // scripting interface virtual CScValue *scGetProperty(const char *name); - virtual ERRORCODE scSetProperty(const char *name, CScValue *value); - virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual bool scSetProperty(const char *name, CScValue *value); + virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); virtual const char *scToString(); private: - ERRORCODE persistState(bool Saving = true); + bool 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 687dbdaeef..38de185918 100644 --- a/engines/wintermute/Ad/AdSceneNode.cpp +++ b/engines/wintermute/Ad/AdSceneNode.cpp @@ -53,7 +53,7 @@ CAdSceneNode::~CAdSceneNode() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdSceneNode::setEntity(CAdEntity *entity) { +bool CAdSceneNode::setEntity(CAdEntity *entity) { _type = OBJECT_ENTITY; _entity = entity; return _gameRef->registerObject(entity); @@ -61,7 +61,7 @@ ERRORCODE CAdSceneNode::setEntity(CAdEntity *entity) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdSceneNode::setRegion(CAdRegion *region) { +bool CAdSceneNode::setRegion(CAdRegion *region) { _type = OBJECT_REGION; _region = region; return _gameRef->registerObject(region); @@ -69,7 +69,7 @@ ERRORCODE CAdSceneNode::setRegion(CAdRegion *region) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdSceneNode::persist(CBPersistMgr *persistMgr) { +bool CAdSceneNode::persist(CBPersistMgr *persistMgr) { CBObject::persist(persistMgr); diff --git a/engines/wintermute/Ad/AdSceneNode.h b/engines/wintermute/Ad/AdSceneNode.h index 931d859cca..808bfceef4 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) - ERRORCODE setRegion(CAdRegion *region); - ERRORCODE setEntity(CAdEntity *entity); + bool setRegion(CAdRegion *region); + bool setEntity(CAdEntity *entity); CAdEntity *_entity; CAdRegion *_region; TObjectType _type; diff --git a/engines/wintermute/Ad/AdSceneState.cpp b/engines/wintermute/Ad/AdSceneState.cpp index b10da397b8..e56c5f479a 100644 --- a/engines/wintermute/Ad/AdSceneState.cpp +++ b/engines/wintermute/Ad/AdSceneState.cpp @@ -54,7 +54,7 @@ CAdSceneState::~CAdSceneState() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdSceneState::persist(CBPersistMgr *persistMgr) { +bool CAdSceneState::persist(CBPersistMgr *persistMgr) { persistMgr->transfer(TMEMBER(_filename)); _nodeStates.persist(persistMgr); diff --git a/engines/wintermute/Ad/AdSentence.cpp b/engines/wintermute/Ad/AdSentence.cpp index cfff93b488..8c830a15f1 100644 --- a/engines/wintermute/Ad/AdSentence.cpp +++ b/engines/wintermute/Ad/AdSentence.cpp @@ -165,7 +165,7 @@ char *CAdSentence::getStance(int stance) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdSentence::display() { +bool CAdSentence::display() { if (!_font || !_text) return STATUS_FAILED; if (_sound && !_soundStarted) { @@ -204,14 +204,14 @@ void CAdSentence::setSound(CBSound *sound) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdSentence::finish() { +bool CAdSentence::finish() { if (_sound) _sound->stop(); return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdSentence::persist(CBPersistMgr *persistMgr) { +bool CAdSentence::persist(CBPersistMgr *persistMgr) { persistMgr->transfer(TMEMBER(_gameRef)); @@ -238,7 +238,7 @@ ERRORCODE CAdSentence::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdSentence::setupTalkFile(const char *soundFilename) { +bool CAdSentence::setupTalkFile(const char *soundFilename) { delete _talkDef; _talkDef = NULL; _currentSprite = NULL; @@ -270,7 +270,7 @@ ERRORCODE CAdSentence::setupTalkFile(const char *soundFilename) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdSentence::update(TDirection dir) { +bool CAdSentence::update(TDirection dir) { if (!_talkDef) return STATUS_OK; uint32 currentTime; diff --git a/engines/wintermute/Ad/AdSentence.h b/engines/wintermute/Ad/AdSentence.h index 86a3c57c99..22a6cae39d 100644 --- a/engines/wintermute/Ad/AdSentence.h +++ b/engines/wintermute/Ad/AdSentence.h @@ -47,15 +47,15 @@ public: bool _fixedPos; CBSprite *_currentSprite; char *_currentSkelAnim; - ERRORCODE update(TDirection dir = DI_DOWN); - ERRORCODE setupTalkFile(const char *soundFilename); + bool update(TDirection dir = DI_DOWN); + bool setupTalkFile(const char *soundFilename); DECLARE_PERSISTENT(CAdSentence, CBBase) - ERRORCODE finish(); + bool finish(); void setSound(CBSound *Sound); bool _soundStarted; CBSound *_sound; TTextAlign _align; - ERRORCODE display(); + bool display(); int _width; Point32 _pos; CBFont *_font; diff --git a/engines/wintermute/Ad/AdSpriteSet.cpp b/engines/wintermute/Ad/AdSpriteSet.cpp index f93530c449..a5ed4feb0c 100644 --- a/engines/wintermute/Ad/AdSpriteSet.cpp +++ b/engines/wintermute/Ad/AdSpriteSet.cpp @@ -58,14 +58,14 @@ CAdSpriteSet::~CAdSpriteSet() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdSpriteSet::loadFile(const char *filename, int lifeTime, TSpriteCacheType cacheType) { +bool CAdSpriteSet::loadFile(const char *filename, int lifeTime, TSpriteCacheType cacheType) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { _gameRef->LOG(0, "CAdSpriteSet::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } - ERRORCODE ret; + bool ret; if (DID_FAIL(ret = loadBuffer(buffer, true))) _gameRef->LOG(0, "Error parsing SPRITESET file '%s'", filename); @@ -90,7 +90,7 @@ TOKEN_DEF(TEMPLATE) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteCacheType CacheType) { +bool CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteCacheType CacheType) { TOKEN_TABLE_START(commands) TOKEN_TABLE(SPRITESET) TOKEN_TABLE(NAME) @@ -214,7 +214,7 @@ ERRORCODE CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TS ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdSpriteSet::persist(CBPersistMgr *persistMgr) { +bool CAdSpriteSet::persist(CBPersistMgr *persistMgr) { CBObject::persist(persistMgr); @@ -258,7 +258,7 @@ CBSprite *CAdSpriteSet::getSprite(TDirection direction) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdSpriteSet::saveAsText(CBDynBuffer *buffer, int indent) { +bool 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++) { diff --git a/engines/wintermute/Ad/AdSpriteSet.h b/engines/wintermute/Ad/AdSpriteSet.h index 2329c955e1..1c559fb77b 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 ERRORCODE saveAsText(CBDynBuffer *buffer, int indent = 0); + virtual bool saveAsText(CBDynBuffer *buffer, int indent = 0); CBSprite *getSprite(TDirection direction); DECLARE_PERSISTENT(CAdSpriteSet, CBObject) CBObject *_owner; CAdSpriteSet(CBGame *inGame, CBObject *owner = NULL); virtual ~CAdSpriteSet(); - 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); + bool loadFile(const char *filename, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL); + bool 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 09ef66a946..9f31d9f61e 100644 --- a/engines/wintermute/Ad/AdTalkDef.cpp +++ b/engines/wintermute/Ad/AdTalkDef.cpp @@ -69,14 +69,14 @@ CAdTalkDef::~CAdTalkDef() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdTalkDef::loadFile(const char *filename) { +bool CAdTalkDef::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { _gameRef->LOG(0, "CAdTalkDef::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } - ERRORCODE ret; + bool ret; CBUtils::setString(&_filename, filename); @@ -98,7 +98,7 @@ TOKEN_DEF(DEFAULT_SPRITE) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdTalkDef::loadBuffer(byte *buffer, bool complete) { +bool CAdTalkDef::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(TALK) TOKEN_TABLE(TEMPLATE) @@ -194,7 +194,7 @@ ERRORCODE CAdTalkDef::loadBuffer(byte *buffer, bool complete) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdTalkDef::persist(CBPersistMgr *persistMgr) { +bool CAdTalkDef::persist(CBPersistMgr *persistMgr) { CBObject::persist(persistMgr); @@ -210,7 +210,7 @@ ERRORCODE CAdTalkDef::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdTalkDef::saveAsText(CBDynBuffer *buffer, int indent) { +bool CAdTalkDef::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent, "TALK {\n"); if (_defaultSpriteFilename) buffer->putTextIndent(indent + 2, "DEFAULT_SPRITE=\"%s\"\n", _defaultSpriteFilename); @@ -230,7 +230,7 @@ ERRORCODE CAdTalkDef::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdTalkDef::loadDefaultSprite() { +bool CAdTalkDef::loadDefaultSprite() { if (_defaultSpriteFilename && !_defaultSprite) { _defaultSprite = new CBSprite(_gameRef); if (!_defaultSprite || DID_FAIL(_defaultSprite->loadFile(_defaultSpriteFilename))) { diff --git a/engines/wintermute/Ad/AdTalkDef.h b/engines/wintermute/Ad/AdTalkDef.h index 1a0cc4d7d8..cece5be4da 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); - ERRORCODE loadDefaultSprite(); + bool loadDefaultSprite(); DECLARE_PERSISTENT(CAdTalkDef, CBObject) CAdTalkDef(CBGame *inGame); virtual ~CAdTalkDef(); - ERRORCODE loadFile(const char *filename); - ERRORCODE loadBuffer(byte *buffer, bool complete = true); + bool loadFile(const char *filename); + bool loadBuffer(byte *buffer, bool complete = true); CBArray _nodes; char *_defaultSpriteFilename; CBSprite *_defaultSprite; - virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent = 0); + virtual bool 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 d7e13a5af4..2626021054 100644 --- a/engines/wintermute/Ad/AdTalkHolder.cpp +++ b/engines/wintermute/Ad/AdTalkHolder.cpp @@ -73,7 +73,7 @@ CBSprite *CAdTalkHolder::getTalkStance(const char *stance) { delete _animSprite; _animSprite = new CBSprite(_gameRef, this); if (_animSprite) { - ERRORCODE res = _animSprite->loadFile(_forcedTalkAnimName); + bool res = _animSprite->loadFile(_forcedTalkAnimName); if (DID_FAIL(res)) { _gameRef->LOG(res, "CAdTalkHolder::GetTalkStance: error loading talk sprite (object:\"%s\" sprite:\"%s\")", _name, _forcedTalkAnimName); delete _animSprite; @@ -119,7 +119,7 @@ CBSprite *CAdTalkHolder::getTalkStance(const char *stance) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdTalkHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CAdTalkHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // SetSprite ////////////////////////////////////////////////////////////////////////// @@ -316,7 +316,7 @@ CScValue *CAdTalkHolder::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdTalkHolder::scSetProperty(const char *name, CScValue *value) { +bool CAdTalkHolder::scSetProperty(const char *name, CScValue *value) { /* ////////////////////////////////////////////////////////////////////////// // Item @@ -337,7 +337,7 @@ const char *CAdTalkHolder::scToString() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdTalkHolder::saveAsText(CBDynBuffer *buffer, int indent) { +bool 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); @@ -353,7 +353,7 @@ ERRORCODE CAdTalkHolder::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdTalkHolder::persist(CBPersistMgr *persistMgr) { +bool CAdTalkHolder::persist(CBPersistMgr *persistMgr) { CAdObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_sprite)); diff --git a/engines/wintermute/Ad/AdTalkHolder.h b/engines/wintermute/Ad/AdTalkHolder.h index ab3904a1cb..a427c9eb04 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 ERRORCODE saveAsText(CBDynBuffer *buffer, int indent); + virtual bool saveAsText(CBDynBuffer *buffer, int indent); CBSprite *_sprite; CBArray _talkSprites; CBArray _talkSpritesEx; @@ -46,8 +46,8 @@ public: // scripting interface virtual CScValue *scGetProperty(const char *name); - virtual ERRORCODE scSetProperty(const char *name, CScValue *value); - virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual bool scSetProperty(const char *name, CScValue *value); + virtual bool 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 30c32c4db4..58644e7ca0 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 ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdTalkNode::loadBuffer(byte *buffer, bool complete) { +bool CAdTalkNode::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(ACTION) TOKEN_TABLE(SPRITESET_FILE) @@ -186,7 +186,7 @@ ERRORCODE CAdTalkNode::loadBuffer(byte *buffer, bool complete) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdTalkNode::persist(CBPersistMgr *persistMgr) { +bool CAdTalkNode::persist(CBPersistMgr *persistMgr) { persistMgr->transfer(TMEMBER(_comment)); persistMgr->transfer(TMEMBER(_startTime)); persistMgr->transfer(TMEMBER(_endTime)); @@ -201,7 +201,7 @@ ERRORCODE CAdTalkNode::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdTalkNode::saveAsText(CBDynBuffer *buffer, int indent) { +bool 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); @@ -220,7 +220,7 @@ ERRORCODE CAdTalkNode::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdTalkNode::loadSprite() { +bool CAdTalkNode::loadSprite() { if (_spriteFilename && !_sprite) { _sprite = new CBSprite(_gameRef); if (!_sprite || DID_FAIL(_sprite->loadFile(_spriteFilename))) { diff --git a/engines/wintermute/Ad/AdTalkNode.h b/engines/wintermute/Ad/AdTalkNode.h index 3d763ea0f0..3718340c0e 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); - ERRORCODE loadSprite(); + bool loadSprite(); DECLARE_PERSISTENT(CAdTalkNode, CBBase) CAdTalkNode(CBGame *inGame); virtual ~CAdTalkNode(); - ERRORCODE loadBuffer(byte *buffer, bool complete = true); - virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent = 0); + bool loadBuffer(byte *buffer, bool complete = true); + virtual bool 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 0210095c28..ec0d66d468 100644 --- a/engines/wintermute/Ad/AdWaypointGroup.cpp +++ b/engines/wintermute/Ad/AdWaypointGroup.cpp @@ -64,14 +64,14 @@ void CAdWaypointGroup::cleanup() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdWaypointGroup::loadFile(const char *filename) { +bool CAdWaypointGroup::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { _gameRef->LOG(0, "CAdWaypointGroup::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } - ERRORCODE ret; + bool ret; _filename = new char [strlen(filename) + 1]; strcpy(_filename, filename); @@ -96,7 +96,7 @@ TOKEN_DEF(PROPERTY) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdWaypointGroup::loadBuffer(byte *buffer, bool complete) { +bool CAdWaypointGroup::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(WAYPOINTS) TOKEN_TABLE(TEMPLATE) @@ -164,7 +164,7 @@ ERRORCODE CAdWaypointGroup::loadBuffer(byte *buffer, bool complete) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdWaypointGroup::saveAsText(CBDynBuffer *buffer, int indent) { +bool 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"); @@ -185,7 +185,7 @@ ERRORCODE CAdWaypointGroup::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdWaypointGroup::persist(CBPersistMgr *persistMgr) { +bool CAdWaypointGroup::persist(CBPersistMgr *persistMgr) { CBObject::persist(persistMgr); @@ -225,7 +225,7 @@ CScValue *CAdWaypointGroup::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdWaypointGroup::scSetProperty(const char *name, CScValue *value) { +bool CAdWaypointGroup::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// // Active ////////////////////////////////////////////////////////////////////////// @@ -239,7 +239,7 @@ ERRORCODE CAdWaypointGroup::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CAdWaypointGroup::mimic(CAdWaypointGroup *wpt, float scale, int argX, int argY) { +bool CAdWaypointGroup::mimic(CAdWaypointGroup *wpt, float scale, int argX, int argY) { if (scale == _lastMimicScale && argX == _lastMimicX && argY == _lastMimicY) return STATUS_OK; cleanup(); diff --git a/engines/wintermute/Ad/AdWaypointGroup.h b/engines/wintermute/Ad/AdWaypointGroup.h index 7e06ef661d..26a3c9a627 100644 --- a/engines/wintermute/Ad/AdWaypointGroup.h +++ b/engines/wintermute/Ad/AdWaypointGroup.h @@ -39,18 +39,18 @@ public: int _lastMimicX; int _lastMimicY; void cleanup(); - ERRORCODE mimic(CAdWaypointGroup *wpt, float scale = 100.0f, int x = 0, int y = 0); + bool mimic(CAdWaypointGroup *wpt, float scale = 100.0f, int x = 0, int y = 0); DECLARE_PERSISTENT(CAdWaypointGroup, CBObject) - virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent); + virtual bool saveAsText(CBDynBuffer *buffer, int indent); bool _active; CAdWaypointGroup(CBGame *inGame); - ERRORCODE loadFile(const char *filename); - ERRORCODE loadBuffer(byte *buffer, bool complete = true); + bool loadFile(const char *filename); + bool loadBuffer(byte *buffer, bool complete = true); virtual ~CAdWaypointGroup(); CBArray _points; int _editorSelectedPoint; virtual CScValue *scGetProperty(const char *name); - virtual ERRORCODE scSetProperty(const char *name, CScValue *value); + virtual bool 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 bdfcfccdd5..63fddba489 100644 --- a/engines/wintermute/Base/BBase.cpp +++ b/engines/wintermute/Base/BBase.cpp @@ -65,7 +65,7 @@ const char *CBBase::getEditorProp(const char *propName, const char *initVal) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBBase::setEditorProp(const char *propName, const char *propValue) { +bool CBBase::setEditorProp(const char *propName, const char *propValue) { if (propName == NULL) return STATUS_FAILED; if (propValue == NULL) { @@ -84,7 +84,7 @@ TOKEN_DEF(NAME) TOKEN_DEF(VALUE) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBBase::parseEditorProperty(byte *buffer, bool complete) { +bool CBBase::parseEditorProperty(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(EDITOR_PROPERTY) TOKEN_TABLE(NAME) @@ -159,7 +159,7 @@ ERRORCODE CBBase::parseEditorProperty(byte *buffer, bool complete) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBBase::saveAsText(CBDynBuffer *buffer, int indent) { +bool CBBase::saveAsText(CBDynBuffer *buffer, int indent) { _editorPropsIter = _editorProps.begin(); while (_editorPropsIter != _editorProps.end()) { buffer->putTextIndent(indent, "EDITOR_PROPERTY\n"); diff --git a/engines/wintermute/Base/BBase.h b/engines/wintermute/Base/BBase.h index afbe277529..e8c87f1f9e 100644 --- a/engines/wintermute/Base/BBase.h +++ b/engines/wintermute/Base/BBase.h @@ -43,11 +43,11 @@ class CBDynBuffer; class CBBase { public: bool _persistable; - ERRORCODE setEditorProp(const char *propName, const char *propValue); + bool setEditorProp(const char *propName, const char *propValue); const char *getEditorProp(const char *propName, const char *initVal = NULL); CBBase(TDynamicConstructor, TDynamicConstructor) {}; - ERRORCODE parseEditorProperty(byte *buffer, bool complete = true); - virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent = 0); + bool parseEditorProperty(byte *buffer, bool complete = true); + virtual bool saveAsText(CBDynBuffer *buffer, int indent = 0); CBBase(); CBGame *_gameRef; CBBase(CBGame *GameOwner); diff --git a/engines/wintermute/Base/BDebugger.cpp b/engines/wintermute/Base/BDebugger.cpp index 1d3f0c4826..4e83579d04 100644 --- a/engines/wintermute/Base/BDebugger.cpp +++ b/engines/wintermute/Base/BDebugger.cpp @@ -41,84 +41,84 @@ CBDebugger::~CBDebugger(void) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBDebugger::initialize() { +bool CBDebugger::initialize() { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBDebugger::shutdown() { +bool CBDebugger::shutdown() { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBDebugger::onGameInit() { +bool CBDebugger::onGameInit() { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBDebugger::onGameShutdown() { +bool CBDebugger::onGameShutdown() { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBDebugger::onGameTick() { +bool CBDebugger::onGameTick() { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBDebugger::onLog(unsigned int errorCode, const char *text) { +bool CBDebugger::onLog(unsigned int errorCode, const char *text) { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBDebugger::onScriptInit(CScScript *script) { +bool CBDebugger::onScriptInit(CScScript *script) { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBDebugger::onScriptEventThreadInit(CScScript *script, CScScript *parentScript, const char *name) { +bool CBDebugger::onScriptEventThreadInit(CScScript *script, CScScript *parentScript, const char *name) { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBDebugger::onScriptMethodThreadInit(CScScript *script, CScScript *parentScript, const char *name) { +bool CBDebugger::onScriptMethodThreadInit(CScScript *script, CScScript *parentScript, const char *name) { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBDebugger::onScriptShutdown(CScScript *script) { +bool CBDebugger::onScriptShutdown(CScScript *script) { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBDebugger::onScriptChangeLine(CScScript *script, int Line) { +bool CBDebugger::onScriptChangeLine(CScScript *script, int Line) { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBDebugger::onScriptChangeScope(CScScript *script, CScValue *scope) { +bool CBDebugger::onScriptChangeScope(CScScript *script, CScValue *scope) { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBDebugger::onScriptShutdownScope(CScScript *script, CScValue *scope) { +bool CBDebugger::onScriptShutdownScope(CScScript *script, CScValue *scope) { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBDebugger::onVariableInit(EWmeDebuggerVariableType type, CScScript *script, CScValue *scope, CScValue *var, const char *variableName) { +bool CBDebugger::onVariableInit(EWmeDebuggerVariableType type, CScScript *script, CScValue *scope, CScValue *var, const char *variableName) { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBDebugger::onVariableChangeValue(CScValue *var, CScValue *value) { +bool CBDebugger::onVariableChangeValue(CScValue *var, CScValue *value) { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBDebugger::onScriptHitBreakpoint(CScScript *script) { +bool CBDebugger::onScriptHitBreakpoint(CScScript *script) { return STATUS_OK; } diff --git a/engines/wintermute/Base/BDebugger.h b/engines/wintermute/Base/BDebugger.h index a3da66cc9f..548519b0a0 100644 --- a/engines/wintermute/Base/BDebugger.h +++ b/engines/wintermute/Base/BDebugger.h @@ -45,26 +45,26 @@ public: // initialization bool _enabled; - ERRORCODE initialize(); - ERRORCODE shutdown(); + bool initialize(); + bool shutdown(); // internal interface - 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); + bool onGameInit(); + bool onGameShutdown(); + bool onGameTick(); + bool onLog(unsigned int errorCode, const char *text); + bool onScriptInit(CScScript *script); + bool onScriptEventThreadInit(CScScript *script, CScScript *parentScript, const char *name); + bool onScriptMethodThreadInit(CScScript *script, CScScript *parentScript, const char *name); + + bool onScriptShutdown(CScScript *script); + bool onScriptChangeLine(CScScript *script, int line); + bool onScriptChangeScope(CScScript *script, CScValue *scope); + bool onScriptShutdownScope(CScScript *script, CScValue *scope); + bool onVariableInit(EWmeDebuggerVariableType type, CScScript *script, CScValue *scope, CScValue *var, const char *variableName); + bool onVariableChangeValue(CScValue *var, CScValue *value); + + bool 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 ff13f96d6c..fec49e3c8f 100644 --- a/engines/wintermute/Base/BDynBuffer.cpp +++ b/engines/wintermute/Base/BDynBuffer.cpp @@ -69,7 +69,7 @@ uint32 CBDynBuffer::getSize() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBDynBuffer::init(uint32 initSize) { +bool CBDynBuffer::init(uint32 initSize) { cleanup(); if (initSize == 0) initSize = _initSize; @@ -88,7 +88,7 @@ ERRORCODE CBDynBuffer::init(uint32 initSize) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBDynBuffer::putBytes(byte *buffer, uint32 size) { +bool CBDynBuffer::putBytes(byte *buffer, uint32 size) { if (!_initialized) init(); while (_offset + size > _realSize) { @@ -109,7 +109,7 @@ ERRORCODE CBDynBuffer::putBytes(byte *buffer, uint32 size) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBDynBuffer::getBytes(byte *buffer, uint32 size) { +bool CBDynBuffer::getBytes(byte *buffer, uint32 size) { if (!_initialized) init(); if (_offset + size > _size) { diff --git a/engines/wintermute/Base/BDynBuffer.h b/engines/wintermute/Base/BDynBuffer.h index 1826a81c30..6df01903c7 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); - ERRORCODE getBytes(byte *buffer, uint32 size); - ERRORCODE putBytes(byte *buffer, uint32 size); + bool getBytes(byte *buffer, uint32 size); + bool putBytes(byte *buffer, uint32 size); uint32 getSize(); - ERRORCODE init(uint32 initSize = 0); + bool 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 d8bfbf412d..b99244af55 100644 --- a/engines/wintermute/Base/BFader.cpp +++ b/engines/wintermute/Base/BFader.cpp @@ -60,7 +60,7 @@ CBFader::~CBFader() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFader::update() { +bool CBFader::update() { if (!_active) return STATUS_OK; int alphaDelta = _targetAlpha - _sourceAlpha; @@ -84,7 +84,7 @@ ERRORCODE CBFader::update() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFader::display() { +bool CBFader::display() { if (!_active) return STATUS_OK; if (_currentAlpha > 0x00) return _gameRef->_renderer->fadeToColor(BYTETORGBA(_red, _green, _blue, _currentAlpha)); @@ -93,7 +93,7 @@ ERRORCODE CBFader::display() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFader::deactivate() { +bool CBFader::deactivate() { _active = false; _ready = true; return STATUS_OK; @@ -101,7 +101,7 @@ ERRORCODE CBFader::deactivate() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFader::fadeIn(uint32 sourceColor, uint32 duration, bool system) { +bool CBFader::fadeIn(uint32 sourceColor, uint32 duration, bool system) { _ready = false; _active = true; @@ -123,7 +123,7 @@ ERRORCODE CBFader::fadeIn(uint32 sourceColor, uint32 duration, bool system) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFader::fadeOut(uint32 targetColor, uint32 duration, bool system) { +bool CBFader::fadeOut(uint32 targetColor, uint32 duration, bool system) { _ready = false; _active = true; @@ -154,7 +154,7 @@ uint32 CBFader::getCurrentColor() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFader::persist(CBPersistMgr *persistMgr) { +bool CBFader::persist(CBPersistMgr *persistMgr) { CBObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_active)); diff --git a/engines/wintermute/Base/BFader.h b/engines/wintermute/Base/BFader.h index 623bd220bc..8c9d7d0a7c 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(); - ERRORCODE fadeOut(uint32 targetColor, uint32 duration, bool system = false); - ERRORCODE fadeIn(uint32 sourceColor, uint32 duration, bool system = false); - ERRORCODE deactivate(); - ERRORCODE display(); - ERRORCODE update(); + bool fadeOut(uint32 targetColor, uint32 duration, bool system = false); + bool fadeIn(uint32 sourceColor, uint32 duration, bool system = false); + bool deactivate(); + bool display(); + bool 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 113dbbe5d0..7dd7d6f0e8 100644 --- a/engines/wintermute/Base/BFileManager.cpp +++ b/engines/wintermute/Base/BFileManager.cpp @@ -73,7 +73,7 @@ CBFileManager::~CBFileManager() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFileManager::cleanup() { +bool CBFileManager::cleanup() { // delete registered paths for (int i = 0; i < _singlePaths.getSize(); i++) delete [] _singlePaths[i]; @@ -160,7 +160,7 @@ Common::SeekableReadStream *CBFileManager::loadSaveGame(const Common::String &fi } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFileManager::saveFile(const Common::String &filename, byte *buffer, uint32 bufferSize, bool compressed, byte *prefixBuffer, uint32 prefixSize) { +bool CBFileManager::saveFile(const Common::String &filename, byte *buffer, uint32 bufferSize, bool compressed, byte *prefixBuffer, uint32 prefixSize) { // TODO warning("Implement SaveFile"); @@ -223,7 +223,7 @@ ERRORCODE CBFileManager::saveFile(const Common::String &filename, byte *buffer, ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFileManager::requestCD(int cd, char *packageFile, const char *filename) { +bool 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(); @@ -235,7 +235,7 @@ ERRORCODE CBFileManager::requestCD(int cd, char *packageFile, const char *filena ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFileManager::addPath(TPathType type, const Common::String &path) { +bool 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] == '/'); @@ -260,7 +260,7 @@ ERRORCODE CBFileManager::addPath(TPathType type, const Common::String &path) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFileManager::reloadPaths() { +bool CBFileManager::reloadPaths() { // delete registered paths for (int i = 0; i < _singlePaths.getSize(); i++) delete [] _singlePaths[i]; @@ -276,7 +276,7 @@ ERRORCODE CBFileManager::reloadPaths() { #define TEMP_BUFFER_SIZE 32768 ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFileManager::initPaths() { +bool CBFileManager::initPaths() { restoreCurrentDir(); AnsiString pathList; @@ -318,7 +318,7 @@ ERRORCODE CBFileManager::initPaths() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFileManager::registerPackages() { +bool CBFileManager::registerPackages() { restoreCurrentDir(); _gameRef->LOG(0, "Scanning packages..."); @@ -366,7 +366,7 @@ ERRORCODE CBFileManager::registerPackages() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFileManager::registerPackage(const Common::String &filename , bool searchSignature) { +bool CBFileManager::registerPackage(const Common::String &filename , bool searchSignature) { // FILE *f = fopen(filename, "rb"); Common::File *package = new Common::File(); package->open(filename); @@ -632,7 +632,7 @@ Common::SeekableReadStream *CBFileManager::openFile(const Common::String &filena ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFileManager::closeFile(Common::SeekableReadStream *File) { +bool CBFileManager::closeFile(Common::SeekableReadStream *File) { for (int i = 0; i < _openFiles.getSize(); i++) { if (_openFiles[i] == File) { delete _openFiles[i]; @@ -676,7 +676,7 @@ Common::SeekableReadStream *CBFileManager::openFileRaw(const Common::String &fil ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFileManager::restoreCurrentDir() { +bool CBFileManager::restoreCurrentDir() { if (!_basePath) return STATUS_OK; else { /*if (!chdir(_basePath)) return STATUS_OK; @@ -688,7 +688,7 @@ ERRORCODE CBFileManager::restoreCurrentDir() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFileManager::setBasePath(const Common::String &path) { +bool CBFileManager::setBasePath(const Common::String &path) { cleanup(); if (path.c_str()) { diff --git a/engines/wintermute/Base/BFileManager.h b/engines/wintermute/Base/BFileManager.h index 06c812199c..aebaa6f3fc 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); - ERRORCODE cleanup(); - ERRORCODE setBasePath(const Common::String &path); - ERRORCODE restoreCurrentDir(); + bool cleanup(); + bool setBasePath(const Common::String &path); + bool restoreCurrentDir(); char *_basePath; bool getFullPath(const Common::String &filename, char *fullname); Common::SeekableReadStream *openFileRaw(const Common::String &filename); - ERRORCODE closeFile(Common::SeekableReadStream *File); + bool 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); - ERRORCODE registerPackages(); - ERRORCODE initPaths(); - ERRORCODE reloadPaths(); + bool registerPackages(); + bool initPaths(); + bool reloadPaths(); typedef enum { PATH_PACKAGE, PATH_SINGLE } TPathType; - ERRORCODE addPath(TPathType type, const Common::String &path); - ERRORCODE requestCD(int cd, char *packageFile, const char *filename); + bool addPath(TPathType type, const Common::String &path); + bool requestCD(int cd, char *packageFile, const char *filename); Common::SeekableReadStream *loadSaveGame(const Common::String &filename); - ERRORCODE saveFile(const Common::String &filename, byte *buffer, uint32 bufferSize, bool compressed = false, byte *prefixBuffer = NULL, uint32 prefixSize = 0); + bool 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,7 +75,7 @@ public: Common::HashMap _files; private: - ERRORCODE registerPackage(const Common::String &filename, bool searchSignature = false); + bool registerPackage(const Common::String &filename, bool searchSignature = false); Common::HashMap::iterator _filesIter; bool isValidPackage(const AnsiString &fileName) const; diff --git a/engines/wintermute/Base/BFrame.cpp b/engines/wintermute/Base/BFrame.cpp index e77235efa7..66a63c6a8f 100644 --- a/engines/wintermute/Base/BFrame.cpp +++ b/engines/wintermute/Base/BFrame.cpp @@ -75,8 +75,8 @@ CBFrame::~CBFrame() { ////////////////////////////////////////////////////////////////////// -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; +bool CBFrame::draw(int x, int y, CBObject *registerOwner, float zoomX, float zoomY, bool precise, uint32 alpha, bool allFrames, float rotate, TSpriteBlendMode blendMode) { + bool res; for (int i = 0; i < _subframes.getSize(); i++) { res = _subframes[i]->draw(x, y, registerOwner, zoomX, zoomY, precise, alpha, rotate, blendMode); @@ -87,7 +87,7 @@ ERRORCODE CBFrame::draw(int x, int y, CBObject *registerOwner, float zoomX, floa ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFrame::oneTimeDisplay(CBObject *owner, bool muted) { +bool CBFrame::oneTimeDisplay(CBObject *owner, bool muted) { if (_sound && !muted) { if (owner) owner->updateOneSound(_sound); _sound->play(); @@ -131,7 +131,7 @@ TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF(KILL_SOUND) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////// -ERRORCODE CBFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) { +bool CBFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) { TOKEN_TABLE_START(commands) TOKEN_TABLE(DELAY) TOKEN_TABLE(IMAGE) @@ -341,7 +341,7 @@ bool CBFrame::getBoundingRect(Rect32 *rect, int x, int y, float scaleX, float sc ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFrame::saveAsText(CBDynBuffer *buffer, int indent) { +bool CBFrame::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent, "FRAME {\n"); buffer->putTextIndent(indent + 2, "DELAY = %d\n", _delay); @@ -379,7 +379,7 @@ ERRORCODE CBFrame::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFrame::persist(CBPersistMgr *persistMgr) { +bool CBFrame::persist(CBPersistMgr *persistMgr) { CBScriptable::persist(persistMgr); _applyEvent.persist(persistMgr); @@ -399,7 +399,7 @@ ERRORCODE CBFrame::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CBFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // GetSound @@ -648,7 +648,7 @@ CScValue *CBFrame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFrame::scSetProperty(const char *name, CScValue *value) { +bool CBFrame::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// // Delay ////////////////////////////////////////////////////////////////////////// diff --git a/engines/wintermute/Base/BFrame.h b/engines/wintermute/Base/BFrame.h index 715a97ea69..537471c953 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; - ERRORCODE oneTimeDisplay(CBObject *owner, bool muted = false); + bool oneTimeDisplay(CBObject *owner, bool muted = false); DECLARE_PERSISTENT(CBFrame, CBScriptable) CBSound *_sound; bool _editorExpanded; bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = 100, float scaleY = 100); - ERRORCODE saveAsText(CBDynBuffer *buffer, int indent); + bool saveAsText(CBDynBuffer *buffer, int indent); int _moveY; int _moveX; uint32 _delay; CBArray _subframes; - 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); + bool 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); + bool 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 ERRORCODE scSetProperty(const char *name, CScValue *value); - virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual bool scSetProperty(const char *name, CScValue *value); + virtual bool 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 4acd916e94..02af945d8c 100644 --- a/engines/wintermute/Base/BGame.cpp +++ b/engines/wintermute/Base/BGame.cpp @@ -335,7 +335,7 @@ CBGame::~CBGame() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::cleanup() { +bool CBGame::cleanup() { delete _loadingIcon; _loadingIcon = NULL; @@ -414,7 +414,7 @@ ERRORCODE CBGame::cleanup() { ////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::initialize1() { +bool CBGame::initialize1() { bool loaded = false; // Not really a loop, but a goto-replacement. while (!loaded) { _surfaceStorage = new CBSurfaceStorage(this); @@ -483,7 +483,7 @@ ERRORCODE CBGame::initialize1() { ////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::initialize2() { // we know whether we are going to be accelerated +bool CBGame::initialize2() { // we know whether we are going to be accelerated _renderer = makeSDLRenderer(this); if (_renderer == NULL) return STATUS_FAILED; @@ -492,7 +492,7 @@ ERRORCODE CBGame::initialize2() { // we know whether we are going to be accelera ////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::initialize3() { // renderer is initialized +bool CBGame::initialize3() { // renderer is initialized _posX = _renderer->_width / 2; _posY = _renderer->_height / 2; @@ -550,7 +550,7 @@ void CBGame::DEBUG_DebugDisable() { ////////////////////////////////////////////////////////////////////// -void CBGame::LOG(ERRORCODE res, const char *fmt, ...) { +void CBGame::LOG(bool res, const char *fmt, ...) { uint32 secs = g_system->getMillis() / 1000; uint32 hours = secs / 3600; secs = secs % 3600; @@ -587,7 +587,7 @@ void CBGame::setEngineLogCallback(ENGINE_LOG_CALLBACK callback, void *data) { ////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::initLoop() { +bool CBGame::initLoop() { _viewportSP = -1; _currentTime = CBPlatform::getTime(); @@ -645,7 +645,7 @@ ERRORCODE CBGame::initLoop() { ////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::initInput() { +bool CBGame::initInput() { return STATUS_OK; } @@ -670,14 +670,14 @@ void CBGame::getOffset(int *offsetX, int *offsetY) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::loadFile(const char *filename) { +bool CBGame::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { _gameRef->LOG(0, "CBGame::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } - ERRORCODE ret; + bool ret; _filename = new char [strlen(filename) + 1]; strcpy(_filename, filename); @@ -740,7 +740,7 @@ TOKEN_DEF(GUID) TOKEN_DEF(COMPAT_KILL_METHOD_THREADS) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::loadBuffer(byte *buffer, bool complete) { +bool CBGame::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(GAME) TOKEN_TABLE(TEMPLATE) @@ -960,7 +960,7 @@ ERRORCODE CBGame::loadBuffer(byte *buffer, bool complete) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // LOG ////////////////////////////////////////////////////////////////////////// @@ -975,7 +975,7 @@ ERRORCODE CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi // Caption ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "Caption") == 0) { - ERRORCODE res = CBObject::scCallMethod(script, stack, thisStack, name); + bool res = CBObject::scCallMethod(script, stack, thisStack, name); setWindowTitle(); return res; } @@ -2539,7 +2539,7 @@ CScValue *CBGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::scSetProperty(const char *name, CScValue *value) { +bool CBGame::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// // Name ////////////////////////////////////////////////////////////////////////// @@ -2571,7 +2571,7 @@ ERRORCODE CBGame::scSetProperty(const char *name, CScValue *value) { // Caption ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "Name") == 0) { - ERRORCODE res = CBObject::scSetProperty(name, value); + bool res = CBObject::scSetProperty(name, value); setWindowTitle(); return res; } @@ -2742,7 +2742,7 @@ const char *CBGame::scToString() { #define QUICK_MSG_DURATION 3000 ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::displayQuickMsg() { +bool CBGame::displayQuickMsg() { if (_quickMessages.getSize() == 0 || !_systemFont) return STATUS_OK; // update @@ -2790,14 +2790,14 @@ void CBGame::quickMessageForm(char *fmt, ...) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::registerObject(CBObject *object) { +bool CBGame::registerObject(CBObject *object) { _regObjects.add(object); return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::unregisterObject(CBObject *object) { +bool CBGame::unregisterObject(CBObject *object) { if (!object) return STATUS_OK; // is it a window? @@ -2859,7 +2859,7 @@ bool CBGame::validObject(CBObject *object) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStack, char *name) { +bool CBGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStack, char *name) { CScValue *thisObj; ////////////////////////////////////////////////////////////////////////// @@ -3143,7 +3143,7 @@ ERRORCODE CBGame::ExternalCall(CScScript *script, CScStack *stack, CScStack *thi ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::showCursor() { +bool CBGame::showCursor() { if (_cursorHidden) return STATUS_OK; if (!_interactive && _gameRef->_state == GAME_RUNNING) { @@ -3160,7 +3160,7 @@ ERRORCODE CBGame::showCursor() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::SaveGame(int slot, const char *desc, bool quickSave) { +bool CBGame::SaveGame(int slot, const char *desc, bool quickSave) { char filename[MAX_PATH_LENGTH + 1]; getSaveSlotFilename(slot, filename); @@ -3168,7 +3168,7 @@ ERRORCODE CBGame::SaveGame(int slot, const char *desc, bool quickSave) { _gameRef->applyEvent("BeforeSave", true); - ERRORCODE ret; + bool ret; _indicatorDisplay = true; _indicatorProgress = 0; @@ -3206,7 +3206,7 @@ save_finish: // TODO: Remove gotos ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::loadGame(int slot) { +bool CBGame::loadGame(int slot) { //_gameRef->LOG(0, "Load start %d", CBUtils::GetUsedMemMB()); _loading = false; @@ -3220,11 +3220,11 @@ ERRORCODE CBGame::loadGame(int slot) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::loadGame(const char *filename) { +bool CBGame::loadGame(const char *filename) { LOG(0, "Loading game '%s'...", filename); getDebugMgr()->onGameShutdown(); - ERRORCODE ret; + bool ret; delete _saveLoadImage; _saveLoadImage = NULL; @@ -3276,7 +3276,7 @@ load_finish: ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::initAfterLoad() { +bool CBGame::initAfterLoad() { CSysClassRegistry::getInstance()->enumInstances(afterLoadRegion, "CBRegion", NULL); CSysClassRegistry::getInstance()->enumInstances(afterLoadSubFrame, "CBSubFrame", NULL); CSysClassRegistry::getInstance()->enumInstances(afterLoadSound, "CBSound", NULL); @@ -3317,8 +3317,8 @@ void CBGame::afterLoadScript(void *script, void *data) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::displayWindows(bool inGame) { - ERRORCODE res; +bool CBGame::displayWindows(bool inGame) { + bool res; // did we lose focus? focus topmost window if (_focusedWindow == NULL || !_focusedWindow->_visible || _focusedWindow->_disable) { @@ -3345,7 +3345,7 @@ ERRORCODE CBGame::displayWindows(bool inGame) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::playMusic(int channel, const char *filename, bool looping, uint32 loopStart) { +bool CBGame::playMusic(int channel, const char *filename, bool looping, uint32 loopStart) { if (channel >= NUM_MUSIC_CHANNELS) { _gameRef->LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS); return STATUS_FAILED; @@ -3371,7 +3371,7 @@ ERRORCODE CBGame::playMusic(int channel, const char *filename, bool looping, uin ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::stopMusic(int channel) { +bool CBGame::stopMusic(int channel) { if (channel >= NUM_MUSIC_CHANNELS) { _gameRef->LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS); return STATUS_FAILED; @@ -3387,7 +3387,7 @@ ERRORCODE CBGame::stopMusic(int channel) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::pauseMusic(int channel) { +bool CBGame::pauseMusic(int channel) { if (channel >= NUM_MUSIC_CHANNELS) { _gameRef->LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS); return STATUS_FAILED; @@ -3399,7 +3399,7 @@ ERRORCODE CBGame::pauseMusic(int channel) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::resumeMusic(int channel) { +bool CBGame::resumeMusic(int channel) { if (channel >= NUM_MUSIC_CHANNELS) { _gameRef->LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS); return STATUS_FAILED; @@ -3411,7 +3411,7 @@ ERRORCODE CBGame::resumeMusic(int channel) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::setMusicStartTime(int channel, uint32 time) { +bool CBGame::setMusicStartTime(int channel, uint32 time) { if (channel >= NUM_MUSIC_CHANNELS) { _gameRef->LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS); return STATUS_FAILED; @@ -3424,7 +3424,7 @@ ERRORCODE CBGame::setMusicStartTime(int channel, uint32 time) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::loadSettings(const char *filename) { +bool CBGame::loadSettings(const char *filename) { TOKEN_TABLE_START(commands) TOKEN_TABLE(SETTINGS) TOKEN_TABLE(GAME) @@ -3451,7 +3451,7 @@ ERRORCODE CBGame::loadSettings(const char *filename) { return STATUS_FAILED; } - ERRORCODE ret = STATUS_OK; + bool ret = STATUS_OK; byte *buffer = origBuffer; byte *params; @@ -3547,7 +3547,7 @@ ERRORCODE CBGame::loadSettings(const char *filename) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::persist(CBPersistMgr *persistMgr) { +bool CBGame::persist(CBPersistMgr *persistMgr) { if (!persistMgr->_saving) cleanup(); @@ -3640,7 +3640,7 @@ ERRORCODE CBGame::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::focusWindow(CUIWindow *Window) { +bool CBGame::focusWindow(CUIWindow *Window) { CUIWindow *Prev = _focusedWindow; for (int i = 0; i < _windows.getSize(); i++) { @@ -3662,7 +3662,7 @@ ERRORCODE CBGame::focusWindow(CUIWindow *Window) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::freeze(bool includingMusic) { +bool CBGame::freeze(bool includingMusic) { if (_freezeLevel == 0) { _scEngine->pauseAll(); _soundMgr->pauseAll(includingMusic); @@ -3678,7 +3678,7 @@ ERRORCODE CBGame::freeze(bool includingMusic) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::unfreeze() { +bool CBGame::unfreeze() { if (_freezeLevel == 0) return STATUS_OK; _freezeLevel--; @@ -3771,7 +3771,7 @@ bool CBGame::handleMouseWheel(int Delta) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor) { +bool CBGame::getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor) { if (verMajor) *verMajor = DCGF_VER_MAJOR; if (verMinor) *verMinor = DCGF_VER_MINOR; @@ -3811,7 +3811,7 @@ void CBGame::setWindowTitle() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::getSaveSlotFilename(int slot, char *buffer) { +bool 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); @@ -3828,7 +3828,7 @@ AnsiString CBGame::getDataDir() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::getSaveSlotDescription(int slot, char *buffer) { +bool CBGame::getSaveSlotDescription(int slot, char *buffer) { buffer[0] = '\0'; char filename[MAX_PATH_LENGTH + 1]; @@ -3865,7 +3865,7 @@ bool CBGame::isSaveSlotUsed(int slot) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::emptySaveSlot(int slot) { +bool CBGame::emptySaveSlot(int slot) { char filename[MAX_PATH_LENGTH + 1]; getSaveSlotFilename(slot, filename); @@ -3876,7 +3876,7 @@ ERRORCODE CBGame::emptySaveSlot(int slot) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::setActiveObject(CBObject *obj) { +bool CBGame::setActiveObject(CBObject *obj) { // not-active when game is frozen if (obj && !_gameRef->_interactive && !obj->_nonIntMouseEvents) { obj = NULL; @@ -3896,7 +3896,7 @@ ERRORCODE CBGame::setActiveObject(CBObject *obj) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::pushViewport(CBViewport *viewport) { +bool CBGame::pushViewport(CBViewport *viewport) { _viewportSP++; if (_viewportSP >= _viewportStack.getSize()) _viewportStack.add(viewport); else _viewportStack[_viewportSP] = viewport; @@ -3908,7 +3908,7 @@ ERRORCODE CBGame::pushViewport(CBViewport *viewport) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::popViewport() { +bool CBGame::popViewport() { _viewportSP--; if (_viewportSP < -1) _gameRef->LOG(0, "Fatal: Viewport stack underflow!"); @@ -3923,7 +3923,7 @@ ERRORCODE CBGame::popViewport() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::getCurrentViewportRect(Rect32 *rect, bool *custom) { +bool CBGame::getCurrentViewportRect(Rect32 *rect, bool *custom) { if (rect == NULL) return STATUS_FAILED; else { if (_viewportSP >= 0) { @@ -3943,7 +3943,7 @@ ERRORCODE CBGame::getCurrentViewportRect(Rect32 *rect, bool *custom) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::getCurrentViewportOffset(int *offsetX, int *offsetY) { +bool CBGame::getCurrentViewportOffset(int *offsetX, int *offsetY) { if (_viewportSP >= 0) { if (offsetX) *offsetX = _viewportStack[_viewportSP]->_offsetX; if (offsetY) *offsetY = _viewportStack[_viewportSP]->_offsetY; @@ -3957,13 +3957,13 @@ ERRORCODE CBGame::getCurrentViewportOffset(int *offsetX, int *offsetY) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::windowLoadHook(CUIWindow *win, char **buf, char **params) { +bool CBGame::windowLoadHook(CUIWindow *win, char **buf, char **params) { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::windowScriptMethodHook(CUIWindow *win, CScScript *script, CScStack *stack, const char *name) { +bool CBGame::windowScriptMethodHook(CUIWindow *win, CScScript *script, CScStack *stack, const char *name) { return STATUS_FAILED; } @@ -3986,13 +3986,13 @@ void CBGame::resetMousePos() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::displayContent(bool doUpdate, bool displayAll) { +bool CBGame::displayContent(bool doUpdate, bool displayAll) { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::displayContentSimple() { +bool CBGame::displayContentSimple() { // fill black _renderer->fill(0, 0, 0); if (_indicatorDisplay) displayIndicator(); @@ -4002,7 +4002,7 @@ ERRORCODE CBGame::displayContentSimple() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::displayIndicator() { +bool CBGame::displayIndicator() { if (_saveLoadImage) { Rect32 rc; CBPlatform::setRect(&rc, 0, 0, _saveLoadImage->getWidth(), _saveLoadImage->getHeight()); @@ -4020,7 +4020,7 @@ ERRORCODE CBGame::displayIndicator() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::updateMusicCrossfade() { +bool CBGame::updateMusicCrossfade() { /* byte GlobMusicVol = _soundMgr->getVolumePercent(SOUND_MUSIC); */ if (!_musicCrossfadeRunning) return STATUS_OK; @@ -4075,7 +4075,7 @@ ERRORCODE CBGame::updateMusicCrossfade() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::resetContent() { +bool CBGame::resetContent() { _scEngine->clearGlobals(); //_timer = 0; //_liveTimer = 0; @@ -4098,7 +4098,7 @@ void CBGame::DEBUG_DumpClassRegistry() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::invalidateDeviceObjects() { +bool CBGame::invalidateDeviceObjects() { for (int i = 0; i < _regObjects.getSize(); i++) { _regObjects[i]->invalidateDeviceObjects(); } @@ -4107,7 +4107,7 @@ ERRORCODE CBGame::invalidateDeviceObjects() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::restoreDeviceObjects() { +bool CBGame::restoreDeviceObjects() { for (int i = 0; i < _regObjects.getSize(); i++) { _regObjects[i]->restoreDeviceObjects(); } @@ -4115,7 +4115,7 @@ ERRORCODE CBGame::restoreDeviceObjects() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::setWaitCursor(const char *filename) { +bool CBGame::setWaitCursor(const char *filename) { delete _cursorNoninteractive; _cursorNoninteractive = NULL; @@ -4135,7 +4135,7 @@ bool CBGame::isVideoPlaying() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::stopVideo() { +bool CBGame::stopVideo() { if (_videoPlayer->isPlaying()) _videoPlayer->stop(); if (_theoraPlayer && _theoraPlayer->isPlaying()) { _theoraPlayer->stop(); @@ -4147,7 +4147,7 @@ ERRORCODE CBGame::stopVideo() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::drawCursor(CBSprite *cursor) { +bool CBGame::drawCursor(CBSprite *cursor) { if (!cursor) return STATUS_FAILED; if (cursor != _lastCursor) { cursor->reset(); @@ -4159,7 +4159,7 @@ ERRORCODE CBGame::drawCursor(CBSprite *cursor) { ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::onActivate(bool activate, bool refreshMouse) { +bool CBGame::onActivate(bool activate, bool refreshMouse) { if (_shuttingDown || !_renderer) return STATUS_OK; _renderer->_active = activate; @@ -4177,7 +4177,7 @@ ERRORCODE CBGame::onActivate(bool activate, bool refreshMouse) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::onMouseLeftDown() { +bool CBGame::onMouseLeftDown() { if (_activeObject) _activeObject->handleMouse(MOUSE_CLICK, MOUSE_BUTTON_LEFT); bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("LeftClick")); @@ -4195,7 +4195,7 @@ ERRORCODE CBGame::onMouseLeftDown() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::onMouseLeftUp() { +bool CBGame::onMouseLeftUp() { if (_activeObject) _activeObject->handleMouse(MOUSE_RELEASE, MOUSE_BUTTON_LEFT); CBPlatform::releaseCapture(); @@ -4212,7 +4212,7 @@ ERRORCODE CBGame::onMouseLeftUp() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::onMouseLeftDblClick() { +bool CBGame::onMouseLeftDblClick() { if (_state == GAME_RUNNING && !_interactive) return STATUS_OK; if (_activeObject) _activeObject->handleMouse(MOUSE_DBLCLICK, MOUSE_BUTTON_LEFT); @@ -4227,7 +4227,7 @@ ERRORCODE CBGame::onMouseLeftDblClick() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::onMouseRightDblClick() { +bool CBGame::onMouseRightDblClick() { if (_state == GAME_RUNNING && !_interactive) return STATUS_OK; if (_activeObject) _activeObject->handleMouse(MOUSE_DBLCLICK, MOUSE_BUTTON_RIGHT); @@ -4242,7 +4242,7 @@ ERRORCODE CBGame::onMouseRightDblClick() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::onMouseRightDown() { +bool CBGame::onMouseRightDown() { if (_activeObject) _activeObject->handleMouse(MOUSE_CLICK, MOUSE_BUTTON_RIGHT); bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("RightClick")); @@ -4255,7 +4255,7 @@ ERRORCODE CBGame::onMouseRightDown() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::onMouseRightUp() { +bool CBGame::onMouseRightUp() { if (_activeObject) _activeObject->handleMouse(MOUSE_RELEASE, MOUSE_BUTTON_RIGHT); bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("RightRelease")); @@ -4268,7 +4268,7 @@ ERRORCODE CBGame::onMouseRightUp() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::onMouseMiddleDown() { +bool CBGame::onMouseMiddleDown() { if (_state == GAME_RUNNING && !_interactive) return STATUS_OK; if (_activeObject) _activeObject->handleMouse(MOUSE_CLICK, MOUSE_BUTTON_MIDDLE); @@ -4283,7 +4283,7 @@ ERRORCODE CBGame::onMouseMiddleDown() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::onMouseMiddleUp() { +bool CBGame::onMouseMiddleUp() { if (_activeObject) _activeObject->handleMouse(MOUSE_RELEASE, MOUSE_BUTTON_MIDDLE); bool handled = _state == GAME_RUNNING && DID_SUCCEED(applyEvent("MiddleRelease")); @@ -4296,7 +4296,7 @@ ERRORCODE CBGame::onMouseMiddleUp() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::onPaint() { +bool CBGame::onPaint() { if (_renderer && _renderer->_windowed && _renderer->_ready) { _renderer->initLoop(); displayContent(false, true); @@ -4307,7 +4307,7 @@ ERRORCODE CBGame::onPaint() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::onWindowClose() { +bool CBGame::onWindowClose() { if (canHandleEvent("QuitGame")) { if (_state != GAME_FROZEN) _gameRef->applyEvent("QuitGame"); return STATUS_OK; @@ -4315,7 +4315,7 @@ ERRORCODE CBGame::onWindowClose() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::displayDebugInfo() { +bool CBGame::displayDebugInfo() { char str[100]; if (_debugShowFPS) { @@ -4401,7 +4401,7 @@ void CBGame::getMousePos(Point32 *pos) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::miniUpdate() { +bool CBGame::miniUpdate() { if (!_miniUpdateEnabled) return STATUS_OK; if (CBPlatform::getTime() - _lastMiniUpdate > 200) { @@ -4412,7 +4412,7 @@ ERRORCODE CBGame::miniUpdate() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBGame::onScriptShutdown(CScScript *script) { +bool CBGame::onScriptShutdown(CScScript *script) { return STATUS_OK; } diff --git a/engines/wintermute/Base/BGame.h b/engines/wintermute/Base/BGame.h index e78fd80118..bb8cdce402 100644 --- a/engines/wintermute/Base/BGame.h +++ b/engines/wintermute/Base/BGame.h @@ -39,7 +39,7 @@ namespace WinterMute { -typedef void (*ENGINE_LOG_CALLBACK)(char *Text, ERRORCODE Result, void *Data); +typedef void (*ENGINE_LOG_CALLBACK)(char *Text, bool Result, void *Data); class CBSoundMgr; class CBFader; @@ -67,19 +67,19 @@ class CBGame: public CBObject { public: DECLARE_PERSISTENT(CBGame, CBObject) - virtual ERRORCODE onScriptShutdown(CScScript *script); + virtual bool onScriptShutdown(CScScript *script); - 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(); + virtual bool onActivate(bool activate, bool refreshMouse); + virtual bool onMouseLeftDown(); + virtual bool onMouseLeftUp(); + virtual bool onMouseLeftDblClick(); + virtual bool onMouseRightDblClick(); + virtual bool onMouseRightDown(); + virtual bool onMouseRightUp(); + virtual bool onMouseMiddleDown(); + virtual bool onMouseMiddleUp(); + virtual bool onPaint(); + virtual bool onWindowClose(); bool isLeftDoubleClick(); bool isRightDoubleClick(); @@ -89,14 +89,14 @@ public: uint32 _lastMiniUpdate; bool _miniUpdateEnabled; - virtual ERRORCODE miniUpdate(); + virtual bool miniUpdate(); void getMousePos(Point32 *Pos); Rect32 _mouseLockRect; bool _shuttingDown; - virtual ERRORCODE displayDebugInfo(); + virtual bool displayDebugInfo(); bool _debugShowFPS; bool _suspendedRendering; @@ -110,10 +110,10 @@ public: int _loadingIconY; int _loadingIconPersistent; - virtual ERRORCODE resetContent(); + virtual bool resetContent(); void DEBUG_DumpClassRegistry(); - ERRORCODE setWaitCursor(const char *filename); + bool setWaitCursor(const char *filename); char *_localSaveDir; bool _saveDirChecked; @@ -137,7 +137,7 @@ protected: int _loadImageY; CBSurface *_saveLoadImage; - ERRORCODE displayIndicator(); + bool displayIndicator(); bool _reportTextureFormat; public: @@ -159,20 +159,20 @@ public: float _offsetPercentY; CBObject *_mainObject; - ERRORCODE initInput(); - ERRORCODE initLoop(); + bool initInput(); + bool initLoop(); uint32 _currentTime; uint32 _deltaTime; CBFont *_systemFont; CBFont *_videoFont; - ERRORCODE initialize1(); - ERRORCODE initialize2(); - ERRORCODE initialize3(); + bool initialize1(); + bool initialize2(); + bool initialize3(); CBFileManager *_fileManager; CBTransitionMgr *_transMgr; CBDebugger *getDebugMgr(); - void LOG(ERRORCODE res, const char *fmt, ...); + void LOG(bool res, const char *fmt, ...); CBRenderer *_renderer; CBSoundMgr *_soundMgr; @@ -190,8 +190,8 @@ public: void *_debugLogFile; int _sequence; - virtual ERRORCODE loadFile(const char *filename); - virtual ERRORCODE loadBuffer(byte *buffer, bool complete = true); + virtual bool loadFile(const char *filename); + virtual bool loadBuffer(byte *buffer, bool complete = true); CBArray _quickMessages; CBArray _windows; CBArray _viewportStack; @@ -216,14 +216,14 @@ protected: bool _settingsAllowDesktopRes; int _settingsTLMode; CBFader *_fader; - virtual ERRORCODE invalidateDeviceObjects(); - virtual ERRORCODE restoreDeviceObjects(); + virtual bool invalidateDeviceObjects(); + virtual bool restoreDeviceObjects(); public: - virtual ERRORCODE ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStack, char *name); + virtual bool ExternalCall(CScScript *script, CScStack *stack, CScStack *thisStack, char *name); // scripting interface virtual CScValue *scGetProperty(const char *name); - virtual ERRORCODE scSetProperty(const char *name, CScValue *value); - virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual bool scSetProperty(const char *name, CScValue *value); + virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); virtual const char *scToString(); // compatibility bits bool _compatKillMethodThreads; @@ -244,23 +244,23 @@ public: int _scheduledLoadSlot; bool _loading; bool _personalizedSave; - ERRORCODE emptySaveSlot(int slot); + bool emptySaveSlot(int slot); bool isSaveSlotUsed(int slot); - ERRORCODE getSaveSlotDescription(int slot, char *buffer); - ERRORCODE getSaveSlotFilename(int slot, char *buffer); + bool getSaveSlotDescription(int slot, char *buffer); + bool getSaveSlotFilename(int slot, char *buffer); void setWindowTitle(); virtual bool handleMouseWheel(int delta); bool _quitting; - virtual ERRORCODE getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor); + virtual bool getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor); virtual bool handleKeypress(Common::Event *event, bool printable = false); virtual void handleKeyRelease(Common::Event *event); protected: int _freezeLevel; public: - ERRORCODE unfreeze(); - ERRORCODE freeze(bool includingMusic = true); - ERRORCODE focusWindow(CUIWindow *window); + bool unfreeze(); + bool freeze(bool includingMusic = true); + bool focusWindow(CUIWindow *window); CVidPlayer *_videoPlayer; CVidTheoraPlayer *_theoraPlayer; bool _loadInProgress; @@ -275,12 +275,12 @@ protected: public: static void invalidateValues(void *value, void *data); - 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); + bool loadSettings(const char *filename); + bool resumeMusic(int channel); + bool setMusicStartTime(int channel, uint32 time); + bool pauseMusic(int channel); + bool stopMusic(int channel); + bool playMusic(int channel, const char *filename, bool looping = true, uint32 loopStart = 0); CBSound *_music[NUM_MUSIC_CHANNELS]; bool _musicCrossfadeRunning; bool _musicCrossfadeSwap; @@ -288,14 +288,14 @@ public: uint32 _musicCrossfadeLength; int _musicCrossfadeChannel1; int _musicCrossfadeChannel2; - ERRORCODE displayWindows(bool inGame = false); + bool displayWindows(bool inGame = false); CBRegistry *_registry; bool _useD3D; - 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(); + virtual bool cleanup(); + virtual bool loadGame(int slot); + virtual bool loadGame(const char *filename); + virtual bool SaveGame(int slot, const char *desc, bool quickSave = false); + virtual bool showCursor(); CBSprite *_cursorNoninteractive; CBObject *_activeObject; @@ -315,36 +315,36 @@ public: CBObject *_capturedObject; Point32 _mousePos; bool validObject(CBObject *object); - ERRORCODE unregisterObject(CBObject *object); - ERRORCODE registerObject(CBObject *object); + bool unregisterObject(CBObject *object); + bool registerObject(CBObject *object); void quickMessage(const char *text); void quickMessageForm(char *fmt, ...); - ERRORCODE displayQuickMsg(); + bool displayQuickMsg(); uint32 _fps; - ERRORCODE updateMusicCrossfade(); + bool updateMusicCrossfade(); bool isVideoPlaying(); - ERRORCODE stopVideo(); + bool stopVideo(); CBArray _regObjects; public: - virtual ERRORCODE displayContent(bool update = true, bool displayAll = false); - virtual ERRORCODE displayContentSimple(); + virtual bool displayContent(bool update = true, bool displayAll = false); + virtual bool displayContentSimple(); bool _forceNonStreamedSounds; void resetMousePos(); int _subtitlesSpeed; void setInteractive(bool state); - 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(Rect32 *rect, bool *custom = NULL); - ERRORCODE popViewport(); - ERRORCODE pushViewport(CBViewport *Viewport); - ERRORCODE setActiveObject(CBObject *Obj); + virtual bool windowLoadHook(CUIWindow *win, char **buf, char **params); + virtual bool windowScriptMethodHook(CUIWindow *win, CScScript *script, CScStack *stack, const char *name); + bool getCurrentViewportOffset(int *offsetX = NULL, int *offsetY = NULL); + bool getCurrentViewportRect(Rect32 *rect, bool *custom = NULL); + bool popViewport(); + bool pushViewport(CBViewport *Viewport); + bool setActiveObject(CBObject *Obj); CBSprite *_lastCursor; - ERRORCODE drawCursor(CBSprite *Cursor); + bool drawCursor(CBSprite *Cursor); - virtual ERRORCODE initAfterLoad(); + virtual bool initAfterLoad(); CBSaveThumbHelper *_cachedThumbnail; AnsiString getDataDir(); void addMem(int bytes); diff --git a/engines/wintermute/Base/BImage.cpp b/engines/wintermute/Base/BImage.cpp index 57a2694aa8..41a1eff753 100644 --- a/engines/wintermute/Base/BImage.cpp +++ b/engines/wintermute/Base/BImage.cpp @@ -69,7 +69,7 @@ CBImage::~CBImage() { #endif } -ERRORCODE CBImage::loadFile(const Common::String &filename) { +bool CBImage::loadFile(const Common::String &filename) { _filename = filename; _filename.toLowercase(); if (StringUtil::startsWith(filename, "savegame:", true)) { @@ -111,7 +111,7 @@ void CBImage::copyFrom(Graphics::Surface *surface) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBImage::saveBMPFile(const char *filename) { +bool CBImage::saveBMPFile(const char *filename) { #if 0 if (!_bitmap) return STATUS_FAILED; @@ -123,7 +123,7 @@ ERRORCODE CBImage::saveBMPFile(const char *filename) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBImage::resize(int newWidth, int newHeight) { +bool CBImage::resize(int newWidth, int newHeight) { #if 0 if (!_bitmap) return STATUS_FAILED; @@ -247,7 +247,7 @@ bool CBImage::writeBMPToStream(Common::WriteStream *stream) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBImage::copyFrom(CBImage *origImage, int newWidth, int newHeight) { +bool CBImage::copyFrom(CBImage *origImage, int newWidth, int newHeight) { #if 0 if (_bitmap) FreeImage_Unload(_bitmap); diff --git a/engines/wintermute/Base/BImage.h b/engines/wintermute/Base/BImage.h index c66f6f4ca3..29455d3f7a 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(); - ERRORCODE loadFile(const Common::String &filename); + bool 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); - ERRORCODE resize(int newWidth, int newHeight); - ERRORCODE saveBMPFile(const char *filename); - ERRORCODE copyFrom(CBImage *origImage, int newWidth = 0, int newHeight = 0); + bool resize(int newWidth, int newHeight); + bool saveBMPFile(const char *filename); + bool 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 ba8d807462..83deaa0306 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 ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBKeyboardState::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CBKeyboardState::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // IsKeyDown ////////////////////////////////////////////////////////////////////////// @@ -173,7 +173,7 @@ CScValue *CBKeyboardState::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBKeyboardState::scSetProperty(const char *name, CScValue *value) { +bool CBKeyboardState::scSetProperty(const char *name, CScValue *value) { /* ////////////////////////////////////////////////////////////////////////// // Name @@ -195,7 +195,7 @@ const char *CBKeyboardState::scToString() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBKeyboardState::readKey(Common::Event *event) { +bool CBKeyboardState::readKey(Common::Event *event) { //_currentPrintable = (event->type == SDL_TEXTINPUT); // TODO _currentCharCode = keyCodeToVKey(event); if ((_currentCharCode <= Common::KEYCODE_z && _currentCharCode >= Common::KEYCODE_a) || @@ -215,7 +215,7 @@ ERRORCODE CBKeyboardState::readKey(Common::Event *event) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBKeyboardState::persist(CBPersistMgr *persistMgr) { +bool CBKeyboardState::persist(CBPersistMgr *persistMgr) { //if(!persistMgr->_saving) cleanup(); CBScriptable::persist(persistMgr); diff --git a/engines/wintermute/Base/BKeyboardState.h b/engines/wintermute/Base/BKeyboardState.h index 29844e5d09..84bbab5339 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(); - ERRORCODE readKey(Common::Event *event); + bool 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 ERRORCODE scSetProperty(const char *name, CScValue *value); - virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual bool scSetProperty(const char *name, CScValue *value); + virtual bool 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 35a2e257d6..6640602443 100644 --- a/engines/wintermute/Base/BObject.cpp +++ b/engines/wintermute/Base/BObject.cpp @@ -107,7 +107,7 @@ CBObject::~CBObject() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBObject::cleanup() { +bool CBObject::cleanup() { if (_gameRef && _gameRef->_activeObject == this) _gameRef->_activeObject = NULL; @@ -161,7 +161,7 @@ const char *CBObject::getCaption(int caseVal) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBObject::listen(CBScriptHolder *param1, uint32 param2) { +bool CBObject::listen(CBScriptHolder *param1, uint32 param2) { return STATUS_FAILED; } @@ -169,7 +169,7 @@ ERRORCODE CBObject::listen(CBScriptHolder *param1, uint32 param2) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CBObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // SkipTo @@ -671,7 +671,7 @@ CScValue *CBObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBObject::scSetProperty(const char *name, CScValue *value) { +bool CBObject::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// // Caption ////////////////////////////////////////////////////////////////////////// @@ -856,20 +856,20 @@ const char *CBObject::scToString() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBObject::showCursor() { +bool CBObject::showCursor() { if (_cursor) return _gameRef->drawCursor(_cursor); else return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBObject::saveAsText(CBDynBuffer *buffer, int indent) { +bool CBObject::saveAsText(CBDynBuffer *buffer, int indent) { return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBObject::persist(CBPersistMgr *persistMgr) { +bool CBObject::persist(CBPersistMgr *persistMgr) { CBScriptHolder::persist(persistMgr); for (int i = 0; i < 7; i++) @@ -925,7 +925,7 @@ ERRORCODE CBObject::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBObject::setCursor(const char *filename) { +bool CBObject::setCursor(const char *filename) { if (!_sharedCursors) { delete _cursor; _cursor = NULL; @@ -942,7 +942,7 @@ ERRORCODE CBObject::setCursor(const char *filename) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBObject::setActiveCursor(const char *filename) { +bool CBObject::setActiveCursor(const char *filename) { delete _activeCursor; _activeCursor = new CBSprite(_gameRef); if (!_activeCursor || DID_FAIL(_activeCursor->loadFile(filename))) { @@ -960,7 +960,7 @@ int CBObject::getHeight() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBObject::handleMouse(TMouseEvent event, TMouseButton button) { +bool CBObject::handleMouse(TMouseEvent event, TMouseButton button) { return STATUS_OK; } @@ -978,7 +978,7 @@ bool CBObject::handleMouseWheel(int delta) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBObject::playSFX(const char *filename, bool looping, bool playNow, const char *eventName, uint32 loopStart) { +bool CBObject::playSFX(const char *filename, bool looping, bool playNow, const char *eventName, uint32 loopStart) { // just play loaded sound if (filename == NULL && _sFX) { if (_gameRef->_editorMode || _sFXStart) { @@ -1020,7 +1020,7 @@ ERRORCODE CBObject::playSFX(const char *filename, bool looping, bool playNow, co ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBObject::stopSFX(bool deleteSound) { +bool CBObject::stopSFX(bool deleteSound) { if (_sFX) { _sFX->stop(); if (deleteSound) { @@ -1033,21 +1033,21 @@ ERRORCODE CBObject::stopSFX(bool deleteSound) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBObject::pauseSFX() { +bool CBObject::pauseSFX() { if (_sFX) return _sFX->pause(); else return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBObject::resumeSFX() { +bool CBObject::resumeSFX() { if (_sFX) return _sFX->resume(); else return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBObject::setSFXTime(uint32 time) { +bool CBObject::setSFXTime(uint32 time) { _sFXStart = time; if (_sFX && _sFX->isPlaying()) return _sFX->setPositionTime(time); else return STATUS_OK; @@ -1055,7 +1055,7 @@ ERRORCODE CBObject::setSFXTime(uint32 time) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBObject::setSFXVolume(int volume) { +bool CBObject::setSFXVolume(int volume) { _sFXVolume = volume; if (_sFX) return _sFX->setVolumePercent(volume); else return STATUS_OK; @@ -1063,7 +1063,7 @@ ERRORCODE CBObject::setSFXVolume(int volume) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBObject::updateSounds() { +bool CBObject::updateSounds() { if (_soundEvent) { if (_sFX && !_sFX->isPlaying()) { applyEvent(_soundEvent); @@ -1077,8 +1077,8 @@ ERRORCODE CBObject::updateSounds() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBObject::updateOneSound(CBSound *sound) { - ERRORCODE Ret = STATUS_OK; +bool CBObject::updateOneSound(CBSound *sound) { + bool Ret = STATUS_OK; if (sound) { if (_autoSoundPanning) @@ -1090,7 +1090,7 @@ ERRORCODE CBObject::updateOneSound(CBSound *sound) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBObject::resetSoundPan() { +bool CBObject::resetSoundPan() { if (!_sFX) return STATUS_OK; else { return _sFX->setPan(0.0f); @@ -1121,7 +1121,7 @@ void CBObject::setSoundEvent(const char *eventName) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBObject::afterMove() { +bool CBObject::afterMove() { return STATUS_OK; } diff --git a/engines/wintermute/Base/BObject.h b/engines/wintermute/Base/BObject.h index 15ccdbef44..6e3c632bac 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 ERRORCODE afterMove(); + virtual bool afterMove(); float _relativeRotate; bool _rotateValid; float _rotate; @@ -59,18 +59,18 @@ public: float _relativeScale; virtual bool isReady(); virtual bool getExtendedFlag(const char *flagName); - virtual ERRORCODE resetSoundPan(); - virtual ERRORCODE updateSounds(); - ERRORCODE updateOneSound(CBSound *sound); + virtual bool resetSoundPan(); + virtual bool updateSounds(); + bool updateOneSound(CBSound *sound); bool _autoSoundPanning; uint32 _sFXStart; int _sFXVolume; - 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); + bool setSFXTime(uint32 time); + bool setSFXVolume(int volume); + bool resumeSFX(); + bool pauseSFX(); + bool stopSFX(bool deleteSound = true); + bool 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 ERRORCODE handleMouse(TMouseEvent event, TMouseButton button); + virtual bool handleMouse(TMouseEvent event, TMouseButton button); virtual bool handleKeypress(Common::Event *event, bool printable = false); virtual int getHeight(); - ERRORCODE setCursor(const char *filename); - ERRORCODE setActiveCursor(const char *filename); - ERRORCODE cleanup(); + bool setCursor(const char *filename); + bool setActiveCursor(const char *filename); + bool 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 ERRORCODE showCursor(); + virtual bool showCursor(); CBSprite *_cursor; bool _sharedCursors; CBSprite *_activeCursor; - virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent); - virtual ERRORCODE listen(CBScriptHolder *param1, uint32 param2); + virtual bool saveAsText(CBDynBuffer *buffer, int indent); + virtual bool listen(CBScriptHolder *param1, uint32 param2); bool _ready; bool _registrable; bool _zoomable; @@ -116,16 +116,16 @@ public: bool _saveState; // base - virtual ERRORCODE update() { + virtual bool update() { return STATUS_FAILED; }; - virtual ERRORCODE display() { + virtual bool display() { return STATUS_FAILED; }; - virtual ERRORCODE invalidateDeviceObjects() { + virtual bool invalidateDeviceObjects() { return STATUS_OK; }; - virtual ERRORCODE restoreDeviceObjects() { + virtual bool restoreDeviceObjects() { return STATUS_OK; }; bool _nonIntMouseEvents; @@ -134,8 +134,8 @@ public: public: // scripting interface virtual CScValue *scGetProperty(const char *name); - virtual ERRORCODE scSetProperty(const char *name, CScValue *value); - virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual bool scSetProperty(const char *name, CScValue *value); + virtual bool 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 0727417025..9dcdd38cdc 100644 --- a/engines/wintermute/Base/BPackage.cpp +++ b/engines/wintermute/Base/BPackage.cpp @@ -57,7 +57,7 @@ CBPackage::~CBPackage() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBPackage::open() { +bool CBPackage::open() { if (_file) return STATUS_OK; else { _file = getFilePointer(); @@ -67,7 +67,7 @@ ERRORCODE CBPackage::open() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBPackage::close() { +bool CBPackage::close() { delete _file; _file = NULL; return STATUS_OK; @@ -75,8 +75,8 @@ ERRORCODE CBPackage::close() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBPackage::read(Common::SeekableReadStream *file, uint32 offset, byte *buffer, uint32 size) { - ERRORCODE ret; +bool CBPackage::read(Common::SeekableReadStream *file, uint32 offset, byte *buffer, uint32 size) { + bool ret; if (DID_FAIL(ret = open())) return ret; else { if (file->seek(offset, SEEK_SET)) return STATUS_FAILED; diff --git a/engines/wintermute/Base/BPackage.h b/engines/wintermute/Base/BPackage.h index cb56717b71..117b0c522d 100644 --- a/engines/wintermute/Base/BPackage.h +++ b/engines/wintermute/Base/BPackage.h @@ -45,9 +45,9 @@ public: bool _boundToExe; byte _priority; - ERRORCODE read(Common::SeekableReadStream *file, uint32 offset, byte *buffer, uint32 size); - ERRORCODE close(); - ERRORCODE open(); + bool read(Common::SeekableReadStream *file, uint32 offset, byte *buffer, uint32 size); + bool close(); + bool open(); char *_name; int _cD; Common::SeekableReadStream *_file; diff --git a/engines/wintermute/Base/BPersistMgr.cpp b/engines/wintermute/Base/BPersistMgr.cpp index b58534ea90..700b63479a 100644 --- a/engines/wintermute/Base/BPersistMgr.cpp +++ b/engines/wintermute/Base/BPersistMgr.cpp @@ -170,7 +170,7 @@ bool CBPersistMgr::getSaveExists(int slot) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBPersistMgr::initSave(const char *desc) { +bool CBPersistMgr::initSave(const char *desc) { if (!desc) return STATUS_FAILED; cleanup(); @@ -244,7 +244,7 @@ ERRORCODE CBPersistMgr::initSave(const char *desc) { return STATUS_OK; } -ERRORCODE CBPersistMgr::readHeader(const Common::String &filename) { +bool CBPersistMgr::readHeader(const Common::String &filename) { cleanup(); _saving = false; @@ -299,7 +299,7 @@ ERRORCODE CBPersistMgr::readHeader(const Common::String &filename) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBPersistMgr::initLoad(const char *filename) { +bool CBPersistMgr::initLoad(const char *filename) { if (DID_FAIL(readHeader(filename))) { cleanup(); return STATUS_FAILED; @@ -348,13 +348,13 @@ ERRORCODE CBPersistMgr::initLoad(const char *filename) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBPersistMgr::saveFile(const char *filename) { +bool CBPersistMgr::saveFile(const char *filename) { return _gameRef->_fileManager->saveFile(filename, ((Common::MemoryWriteStreamDynamic *)_saveStream)->getData(), ((Common::MemoryWriteStreamDynamic *)_saveStream)->size(), _gameRef->_compressedSavegames, _richBuffer, _richBufferSize); } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBPersistMgr::putBytes(byte *buffer, uint32 size) { +bool CBPersistMgr::putBytes(byte *buffer, uint32 size) { _saveStream->write(buffer, size); if (_saveStream->err()) return STATUS_FAILED; @@ -362,7 +362,7 @@ ERRORCODE CBPersistMgr::putBytes(byte *buffer, uint32 size) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBPersistMgr::getBytes(byte *buffer, uint32 size) { +bool CBPersistMgr::getBytes(byte *buffer, uint32 size) { _loadStream->read(buffer, size); if (_loadStream->err()) return STATUS_FAILED; @@ -420,7 +420,7 @@ char *CBPersistMgr::getString() { } else return ret; } -ERRORCODE CBPersistMgr::putTimeDate(const TimeDate &t) { +bool CBPersistMgr::putTimeDate(const TimeDate &t) { _saveStream->writeSint32LE(t.tm_sec); _saveStream->writeSint32LE(t.tm_min); _saveStream->writeSint32LE(t.tm_hour); @@ -484,7 +484,7 @@ double CBPersistMgr::getDouble() { ////////////////////////////////////////////////////////////////////////// // bool -ERRORCODE CBPersistMgr::transfer(const char *name, bool *val) { +bool CBPersistMgr::transfer(const char *name, bool *val) { if (_saving) { _saveStream->writeByte(*val); if (_saveStream->err()) @@ -501,7 +501,7 @@ ERRORCODE CBPersistMgr::transfer(const char *name, bool *val) { ////////////////////////////////////////////////////////////////////////// // int -ERRORCODE CBPersistMgr::transfer(const char *name, int *val) { +bool CBPersistMgr::transfer(const char *name, int *val) { if (_saving) { _saveStream->writeSint32LE(*val); if (_saveStream->err()) @@ -518,7 +518,7 @@ ERRORCODE CBPersistMgr::transfer(const char *name, int *val) { ////////////////////////////////////////////////////////////////////////// // DWORD -ERRORCODE CBPersistMgr::transfer(const char *name, uint32 *val) { +bool CBPersistMgr::transfer(const char *name, uint32 *val) { if (_saving) { _saveStream->writeUint32LE(*val); if (_saveStream->err()) @@ -535,7 +535,7 @@ ERRORCODE CBPersistMgr::transfer(const char *name, uint32 *val) { ////////////////////////////////////////////////////////////////////////// // float -ERRORCODE CBPersistMgr::transfer(const char *name, float *val) { +bool CBPersistMgr::transfer(const char *name, float *val) { if (_saving) { putFloat(*val); if (_saveStream->err()) @@ -552,7 +552,7 @@ ERRORCODE CBPersistMgr::transfer(const char *name, float *val) { ////////////////////////////////////////////////////////////////////////// // double -ERRORCODE CBPersistMgr::transfer(const char *name, double *val) { +bool CBPersistMgr::transfer(const char *name, double *val) { if (_saving) { putDouble(*val); if (_saveStream->err()) @@ -569,7 +569,7 @@ ERRORCODE CBPersistMgr::transfer(const char *name, double *val) { ////////////////////////////////////////////////////////////////////////// // char* -ERRORCODE CBPersistMgr::transfer(const char *name, char **val) { +bool CBPersistMgr::transfer(const char *name, char **val) { if (_saving) { putString(*val); return STATUS_OK; @@ -586,7 +586,7 @@ ERRORCODE CBPersistMgr::transfer(const char *name, char **val) { ////////////////////////////////////////////////////////////////////////// // const char* -ERRORCODE CBPersistMgr::transfer(const char *name, const char **val) { +bool CBPersistMgr::transfer(const char *name, const char **val) { if (_saving) { putString(*val); return STATUS_OK; @@ -603,7 +603,7 @@ ERRORCODE CBPersistMgr::transfer(const char *name, const char **val) { ////////////////////////////////////////////////////////////////////////// // Common::String -ERRORCODE CBPersistMgr::transfer(const char *name, Common::String *val) { +bool CBPersistMgr::transfer(const char *name, Common::String *val) { if (_saving) { putString(*val); return STATUS_OK; @@ -624,7 +624,7 @@ ERRORCODE CBPersistMgr::transfer(const char *name, Common::String *val) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBPersistMgr::transfer(const char *name, AnsiStringArray &val) { +bool CBPersistMgr::transfer(const char *name, AnsiStringArray &val) { size_t size; if (_saving) { @@ -654,7 +654,7 @@ ERRORCODE CBPersistMgr::transfer(const char *name, AnsiStringArray &val) { ////////////////////////////////////////////////////////////////////////// // BYTE -ERRORCODE CBPersistMgr::transfer(const char *name, byte *val) { +bool CBPersistMgr::transfer(const char *name, byte *val) { if (_saving) { _saveStream->writeByte(*val); if (_saveStream->err()) @@ -671,7 +671,7 @@ ERRORCODE CBPersistMgr::transfer(const char *name, byte *val) { ////////////////////////////////////////////////////////////////////////// // RECT -ERRORCODE CBPersistMgr::transfer(const char *name, Rect32 *val) { +bool CBPersistMgr::transfer(const char *name, Rect32 *val) { if (_saving) { _saveStream->writeSint32LE(val->left); _saveStream->writeSint32LE(val->top); @@ -694,7 +694,7 @@ ERRORCODE CBPersistMgr::transfer(const char *name, Rect32 *val) { ////////////////////////////////////////////////////////////////////////// // POINT -ERRORCODE CBPersistMgr::transfer(const char *name, Point32 *val) { +bool CBPersistMgr::transfer(const char *name, Point32 *val) { if (_saving) { _saveStream->writeSint32LE(val->x); _saveStream->writeSint32LE(val->y); @@ -713,7 +713,7 @@ ERRORCODE CBPersistMgr::transfer(const char *name, Point32 *val) { ////////////////////////////////////////////////////////////////////////// // Vector2 -ERRORCODE CBPersistMgr::transfer(const char *name, Vector2 *val) { +bool CBPersistMgr::transfer(const char *name, Vector2 *val) { if (_saving) { putFloat(val->x); putFloat(val->y); @@ -732,7 +732,7 @@ ERRORCODE CBPersistMgr::transfer(const char *name, Vector2 *val) { ////////////////////////////////////////////////////////////////////////// // generic pointer -ERRORCODE CBPersistMgr::transfer(const char *name, void *val) { +bool CBPersistMgr::transfer(const char *name, void *val) { int classID = -1, instanceID = -1; if (_saving) { diff --git a/engines/wintermute/Base/BPersistMgr.h b/engines/wintermute/Base/BPersistMgr.h index d2aca60cf9..ee834c005e 100644 --- a/engines/wintermute/Base/BPersistMgr.h +++ b/engines/wintermute/Base/BPersistMgr.h @@ -53,7 +53,7 @@ public: byte _savedExtMajor; byte _savedExtMinor; Common::String _savedName; - ERRORCODE saveFile(const char *filename); + bool saveFile(const char *filename); uint32 getDWORD(); void putDWORD(uint32 val); char *getString(); @@ -68,10 +68,10 @@ public: void deleteSaveSlot(int slot); uint32 getMaxUsedSlot(); bool getSaveExists(int slot); - ERRORCODE initLoad(const char *filename); - ERRORCODE initSave(const char *desc); - ERRORCODE getBytes(byte *buffer, uint32 size); - ERRORCODE putBytes(byte *buffer, uint32 size); + bool initLoad(const char *filename); + bool initSave(const char *desc); + bool getBytes(byte *buffer, uint32 size); + bool putBytes(byte *buffer, uint32 size); uint32 _offset; bool _saving; @@ -79,20 +79,20 @@ public: uint32 _richBufferSize; byte *_richBuffer; - 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, Rect32 *val); - ERRORCODE transfer(const char *name, Point32 *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); + bool transfer(const char *name, void *val); + bool transfer(const char *name, int *val); + bool transfer(const char *name, uint32 *val); + bool transfer(const char *name, float *val); + bool transfer(const char *name, double *val); + bool transfer(const char *name, bool *val); + bool transfer(const char *name, byte *val); + bool transfer(const char *name, Rect32 *val); + bool transfer(const char *name, Point32 *val); + bool transfer(const char *name, const char **val); + bool transfer(const char *name, char **val); + bool transfer(const char *name, Common::String *val); + bool transfer(const char *name, Vector2 *val); + bool transfer(const char *name, AnsiStringArray &Val); CBPersistMgr(CBGame *inGame = NULL); virtual ~CBPersistMgr(); bool checkVersion(byte verMajor, byte verMinor, byte verBuild); @@ -101,9 +101,9 @@ public: byte *_thumbnailData; private: Common::String getFilenameForSlot(int slot); - ERRORCODE readHeader(const Common::String &filename); + bool readHeader(const Common::String &filename); TimeDate getTimeDate(); - ERRORCODE putTimeDate(const TimeDate &t); + bool 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 b6b8c4e572..abb170d0b5 100644 --- a/engines/wintermute/Base/BPoint.cpp +++ b/engines/wintermute/Base/BPoint.cpp @@ -53,7 +53,7 @@ CBPoint::CBPoint(int initX, int initY) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBPoint::persist(CBPersistMgr *persistMgr) { +bool CBPoint::persist(CBPersistMgr *persistMgr) { persistMgr->transfer(TMEMBER(x)); persistMgr->transfer(TMEMBER(y)); diff --git a/engines/wintermute/Base/BRegion.cpp b/engines/wintermute/Base/BRegion.cpp index 1db15abae0..3dc14df05f 100644 --- a/engines/wintermute/Base/BRegion.cpp +++ b/engines/wintermute/Base/BRegion.cpp @@ -95,14 +95,14 @@ bool CBRegion::pointInRegion(int x, int y) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBRegion::loadFile(const char *filename) { +bool CBRegion::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { _gameRef->LOG(0, "CBRegion::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } - ERRORCODE ret; + bool ret; _filename = new char [strlen(filename) + 1]; strcpy(_filename, filename); @@ -128,7 +128,7 @@ TOKEN_DEF(EDITOR_SELECTED_POINT) TOKEN_DEF(PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBRegion::loadBuffer(byte *buffer, bool complete) { +bool CBRegion::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(REGION) TOKEN_TABLE(TEMPLATE) @@ -210,7 +210,7 @@ ERRORCODE CBRegion::loadBuffer(byte *buffer, bool complete) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBRegion::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CBRegion::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // AddPoint @@ -350,7 +350,7 @@ CScValue *CBRegion::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBRegion::scSetProperty(const char *name, CScValue *value) { +bool CBRegion::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// // Name ////////////////////////////////////////////////////////////////////////// @@ -378,7 +378,7 @@ const char *CBRegion::scToString() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBRegion::saveAsText(CBDynBuffer *buffer, int indent, const char *nameOverride) { +bool CBRegion::saveAsText(CBDynBuffer *buffer, int indent, const char *nameOverride) { if (!nameOverride) buffer->putTextIndent(indent, "REGION {\n"); else buffer->putTextIndent(indent, "%s {\n", nameOverride); @@ -406,7 +406,7 @@ ERRORCODE CBRegion::saveAsText(CBDynBuffer *buffer, int indent, const char *name ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBRegion::persist(CBPersistMgr *persistMgr) { +bool CBRegion::persist(CBPersistMgr *persistMgr) { CBObject::persist(persistMgr); @@ -465,7 +465,7 @@ bool CBRegion::ptInPolygon(int x, int y) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBRegion::getBoundingRect(Rect32 *rect) { +bool CBRegion::getBoundingRect(Rect32 *rect) { if (_points.getSize() == 0) CBPlatform::setRectEmpty(rect); else { int MinX = INT_MAX, MinY = INT_MAX, MaxX = INT_MIN, MaxY = INT_MIN; @@ -484,7 +484,7 @@ ERRORCODE CBRegion::getBoundingRect(Rect32 *rect) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBRegion::mimic(CBRegion *region, float scale, int x, int y) { +bool CBRegion::mimic(CBRegion *region, float scale, int x, int y) { if (scale == _lastMimicScale && x == _lastMimicX && y == _lastMimicY) return STATUS_OK; cleanup(); diff --git a/engines/wintermute/Base/BRegion.h b/engines/wintermute/Base/BRegion.h index 6c79abc8f3..d2f06cbed9 100644 --- a/engines/wintermute/Base/BRegion.h +++ b/engines/wintermute/Base/BRegion.h @@ -40,8 +40,8 @@ public: int _lastMimicX; int _lastMimicY; void cleanup(); - ERRORCODE mimic(CBRegion *region, float scale = 100.0f, int x = 0, int y = 0); - ERRORCODE getBoundingRect(Rect32 *rect); + bool mimic(CBRegion *region, float scale = 100.0f, int x = 0, int y = 0); + bool getBoundingRect(Rect32 *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(); - ERRORCODE loadFile(const char *filename); - ERRORCODE loadBuffer(byte *buffer, bool complete = true); + bool loadFile(const char *filename); + bool loadBuffer(byte *buffer, bool complete = true); Rect32 _rect; CBArray _points; - virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent, const char *nameOverride = NULL); + virtual bool saveAsText(CBDynBuffer *buffer, int indent, const char *nameOverride = NULL); // scripting interface virtual CScValue *scGetProperty(const char *name); - virtual ERRORCODE scSetProperty(const char *name, CScValue *value); - virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual bool scSetProperty(const char *name, CScValue *value); + virtual bool 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 4174bab71b..68c04d9d46 100644 --- a/engines/wintermute/Base/BRenderSDL.cpp +++ b/engines/wintermute/Base/BRenderSDL.cpp @@ -121,7 +121,7 @@ CBRenderSDL::~CBRenderSDL() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBRenderSDL::initRenderer(int width, int height, bool windowed) { +bool CBRenderSDL::initRenderer(int width, int height, bool windowed) { //if (SDL_Init(SDL_INIT_VIDEO) < 0) return STATUS_FAILED; #if 0 @@ -250,7 +250,7 @@ void CBRenderSDL::setColorMod(byte r, byte g, byte b) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBRenderSDL::flip() { +bool CBRenderSDL::flip() { if (!_disableDirtyRects) { drawTickets(); } @@ -270,7 +270,7 @@ ERRORCODE CBRenderSDL::flip() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBRenderSDL::fill(byte r, byte g, byte b, Common::Rect *rect) { +bool 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); @@ -285,14 +285,14 @@ ERRORCODE CBRenderSDL::fill(byte r, byte g, byte b, Common::Rect *rect) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBRenderSDL::fade(uint16 Alpha) { +bool CBRenderSDL::fade(uint16 Alpha) { uint32 dwAlpha = 255 - Alpha; return fadeToColor(dwAlpha << 24); } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBRenderSDL::fadeToColor(uint32 Color, Common::Rect *rect) { +bool 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; @@ -519,7 +519,7 @@ void CBRenderSDL::drawFromSurface(const Graphics::Surface *surf, Common::Rect *s } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBRenderSDL::drawLine(int x1, int y1, int x2, int y2, uint32 color) { +bool 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"); @@ -582,7 +582,7 @@ CBImage *CBRenderSDL::takeScreenshot() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBRenderSDL::switchFullscreen() { +bool CBRenderSDL::switchFullscreen() { /*if (_windowed) SDL_SetWindowFullscreen(_win, SDL_TRUE); else SDL_SetWindowFullscreen(_win, SDL_FALSE); @@ -608,7 +608,7 @@ const char *CBRenderSDL::getName() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBRenderSDL::setViewport(int left, int top, int right, int bottom) { +bool 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); diff --git a/engines/wintermute/Base/BRenderSDL.h b/engines/wintermute/Base/BRenderSDL.h index 8d23a5bb12..0192849afa 100644 --- a/engines/wintermute/Base/BRenderSDL.h +++ b/engines/wintermute/Base/BRenderSDL.h @@ -63,16 +63,16 @@ public: const char *getName(); - ERRORCODE initRenderer(int width, int height, bool windowed); - ERRORCODE flip(); - ERRORCODE fill(byte r, byte g, byte b, Common::Rect *rect = NULL); + bool initRenderer(int width, int height, bool windowed); + bool flip(); + bool fill(byte r, byte g, byte b, Common::Rect *rect = NULL); - ERRORCODE fade(uint16 alpha); - ERRORCODE fadeToColor(uint32 color, Common::Rect *rect = NULL); + bool fade(uint16 alpha); + bool fadeToColor(uint32 color, Common::Rect *rect = NULL); - ERRORCODE switchFullscreen(); + bool switchFullscreen(); - ERRORCODE drawLine(int x1, int y1, int x2, int y2, uint32 color); + bool drawLine(int x1, int y1, int x2, int y2, uint32 color); CBImage *takeScreenshot(); @@ -82,7 +82,7 @@ public: void invalidateTicketsFromSurface(CBSurfaceSDL *surf); void drawFromTicket(RenderTicket *renderTicket); - ERRORCODE setViewport(int left, int top, int right, int bottom); + bool setViewport(int left, int top, int right, int bottom); void modTargetRect(Common::Rect *rect); void pointFromScreen(Point32 *point); diff --git a/engines/wintermute/Base/BRenderer.cpp b/engines/wintermute/Base/BRenderer.cpp index d3d313faee..49eb8db69a 100644 --- a/engines/wintermute/Base/BRenderer.cpp +++ b/engines/wintermute/Base/BRenderer.cpp @@ -115,18 +115,18 @@ void CBRenderer::deleteRectList() { ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// -ERRORCODE CBRenderer::switchFullscreen() { +bool CBRenderer::switchFullscreen() { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////// -ERRORCODE CBRenderer::flip() { +bool CBRenderer::flip() { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////// -ERRORCODE CBRenderer::initRenderer(int width, int height, bool windowed) { +bool CBRenderer::initRenderer(int width, int height, bool windowed) { return STATUS_FAILED; } @@ -137,36 +137,36 @@ void CBRenderer::onWindowChange() { ////////////////////////////////////////////////////////////////////// -ERRORCODE CBRenderer::fill(byte r, byte g, byte b, Common::Rect *rect) { +bool CBRenderer::fill(byte r, byte g, byte b, Common::Rect *rect) { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBRenderer::windowedBlt() { +bool CBRenderer::windowedBlt() { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBRenderer::setup2D(bool Force) { +bool CBRenderer::setup2D(bool Force) { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBRenderer::setupLines() { +bool CBRenderer::setupLines() { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBRenderer::drawLine(int x1, int y1, int x2, int y2, uint32 color) { +bool CBRenderer::drawLine(int x1, int y1, int x2, int y2, uint32 color) { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBRenderer::drawRect(int x1, int y1, int x2, int y2, uint32 color, int width) { +bool 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 @@ -179,31 +179,31 @@ ERRORCODE CBRenderer::drawRect(int x1, int y1, int x2, int y2, uint32 color, int ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBRenderer::fade(uint16 alpha) { +bool CBRenderer::fade(uint16 alpha) { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBRenderer::fadeToColor(uint32 color, Common::Rect *rect) { +bool CBRenderer::fadeToColor(uint32 color, Common::Rect *rect) { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBRenderer::setViewport(int left, int top, int right, int bottom) { +bool CBRenderer::setViewport(int left, int top, int right, int bottom) { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBRenderer::setScreenViewport() { +bool CBRenderer::setScreenViewport() { return setViewport(_drawOffsetX, _drawOffsetY, _width + _drawOffsetX, _height + _drawOffsetY); } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBRenderer::setViewport(Rect32 *rect) { +bool CBRenderer::setViewport(Rect32 *rect) { return setViewport(rect->left + _drawOffsetX, rect->top + _drawOffsetY, rect->right + _drawOffsetX, @@ -218,7 +218,7 @@ CBImage *CBRenderer::takeScreenshot() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBRenderer::clipCursor() { +bool CBRenderer::clipCursor() { /* if (!_windowed) { Rect32 rc; @@ -237,7 +237,7 @@ ERRORCODE CBRenderer::clipCursor() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBRenderer::unclipCursor() { +bool CBRenderer::unclipCursor() { /* if (!_windowed) ::ClipCursor(NULL); */ diff --git a/engines/wintermute/Base/BRenderer.h b/engines/wintermute/Base/BRenderer.h index e7a9518c50..ddf2a3a808 100644 --- a/engines/wintermute/Base/BRenderer.h +++ b/engines/wintermute/Base/BRenderer.h @@ -49,36 +49,36 @@ public: virtual void dumpData(const char *filename) {}; virtual CBImage *takeScreenshot(); - virtual ERRORCODE setViewport(int left, int top, int right, int bottom); - virtual ERRORCODE setViewport(Rect32 *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); + virtual bool setViewport(int left, int top, int right, int bottom); + virtual bool setViewport(Rect32 *Rect); + virtual bool setScreenViewport(); + virtual bool fade(uint16 Alpha); + virtual bool fadeToColor(uint32 Color, Common::Rect *rect = NULL); + virtual bool drawLine(int x1, int y1, int x2, int y2, uint32 color); + virtual bool drawRect(int x1, int y1, int x2, int y2, uint32 color, int width = 1); CBRenderer(CBGame *inGame = NULL); virtual ~CBRenderer(); - virtual ERRORCODE setProjection() { + virtual bool setProjection() { return STATUS_OK; }; - virtual ERRORCODE windowedBlt(); - virtual ERRORCODE fill(byte r, byte g, byte b, Common::Rect *rect = NULL); + virtual bool windowedBlt(); + virtual bool fill(byte r, byte g, byte b, Common::Rect *rect = NULL); virtual void onWindowChange(); - virtual ERRORCODE initRenderer(int width, int height, bool windowed); - virtual ERRORCODE flip(); + virtual bool initRenderer(int width, int height, bool windowed); + virtual bool flip(); virtual void initLoop(); - virtual ERRORCODE switchFullscreen(); - virtual ERRORCODE setup2D(bool force = false); - virtual ERRORCODE setupLines(); + virtual bool switchFullscreen(); + virtual bool setup2D(bool force = false); + virtual bool setupLines(); virtual const char *getName() { return ""; }; - virtual ERRORCODE displayDebugInfo() { + virtual bool displayDebugInfo() { return STATUS_FAILED; }; - virtual ERRORCODE drawShaderQuad() { + virtual bool drawShaderQuad() { return STATUS_FAILED; } @@ -91,16 +91,16 @@ public: virtual CBSurface *createSurface() = 0; - ERRORCODE clipCursor(); - ERRORCODE unclipCursor(); + bool clipCursor(); + bool unclipCursor(); CBObject *getObjectAt(int x, int y); void deleteRectList(); - virtual ERRORCODE startSpriteBatch() { + virtual bool startSpriteBatch() { return STATUS_OK; }; - virtual ERRORCODE endSpriteBatch() { + virtual bool endSpriteBatch() { return STATUS_OK; }; bool pointInViewport(Point32 *P); diff --git a/engines/wintermute/Base/BSaveThumbHelper.cpp b/engines/wintermute/Base/BSaveThumbHelper.cpp index 6c7b572475..a1653449ff 100644 --- a/engines/wintermute/Base/BSaveThumbHelper.cpp +++ b/engines/wintermute/Base/BSaveThumbHelper.cpp @@ -45,7 +45,7 @@ CBSaveThumbHelper::~CBSaveThumbHelper(void) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSaveThumbHelper::storeThumbnail(bool doFlip) { +bool CBSaveThumbHelper::storeThumbnail(bool doFlip) { delete _thumbnail; _thumbnail = NULL; diff --git a/engines/wintermute/Base/BSaveThumbHelper.h b/engines/wintermute/Base/BSaveThumbHelper.h index 27163af30f..c7c7e13982 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); - ERRORCODE storeThumbnail(bool doFlip = false); + bool storeThumbnail(bool doFlip = false); CBImage *_thumbnail; CBImage *_richThumbnail; diff --git a/engines/wintermute/Base/BScriptHolder.cpp b/engines/wintermute/Base/BScriptHolder.cpp index 8e2a8f6adb..45cbc5d23b 100644 --- a/engines/wintermute/Base/BScriptHolder.cpp +++ b/engines/wintermute/Base/BScriptHolder.cpp @@ -55,7 +55,7 @@ CBScriptHolder::~CBScriptHolder() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBScriptHolder::cleanup() { +bool CBScriptHolder::cleanup() { delete[] _filename; _filename = NULL; @@ -80,10 +80,10 @@ void CBScriptHolder::setFilename(const char *filename) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBScriptHolder::applyEvent(const char *eventName, bool unbreakable) { +bool CBScriptHolder::applyEvent(const char *eventName, bool unbreakable) { int numHandlers = 0; - ERRORCODE ret = STATUS_FAILED; + bool ret = STATUS_FAILED; for (int i = 0; i < _scripts.getSize(); i++) { if (!_scripts[i]->_thread) { CScScript *handler = _scripts[i]->invokeEventHandler(eventName, unbreakable); @@ -101,7 +101,7 @@ ERRORCODE CBScriptHolder::applyEvent(const char *eventName, bool unbreakable) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBScriptHolder::listen(CBScriptHolder *param1, uint32 param2) { +bool CBScriptHolder::listen(CBScriptHolder *param1, uint32 param2) { return STATUS_FAILED; } @@ -109,7 +109,7 @@ ERRORCODE CBScriptHolder::listen(CBScriptHolder *param1, uint32 param2) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBScriptHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CBScriptHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // DEBUG_CrashMe ////////////////////////////////////////////////////////////////////////// @@ -128,7 +128,7 @@ ERRORCODE CBScriptHolder::scCallMethod(CScScript *script, CScStack *stack, CScSt else if (strcmp(name, "ApplyEvent") == 0) { stack->correctParams(1); CScValue *val = stack->pop(); - ERRORCODE ret; + bool ret; ret = applyEvent(val->getString()); if (DID_SUCCEED(ret)) stack->pushBool(true); @@ -240,7 +240,7 @@ CScValue *CBScriptHolder::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBScriptHolder::scSetProperty(const char *name, CScValue *value) { +bool CBScriptHolder::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// // Name ////////////////////////////////////////////////////////////////////////// @@ -257,13 +257,13 @@ const char *CBScriptHolder::scToString() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBScriptHolder::saveAsText(CBDynBuffer *buffer, int indent) { +bool CBScriptHolder::saveAsText(CBDynBuffer *buffer, int indent) { return CBBase::saveAsText(buffer, indent); } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBScriptHolder::persist(CBPersistMgr *persistMgr) { +bool CBScriptHolder::persist(CBPersistMgr *persistMgr) { CBScriptable::persist(persistMgr); persistMgr->transfer(TMEMBER(_filename)); @@ -276,7 +276,7 @@ ERRORCODE CBScriptHolder::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBScriptHolder::addScript(const char *filename) { +bool 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) { @@ -311,7 +311,7 @@ ERRORCODE CBScriptHolder::addScript(const char *filename) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBScriptHolder::removeScript(CScScript *script) { +bool CBScriptHolder::removeScript(CScScript *script) { for (int i = 0; i < _scripts.getSize(); i++) { if (_scripts[i] == script) { _scripts.removeAt(i); @@ -345,7 +345,7 @@ TOKEN_DEF(NAME) TOKEN_DEF(VALUE) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBScriptHolder::parseProperty(byte *buffer, bool complete) { +bool CBScriptHolder::parseProperty(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(PROPERTY) TOKEN_TABLE(NAME) @@ -433,7 +433,7 @@ CScScript *CBScriptHolder::invokeMethodThread(const char *methodName) { CScScript *thread = new CScScript(_gameRef, _scripts[i]->_engine); if (thread) { - ERRORCODE ret = thread->createMethodThread(_scripts[i], methodName); + bool ret = thread->createMethodThread(_scripts[i], methodName); if (DID_SUCCEED(ret)) { _scripts[i]->_engine->_scripts.add(thread); _gameRef->getDebugMgr()->onScriptMethodThreadInit(thread, _scripts[i], methodName); diff --git a/engines/wintermute/Base/BScriptHolder.h b/engines/wintermute/Base/BScriptHolder.h index dabaf52dd3..77f0f386cb 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); - 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); + bool cleanup(); + bool removeScript(CScScript *script); + bool addScript(const char *filename); + virtual bool saveAsText(CBDynBuffer *buffer, int indent); + virtual bool listen(CBScriptHolder *param1, uint32 param2); + bool applyEvent(const char *eventName, bool unbreakable = false); void setFilename(const char *filename); - ERRORCODE parseProperty(byte *buffer, bool complete = true); + bool parseProperty(byte *buffer, bool complete = true); char *_filename; bool _freezable; bool _ready; @@ -60,8 +60,8 @@ public: CBArray _scripts; // scripting interface virtual CScValue *scGetProperty(const char *name); - virtual ERRORCODE scSetProperty(const char *name, CScValue *value); - virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual bool scSetProperty(const char *name, CScValue *value); + virtual bool 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 b61398c9b2..e9416cfaf3 100644 --- a/engines/wintermute/Base/BScriptable.cpp +++ b/engines/wintermute/Base/BScriptable.cpp @@ -61,7 +61,7 @@ CBScriptable::~CBScriptable() { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBScriptable::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CBScriptable::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { /* stack->correctParams(0); stack->pushNULL(); @@ -82,7 +82,7 @@ CScValue *CBScriptable::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBScriptable::scSetProperty(const char *name, CScValue *value) { +bool CBScriptable::scSetProperty(const char *name, CScValue *value) { if (!_scProp) _scProp = new CScValue(_gameRef); if (_scProp) return _scProp->setProp(name, value); else return STATUS_FAILED; @@ -139,7 +139,7 @@ void CBScriptable::scSetBool(bool val) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBScriptable::persist(CBPersistMgr *persistMgr) { +bool CBScriptable::persist(CBPersistMgr *persistMgr) { persistMgr->transfer(TMEMBER(_gameRef)); persistMgr->transfer(TMEMBER(_refCount)); persistMgr->transfer(TMEMBER(_scProp)); diff --git a/engines/wintermute/Base/BScriptable.h b/engines/wintermute/Base/BScriptable.h index a65e3d20b6..e806b83fac 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 ERRORCODE scSetProperty(const char *name, CScValue *value); + virtual bool scSetProperty(const char *name, CScValue *value); virtual CScValue *scGetProperty(const char *name); - virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual bool 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 9f9fa1a050..315a073301 100644 --- a/engines/wintermute/Base/BSound.cpp +++ b/engines/wintermute/Base/BSound.cpp @@ -66,7 +66,7 @@ CBSound::~CBSound() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSound::setSound(const char *filename, Audio::Mixer::SoundType type, bool streamed) { +bool CBSound::setSound(const char *filename, Audio::Mixer::SoundType type, bool streamed) { if (_sound) { _gameRef->_soundMgr->removeSound(_sound); _sound = NULL; @@ -88,7 +88,7 @@ ERRORCODE CBSound::setSound(const char *filename, Audio::Mixer::SoundType type, ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSound::setSoundSimple() { +bool CBSound::setSoundSimple() { _sound = _gameRef->_soundMgr->addSound(_soundFilename, _soundType, _soundStreamed); if (_sound) { if (_soundPosition) _sound->setPosition(_soundPosition); @@ -111,7 +111,7 @@ uint32 CBSound::getLength() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSound::play(bool looping) { +bool CBSound::play(bool looping) { if (_sound) { _soundPaused = false; return _sound->play(looping, _soundPosition); @@ -120,7 +120,7 @@ ERRORCODE CBSound::play(bool looping) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSound::stop() { +bool CBSound::stop() { if (_sound) { _soundPaused = false; return _sound->stop(); @@ -129,7 +129,7 @@ ERRORCODE CBSound::stop() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSound::pause(bool freezePaused) { +bool CBSound::pause(bool freezePaused) { if (_sound) { _soundPaused = true; if (freezePaused) _sound->_freezePaused = true; @@ -139,7 +139,7 @@ ERRORCODE CBSound::pause(bool freezePaused) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSound::resume() { +bool CBSound::resume() { if (_sound && _soundPaused) { _soundPaused = false; return _sound->resume(); @@ -148,7 +148,7 @@ ERRORCODE CBSound::resume() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSound::persist(CBPersistMgr *persistMgr) { +bool CBSound::persist(CBPersistMgr *persistMgr) { if (persistMgr->_saving && _sound) { _soundPlaying = _sound->isPlaying(); _soundLooping = _sound->_looping; @@ -194,10 +194,10 @@ bool CBSound::isPaused() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSound::setPositionTime(uint32 time) { +bool CBSound::setPositionTime(uint32 time) { if (!_sound) return STATUS_FAILED; _soundPosition = time; - ERRORCODE ret = _sound->setPosition(_soundPosition); + bool ret = _sound->setPosition(_soundPosition); if (_sound->isPlaying()) _soundPosition = 0; return ret; @@ -214,21 +214,21 @@ uint32 CBSound::getPositionTime() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSound::setVolumePercent(int percent) { +bool CBSound::setVolumePercent(int percent) { if (!_sound) return STATUS_FAILED; else return _sound->setPrivateVolume(percent * 255 / 100); } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSound::setVolume(int volume) { +bool CBSound::setVolume(int volume) { if (!_sound) return STATUS_FAILED; else return _sound->setPrivateVolume(volume); } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSound::setPrivateVolume(int volume) { +bool CBSound::setPrivateVolume(int volume) { if (!_sound) return STATUS_FAILED; else return _sound->_privateVolume = volume; @@ -249,7 +249,7 @@ int CBSound::getVolume() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSound::setLoopStart(uint32 pos) { +bool CBSound::setLoopStart(uint32 pos) { if (!_sound) return STATUS_FAILED; else { @@ -259,7 +259,7 @@ ERRORCODE CBSound::setLoopStart(uint32 pos) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSound::setPan(float pan) { +bool CBSound::setPan(float pan) { if (_sound) return _sound->setPan(pan); else return STATUS_FAILED; @@ -267,12 +267,12 @@ ERRORCODE CBSound::setPan(float pan) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSound::ApplyFX(TSFXType type, float param1, float param2, float param3, float param4) { +bool CBSound::ApplyFX(TSFXType type, float param1, float param2, float param3, float param4) { if (!_sound) return STATUS_OK; if (type != _sFXType || param1 != _sFXParam1 || param2 != _sFXParam2 || param3 != _sFXParam3 || param4 != _sFXParam4) { - ERRORCODE ret = _sound->applyFX(type, param1, param2, param3, param4); + bool ret = _sound->applyFX(type, param1, param2, param3, param4); _sFXType = type; _sFXParam1 = param1; diff --git a/engines/wintermute/Base/BSound.h b/engines/wintermute/Base/BSound.h index 3dc9dadf68..697c49600d 100644 --- a/engines/wintermute/Base/BSound.h +++ b/engines/wintermute/Base/BSound.h @@ -39,16 +39,16 @@ namespace WinterMute { class CBSoundBuffer; class CBSound : public CBBase { public: - ERRORCODE setPan(float pan); + bool setPan(float pan); int _soundPrivateVolume; int getVolume(); int getVolumePercent(); - ERRORCODE setVolumePercent(int percent); - ERRORCODE setVolume(int volume); - ERRORCODE setPrivateVolume(int volume); - ERRORCODE setLoopStart(uint32 pos); + bool setVolumePercent(int percent); + bool setVolume(int volume); + bool setPrivateVolume(int volume); + bool setLoopStart(uint32 pos); uint32 getPositionTime(); - ERRORCODE setPositionTime(uint32 time); + bool setPositionTime(uint32 time); bool _soundPaused; bool _soundFreezePaused; bool isPlaying(); @@ -58,20 +58,20 @@ public: uint32 _soundLoopStart; uint32 _soundPosition; DECLARE_PERSISTENT(CBSound, CBBase) - ERRORCODE resume(); - ERRORCODE pause(bool freezePaused = false); - ERRORCODE stop(); - ERRORCODE play(bool looping = false); + bool resume(); + bool pause(bool freezePaused = false); + bool stop(); + bool play(bool looping = false); uint32 getLength(); bool _soundStreamed; Audio::Mixer::SoundType _soundType; char *_soundFilename; - ERRORCODE setSoundSimple(); - ERRORCODE setSound(const char *filename, Audio::Mixer::SoundType type = Audio::Mixer::kSFXSoundType, bool streamed = false); + bool setSoundSimple(); + bool setSound(const char *filename, Audio::Mixer::SoundType type = Audio::Mixer::kSFXSoundType, bool streamed = false); CBSound(CBGame *inGame); virtual ~CBSound(); - ERRORCODE ApplyFX(TSFXType type = SFX_NONE, float param1 = 0, float param2 = 0, float param3 = 0, float param4 = 0); + bool 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 77ff119e7b..0fc9a9158c 100644 --- a/engines/wintermute/Base/BSoundBuffer.cpp +++ b/engines/wintermute/Base/BSoundBuffer.cpp @@ -94,7 +94,7 @@ void CBSoundBuffer::setStreaming(bool Streamed, uint32 NumBlocks, uint32 BlockSi ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSoundBuffer::loadFromFile(const char *filename, bool forceReload) { +bool CBSoundBuffer::loadFromFile(const char *filename, bool forceReload) { warning("BSoundBuffer::LoadFromFile(%s,%d)", filename, forceReload); #if 0 if (_stream) { @@ -151,7 +151,7 @@ ERRORCODE CBSoundBuffer::loadFromFile(const char *filename, bool forceReload) { CBUtils::setString(&_filename, filename); /* - ERRORCODE res; + bool res; bool NewlyCreated = false; if(!_soundBuffer || ForceReload || _streamed){ @@ -196,7 +196,7 @@ ERRORCODE CBSoundBuffer::loadFromFile(const char *filename, bool forceReload) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSoundBuffer::play(bool looping, uint32 startSample) { +bool CBSoundBuffer::play(bool looping, uint32 startSample) { if (startSample != 0) { warning("BSoundBuffer::Play - Should start playback at %d, but currently we don't", startSample); } @@ -233,7 +233,7 @@ void CBSoundBuffer::setLooping(bool looping) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSoundBuffer::resume() { +bool CBSoundBuffer::resume() { if (_stream && _handle) { g_system->getMixer()->pauseHandle(*_handle, false); } @@ -242,7 +242,7 @@ ERRORCODE CBSoundBuffer::resume() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSoundBuffer::stop() { +bool CBSoundBuffer::stop() { if (_stream && _handle) { g_system->getMixer()->stopHandle(*_handle); } @@ -251,7 +251,7 @@ ERRORCODE CBSoundBuffer::stop() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSoundBuffer::pause() { +bool CBSoundBuffer::pause() { if (_stream && _handle) { g_system->getMixer()->pauseHandle(*_handle, true); } @@ -280,7 +280,7 @@ void CBSoundBuffer::updateVolume() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSoundBuffer::setVolume(int volume) { +bool CBSoundBuffer::setVolume(int volume) { _volume = volume * _gameRef->_soundMgr->getMasterVolume() / 255; if (_stream && _handle) { byte vol = (byte)(_volume); @@ -291,7 +291,7 @@ ERRORCODE CBSoundBuffer::setVolume(int volume) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSoundBuffer::setPrivateVolume(int volume) { +bool CBSoundBuffer::setPrivateVolume(int volume) { _privateVolume = volume; return setVolume(_privateVolume); } @@ -318,7 +318,7 @@ uint32 CBSoundBuffer::getPosition() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSoundBuffer::setPosition(uint32 pos) { +bool CBSoundBuffer::setPosition(uint32 pos) { warning("CBSoundBuffer::SetPosition - not implemented yet"); #if 0 if (_stream) { @@ -330,7 +330,7 @@ ERRORCODE CBSoundBuffer::setPosition(uint32 pos) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSoundBuffer::setLoopStart(uint32 pos) { +bool CBSoundBuffer::setLoopStart(uint32 pos) { _loopStart = pos; #if 0 if (_stream) { @@ -357,7 +357,7 @@ void CBSoundBuffer::LoopSyncProc(HSYNC handle, uint32 channel, uint32 data, void } #endif ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSoundBuffer::setPan(float pan) { +bool CBSoundBuffer::setPan(float pan) { if (_handle) { g_system->getMixer()->setChannelBalance(*_handle, (int8)(pan * 127)); } @@ -365,7 +365,7 @@ ERRORCODE CBSoundBuffer::setPan(float pan) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSoundBuffer::applyFX(TSFXType type, float param1, float param2, float param3, float param4) { +bool CBSoundBuffer::applyFX(TSFXType type, float param1, float param2, float param3, float param4) { warning("CBSoundBuffer::ApplyFX - not implemented yet"); switch (type) { case SFX_ECHO: diff --git a/engines/wintermute/Base/BSoundBuffer.h b/engines/wintermute/Base/BSoundBuffer.h index f65ea1d40f..632c53008a 100644 --- a/engines/wintermute/Base/BSoundBuffer.h +++ b/engines/wintermute/Base/BSoundBuffer.h @@ -49,33 +49,33 @@ public: virtual ~CBSoundBuffer(); - ERRORCODE pause(); - ERRORCODE play(bool looping = false, uint32 startSample = 0); - ERRORCODE resume(); - ERRORCODE stop(); + bool pause(); + bool play(bool looping = false, uint32 startSample = 0); + bool resume(); + bool stop(); bool isPlaying(); void setLooping(bool looping); uint32 getPosition(); - ERRORCODE setPosition(uint32 pos); + bool setPosition(uint32 pos); uint32 getLength(); - ERRORCODE setLoopStart(uint32 pos); + bool setLoopStart(uint32 pos); uint32 getLoopStart() const { return _loopStart; } - ERRORCODE setPan(float pan); - ERRORCODE setPrivateVolume(int colume); - ERRORCODE setVolume(int colume); + bool setPan(float pan); + bool setPrivateVolume(int colume); + bool setVolume(int colume); void updateVolume(); void setType(Audio::Mixer::SoundType Type); - ERRORCODE loadFromFile(const char *filename, bool forceReload = false); + bool loadFromFile(const char *filename, bool forceReload = false); void setStreaming(bool streamed, uint32 numBlocks = 0, uint32 blockSize = 0); - ERRORCODE applyFX(TSFXType type, float param1, float param2, float param3, float param4); + bool 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 02fd146701..98a5e69d7b 100644 --- a/engines/wintermute/Base/BSoundMgr.cpp +++ b/engines/wintermute/Base/BSoundMgr.cpp @@ -61,7 +61,7 @@ CBSoundMgr::~CBSoundMgr() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSoundMgr::cleanup() { +bool CBSoundMgr::cleanup() { for (int i = 0; i < _sounds.getSize(); i++) delete _sounds[i]; _sounds.removeAll(); @@ -79,7 +79,7 @@ void CBSoundMgr::saveSettings() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSoundMgr::initialize() { +bool CBSoundMgr::initialize() { _soundAvailable = false; if (!g_system->getMixer()->isReady()) { @@ -93,7 +93,7 @@ ERRORCODE CBSoundMgr::initialize() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSoundMgr::initLoop() { +bool CBSoundMgr::initLoop() { if (!_soundAvailable) return STATUS_OK; #if 0 @@ -130,7 +130,7 @@ CBSoundBuffer *CBSoundMgr::addSound(const char *filename, Audio::Mixer::SoundTyp sound->setType(type); - ERRORCODE res = sound->loadFromFile(filename); + bool res = sound->loadFromFile(filename); if (DID_FAIL(res)) { _gameRef->LOG(res, "Error loading sound '%s'", filename); delete sound; @@ -149,7 +149,7 @@ CBSoundBuffer *CBSoundMgr::addSound(const char *filename, Audio::Mixer::SoundTyp } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSoundMgr::addSound(CBSoundBuffer *sound, Audio::Mixer::SoundType type) { +bool CBSoundMgr::addSound(CBSoundBuffer *sound, Audio::Mixer::SoundType type) { if (!sound) return STATUS_FAILED; @@ -163,7 +163,7 @@ ERRORCODE CBSoundMgr::addSound(CBSoundBuffer *sound, Audio::Mixer::SoundType typ } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSoundMgr::removeSound(CBSoundBuffer *sound) { +bool CBSoundMgr::removeSound(CBSoundBuffer *sound) { for (int i = 0; i < _sounds.getSize(); i++) { if (_sounds[i] == sound) { delete _sounds[i]; @@ -177,7 +177,7 @@ ERRORCODE CBSoundMgr::removeSound(CBSoundBuffer *sound) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSoundMgr::setVolume(Audio::Mixer::SoundType type, int volume) { +bool CBSoundMgr::setVolume(Audio::Mixer::SoundType type, int volume) { if (!_soundAvailable) return STATUS_OK; @@ -200,7 +200,7 @@ ERRORCODE CBSoundMgr::setVolume(Audio::Mixer::SoundType type, int volume) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSoundMgr::setVolumePercent(Audio::Mixer::SoundType type, byte percent) { +bool CBSoundMgr::setVolumePercent(Audio::Mixer::SoundType type, byte percent) { return setVolume(type, percent * 255 / 100); } @@ -225,7 +225,7 @@ byte CBSoundMgr::getVolumePercent(Audio::Mixer::SoundType type) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSoundMgr::setMasterVolume(byte value) { +bool CBSoundMgr::setMasterVolume(byte value) { _volumeMaster = value; for (int i = 0; i < _sounds.getSize(); i++) { _sounds[i]->updateVolume(); @@ -234,7 +234,7 @@ ERRORCODE CBSoundMgr::setMasterVolume(byte value) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSoundMgr::setMasterVolumePercent(byte percent) { +bool CBSoundMgr::setMasterVolumePercent(byte percent) { setMasterVolume(percent * 255 / 100); return STATUS_OK; } @@ -252,7 +252,7 @@ byte CBSoundMgr::getMasterVolume() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSoundMgr::pauseAll(bool includingMusic) { +bool CBSoundMgr::pauseAll(bool includingMusic) { for (int i = 0; i < _sounds.getSize(); i++) { if (_sounds[i]->isPlaying() && (_sounds[i]->_type != Audio::Mixer::kMusicSoundType || includingMusic)) { @@ -266,7 +266,7 @@ ERRORCODE CBSoundMgr::pauseAll(bool includingMusic) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSoundMgr::resumeAll() { +bool CBSoundMgr::resumeAll() { for (int i = 0; i < _sounds.getSize(); i++) { if (_sounds[i]->_freezePaused) { diff --git a/engines/wintermute/Base/BSoundMgr.h b/engines/wintermute/Base/BSoundMgr.h index 1ae7b7709a..13e3957fce 100644 --- a/engines/wintermute/Base/BSoundMgr.h +++ b/engines/wintermute/Base/BSoundMgr.h @@ -38,24 +38,24 @@ class CBSoundBuffer; class CBSoundMgr : public CBBase { public: float posToPan(int x, int y); - ERRORCODE resumeAll(); - ERRORCODE pauseAll(bool includingMusic = true); - ERRORCODE cleanup(); + bool resumeAll(); + bool pauseAll(bool includingMusic = true); + bool cleanup(); //DECLARE_PERSISTENT(CBSoundMgr, CBBase); byte getMasterVolumePercent(); byte getMasterVolume(); - ERRORCODE setMasterVolume(byte percent); - ERRORCODE setMasterVolumePercent(byte percent); + bool setMasterVolume(byte percent); + bool setMasterVolumePercent(byte percent); byte getVolumePercent(Audio::Mixer::SoundType type); - ERRORCODE setVolumePercent(Audio::Mixer::SoundType type, byte percent); - ERRORCODE setVolume(Audio::Mixer::SoundType type, int volume); + bool setVolumePercent(Audio::Mixer::SoundType type, byte percent); + bool setVolume(Audio::Mixer::SoundType type, int volume); uint32 _volumeOriginal; int _volumeMaster; - ERRORCODE removeSound(CBSoundBuffer *sound); + bool removeSound(CBSoundBuffer *sound); CBSoundBuffer *addSound(const char *filename, Audio::Mixer::SoundType type = Audio::Mixer::kSFXSoundType, bool streamed = false); - ERRORCODE addSound(CBSoundBuffer *sound, Audio::Mixer::SoundType type = Audio::Mixer::kSFXSoundType); - ERRORCODE initLoop(); - ERRORCODE initialize(); + bool addSound(CBSoundBuffer *sound, Audio::Mixer::SoundType type = Audio::Mixer::kSFXSoundType); + bool initLoop(); + bool initialize(); bool _soundAvailable; CBSoundMgr(CBGame *inGame); virtual ~CBSoundMgr(); diff --git a/engines/wintermute/Base/BSprite.cpp b/engines/wintermute/Base/BSprite.cpp index 2e6787d27b..1abea36c6b 100644 --- a/engines/wintermute/Base/BSprite.cpp +++ b/engines/wintermute/Base/BSprite.cpp @@ -102,7 +102,7 @@ void CBSprite::cleanup() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSprite::draw(int x, int y, CBObject *registerOwner, float zoomX, float zoomY, uint32 alpha) { +bool CBSprite::draw(int x, int y, CBObject *registerOwner, float zoomX, float zoomY, uint32 alpha) { GetCurrentFrame(zoomX, zoomY); if (_currentFrame < 0 || _currentFrame >= _frames.getSize()) return STATUS_OK; @@ -122,7 +122,7 @@ ERRORCODE CBSprite::draw(int x, int y, CBObject *registerOwner, float zoomX, flo ////////////////////////////////////////////////////////////////////// -ERRORCODE CBSprite::loadFile(const char *filename, int lifeTime, TSpriteCacheType cacheType) { +bool CBSprite::loadFile(const char *filename, int lifeTime, TSpriteCacheType cacheType) { Common::SeekableReadStream *file = _gameRef->_fileManager->openFile(filename); if (!file) { _gameRef->LOG(0, "CBSprite::LoadFile failed for file '%s'", filename); @@ -133,7 +133,7 @@ ERRORCODE CBSprite::loadFile(const char *filename, int lifeTime, TSpriteCacheTyp file = NULL; } - ERRORCODE ret; + bool 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")) { @@ -187,7 +187,7 @@ TOKEN_DEF(EDITOR_BG_ALPHA) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////// -ERRORCODE CBSprite::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteCacheType cacheType) { +bool CBSprite::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteCacheType cacheType) { TOKEN_TABLE_START(commands) TOKEN_TABLE(CONTINUOUS) TOKEN_TABLE(SPRITE) @@ -383,7 +383,7 @@ bool CBSprite::GetCurrentFrame(float zoomX, float zoomY) { ////////////////////////////////////////////////////////////////////// -ERRORCODE CBSprite::display(int X, int Y, CBObject *Register, float ZoomX, float ZoomY, uint32 Alpha, float Rotate, TSpriteBlendMode BlendMode) { +bool 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... @@ -428,7 +428,7 @@ bool CBSprite::getBoundingRect(Rect32 *rect, int x, int y, float scaleX, float s } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSprite::saveAsText(CBDynBuffer *buffer, int indent) { +bool 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"); @@ -472,7 +472,7 @@ ERRORCODE CBSprite::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSprite::persist(CBPersistMgr *persistMgr) { +bool CBSprite::persist(CBPersistMgr *persistMgr) { CBScriptHolder::persist(persistMgr); persistMgr->transfer(TMEMBER(_canBreak)); @@ -507,7 +507,7 @@ ERRORCODE CBSprite::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // GetFrame ////////////////////////////////////////////////////////////////////////// @@ -707,7 +707,7 @@ CScValue *CBSprite::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSprite::scSetProperty(const char *name, CScValue *value) { +bool CBSprite::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// // CurrentFrame ////////////////////////////////////////////////////////////////////////// @@ -747,7 +747,7 @@ const char *CBSprite::scToString() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSprite::killAllSounds() { +bool CBSprite::killAllSounds() { for (int i = 0; i < _frames.getSize(); i++) { if (_frames[i]->_sound) _frames[i]->_sound->stop(); diff --git a/engines/wintermute/Base/BSprite.h b/engines/wintermute/Base/BSprite.h index bf40bbc6c6..30698b62c1 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: - ERRORCODE killAllSounds(); + bool killAllSounds(); CBSurface *getSurface(); char *_editorBgFile; int _editorBgOffsetX; @@ -56,7 +56,7 @@ public: bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = 100, float scaleY = 100); int _moveY; int _moveX; - 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 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; - 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); + bool loadBuffer(byte *buffer, bool compete = true, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL); + bool loadFile(const char *filename, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL); uint32 _lastFrameTime; - ERRORCODE draw(int x, int y, CBObject *Register = NULL, float zoomX = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF); + bool draw(int x, int y, CBObject *Register = NULL, float zoomX = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF); bool _looping; int _currentFrame; - ERRORCODE addFrame(const char *filename, uint32 delay = 0, int hotspotX = 0, int hotspotY = 0, Rect32 *rect = NULL); + bool addFrame(const char *filename, uint32 delay = 0, int hotspotX = 0, int hotspotY = 0, Rect32 *rect = NULL); CBSprite(CBGame *inGame, CBObject *owner = NULL); virtual ~CBSprite(); CBArray _frames; - ERRORCODE saveAsText(CBDynBuffer *buffer, int indent); + bool saveAsText(CBDynBuffer *buffer, int indent); // scripting interface virtual CScValue *scGetProperty(const char *name); - virtual ERRORCODE scSetProperty(const char *name, CScValue *value); - virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual bool scSetProperty(const char *name, CScValue *value); + virtual bool 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 e2cbec3691..f9d4094004 100644 --- a/engines/wintermute/Base/BStringTable.cpp +++ b/engines/wintermute/Base/BStringTable.cpp @@ -50,7 +50,7 @@ CBStringTable::~CBStringTable() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBStringTable::addString(const char *key, const char *val, bool reportDuplicities) { +bool 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) { @@ -169,7 +169,7 @@ const char *CBStringTable::expandStatic(const char *string, bool forceExpand) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBStringTable::loadFile(const char *filename, bool clearOld) { +bool CBStringTable::loadFile(const char *filename, bool clearOld) { _gameRef->LOG(0, "Loading string table..."); if (clearOld) _strings.clear(); diff --git a/engines/wintermute/Base/BStringTable.h b/engines/wintermute/Base/BStringTable.h index 94547ffbfc..4bdbcdc203 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); - ERRORCODE loadFile(const char *filename, bool deleteAll = true); + bool loadFile(const char *filename, bool deleteAll = true); void expand(char **str, bool forceExpand = false); - ERRORCODE addString(const char *key, const char *val, bool reportDuplicities = true); + bool addString(const char *key, const char *val, bool reportDuplicities = true); CBStringTable(CBGame *inGame); virtual ~CBStringTable(); Common::HashMap _strings; diff --git a/engines/wintermute/Base/BSubFrame.cpp b/engines/wintermute/Base/BSubFrame.cpp index 62bf0d9f87..fe6695c7c2 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 ////////////////////////////////////////////////////////////////////// -ERRORCODE CBSubFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) { +bool CBSubFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) { TOKEN_TABLE_START(commands) TOKEN_TABLE(IMAGE) TOKEN_TABLE(TRANSPARENT) @@ -204,7 +204,7 @@ ERRORCODE CBSubFrame::loadBuffer(byte *buffer, int lifeTime, bool keepLoaded) { ////////////////////////////////////////////////////////////////////// -ERRORCODE CBSubFrame::draw(int x, int y, CBObject *registerOwner, float zoomX, float zoomY, bool precise, uint32 alpha, float rotate, TSpriteBlendMode blendMode) { +bool 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) { @@ -216,7 +216,7 @@ ERRORCODE CBSubFrame::draw(int x, int y, CBObject *registerOwner, float zoomX, f } if (_gameRef->_suspendedRendering) return STATUS_OK; - ERRORCODE res; + bool 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(Rect32 *rect, int x, int y, float scaleX, float ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSubFrame::saveAsText(CBDynBuffer *buffer, int indent, bool complete) { +bool CBSubFrame::saveAsText(CBDynBuffer *buffer, int indent, bool complete) { if (complete) buffer->putTextIndent(indent, "SUBFRAME {\n"); @@ -310,7 +310,7 @@ void CBSubFrame::setDefaultRect() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSubFrame::persist(CBPersistMgr *persistMgr) { +bool CBSubFrame::persist(CBPersistMgr *persistMgr) { CBScriptable::persist(persistMgr); @@ -342,7 +342,7 @@ ERRORCODE CBSubFrame::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSubFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CBSubFrame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // GetImage @@ -473,7 +473,7 @@ CScValue *CBSubFrame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSubFrame::scSetProperty(const char *name, CScValue *value) { +bool CBSubFrame::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// // AlphaColor ////////////////////////////////////////////////////////////////////////// @@ -549,7 +549,7 @@ const char *CBSubFrame::scToString() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSubFrame::setSurface(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) { +bool CBSubFrame::setSurface(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) { if (_surface) { _gameRef->_surfaceStorage->removeSurface(_surface); _surface = NULL; @@ -576,7 +576,7 @@ ERRORCODE CBSubFrame::setSurface(const char *filename, bool defaultCK, byte ckRe ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSubFrame::setSurfaceSimple() { +bool CBSubFrame::setSurfaceSimple() { if (!_surfaceFilename) { _surface = NULL; return STATUS_OK; diff --git a/engines/wintermute/Base/BSubFrame.h b/engines/wintermute/Base/BSubFrame.h index 46ee948e64..5ff000ea2f 100644 --- a/engines/wintermute/Base/BSubFrame.h +++ b/engines/wintermute/Base/BSubFrame.h @@ -41,18 +41,18 @@ public: bool _mirrorX; bool _mirrorY; bool _decoration; - 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(); + bool setSurface(const char *filename, bool defaultCK = true, byte ckRed = 0, byte ckGreen = 0, byte ckBlue = 0, int lifeTime = -1, bool keepLoaded = false); + bool setSurfaceSimple(); DECLARE_PERSISTENT(CBSubFrame, CBScriptable) void setDefaultRect(); uint32 _transparent; - ERRORCODE saveAsText(CBDynBuffer *buffer, int indent) { return saveAsText(buffer, indent, true); } - ERRORCODE saveAsText(CBDynBuffer *buffer, int indent, bool complete); + bool saveAsText(CBDynBuffer *buffer, int indent) { return saveAsText(buffer, indent, true); } + bool saveAsText(CBDynBuffer *buffer, int indent, bool complete); bool _editorSelected; CBSubFrame(CBGame *inGame); virtual ~CBSubFrame(); - 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 loadBuffer(byte *buffer, int lifeTime, bool keepLoaded); + bool 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(Rect32 *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 ERRORCODE scSetProperty(const char *name, CScValue *value); - virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual bool scSetProperty(const char *name, CScValue *value); + virtual bool 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 8a6d2b2f1d..3ba2a773a9 100644 --- a/engines/wintermute/Base/BSurface.cpp +++ b/engines/wintermute/Base/BSurface.cpp @@ -59,13 +59,13 @@ CBSurface::~CBSurface() { ////////////////////////////////////////////////////////////////////// -ERRORCODE CBSurface::create(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) { +bool CBSurface::create(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////// -ERRORCODE CBSurface::restore() { +bool CBSurface::restore() { return STATUS_FAILED; } @@ -75,40 +75,40 @@ bool CBSurface::isTransparentAt(int x, int y) { } ////////////////////////////////////////////////////////////////////// -ERRORCODE CBSurface::displayHalfTrans(int x, int y, Rect32 rect) { +bool CBSurface::displayHalfTrans(int x, int y, Rect32 rect) { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSurface::displayTransform(int x, int y, int hotX, int hotY, Rect32 rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { +bool CBSurface::displayTransform(int x, int y, int hotX, int hotY, Rect32 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); } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSurface::create(int Width, int Height) { +bool CBSurface::create(int Width, int Height) { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSurface::startPixelOp() { +bool CBSurface::startPixelOp() { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSurface::endPixelOp() { +bool CBSurface::endPixelOp() { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSurface::getPixel(int x, int y, byte *r, byte *g, byte *b, byte *a) { +bool CBSurface::getPixel(int x, int y, byte *r, byte *g, byte *b, byte *a) { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSurface::putPixel(int x, int y, byte r, byte g, byte b, int a) { +bool CBSurface::putPixel(int x, int y, byte r, byte g, byte b, int a) { return STATUS_FAILED; } @@ -126,14 +126,14 @@ bool CBSurface::isTransparentAtLite(int x, int y) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSurface::invalidate() { +bool CBSurface::invalidate() { return STATUS_FAILED; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSurface::prepareToDraw() { +bool CBSurface::prepareToDraw() { _lastUsedTime = _gameRef->_liveTimer; if (!_valid) { diff --git a/engines/wintermute/Base/BSurface.h b/engines/wintermute/Base/BSurface.h index fe00348488..c31ad5643f 100644 --- a/engines/wintermute/Base/BSurface.h +++ b/engines/wintermute/Base/BSurface.h @@ -37,8 +37,8 @@ namespace WinterMute { class CBSurface: public CBBase { public: - virtual ERRORCODE invalidate(); - virtual ERRORCODE prepareToDraw(); + virtual bool invalidate(); + virtual bool prepareToDraw(); bool _ckDefault; byte _ckRed; byte _ckGreen; @@ -53,25 +53,25 @@ public: CBSurface(CBGame *inGame); virtual ~CBSurface(); - virtual ERRORCODE displayHalfTrans(int x, int y, Rect32 rect); + virtual bool displayHalfTrans(int x, int y, Rect32 rect); virtual bool isTransparentAt(int x, int y); - virtual ERRORCODE displayTransZoom(int x, int y, Rect32 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, Rect32 rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0; - virtual ERRORCODE displayTransOffset(int x, int y, Rect32 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, Rect32 rect, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool MirrorY = false) = 0; - virtual ERRORCODE displayZoom(int x, int y, Rect32 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, Rect32 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) { + virtual bool displayTransZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0; + virtual bool displayTrans(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0; + virtual bool displayTransOffset(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0) = 0; + virtual bool display(int x, int y, Rect32 rect, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool MirrorY = false) = 0; + virtual bool displayZoom(int x, int y, Rect32 rect, float ZoomX, float ZoomY, uint32 alpha = 0xFFFFFFFF, bool transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0; + virtual bool displayTransform(int x, int y, int hotX, int hotY, Rect32 rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) = 0; + virtual bool restore(); + virtual bool create(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime = -1, bool keepLoaded = false) = 0; + virtual bool create(int Width, int Height); + virtual bool putSurface(const Graphics::Surface &surface, bool hasAlpha = false) { return STATUS_FAILED; } - 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 putPixel(int x, int y, byte r, byte g, byte b, int a = -1); + virtual bool 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 ERRORCODE startPixelOp(); - virtual ERRORCODE endPixelOp(); + virtual bool startPixelOp(); + virtual bool endPixelOp(); virtual bool isTransparentAtLite(int x, int y); void setSize(int width, int height); diff --git a/engines/wintermute/Base/BSurfaceSDL.cpp b/engines/wintermute/Base/BSurfaceSDL.cpp index 58a09dbe56..c8b22511fa 100644 --- a/engines/wintermute/Base/BSurfaceSDL.cpp +++ b/engines/wintermute/Base/BSurfaceSDL.cpp @@ -91,7 +91,7 @@ bool hasTransparency(Graphics::Surface *surf) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSurfaceSDL::create(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) { +bool CBSurfaceSDL::create(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime, bool keepLoaded) { /* CBRenderSDL *renderer = static_cast(_gameRef->_renderer); */ _filename = filename; // const Graphics::Surface *surface = image->getSurface(); @@ -273,7 +273,7 @@ uint32 CBSurfaceSDL::getPixel(Graphics::Surface *surface, int x, int y) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSurfaceSDL::create(int width, int height) { +bool CBSurfaceSDL::create(int width, int height) { warning("SurfaceSDL::Create not ported yet"); //TODO #if 0 CBRenderSDL *renderer = static_cast(_gameRef->_renderer); @@ -290,7 +290,7 @@ ERRORCODE CBSurfaceSDL::create(int width, int height) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSurfaceSDL::createFromSDLSurface(Graphics::Surface *surface) { +bool CBSurfaceSDL::createFromSDLSurface(Graphics::Surface *surface) { warning("CBSurfaceSDL::CreateFromSDLSurface not ported yet"); //TODO #if 0 CBRenderSDL *renderer = static_cast(_gameRef->_renderer); @@ -387,7 +387,7 @@ bool CBSurfaceSDL::isTransparentAtLite(int x, int y) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSurfaceSDL::startPixelOp() { +bool CBSurfaceSDL::startPixelOp() { //SDL_LockTexture(_texture, NULL, &_lockPixels, &_lockPitch); // Any pixel-op makes the caching useless: CBRenderSDL *renderer = static_cast(_gameRef->_renderer); @@ -396,47 +396,47 @@ ERRORCODE CBSurfaceSDL::startPixelOp() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSurfaceSDL::endPixelOp() { +bool CBSurfaceSDL::endPixelOp() { //SDL_UnlockTexture(_texture); return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSurfaceSDL::display(int x, int y, Rect32 rect, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { +bool CBSurfaceSDL::display(int x, int y, Rect32 rect, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { return drawSprite(x, y, &rect, 100, 100, 0xFFFFFFFF, true, blendMode, mirrorX, mirrorY); } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSurfaceSDL::displayTrans(int x, int y, Rect32 rect, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { +bool CBSurfaceSDL::displayTrans(int x, int y, Rect32 rect, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { return drawSprite(x, y, &rect, 100, 100, alpha, false, blendMode, mirrorX, mirrorY); } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSurfaceSDL::displayTransOffset(int x, int y, Rect32 rect, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX, int offsetY) { +bool CBSurfaceSDL::displayTransOffset(int x, int y, Rect32 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); } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSurfaceSDL::displayTransZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { +bool CBSurfaceSDL::displayTransZoom(int x, int y, Rect32 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); } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSurfaceSDL::displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha, bool Transparent, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { +bool CBSurfaceSDL::displayZoom(int x, int y, Rect32 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); } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSurfaceSDL::displayTransform(int x, int y, int hotX, int hotY, Rect32 rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { +bool CBSurfaceSDL::displayTransform(int x, int y, int hotX, int hotY, Rect32 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); } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSurfaceSDL::drawSprite(int x, int y, Rect32 *rect, float zoomX, float zoomY, uint32 alpha, bool alphaDisable, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX, int offsetY) { +bool CBSurfaceSDL::drawSprite(int x, int y, Rect32 *rect, float zoomX, float zoomY, uint32 alpha, bool alphaDisable, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX, int offsetY) { CBRenderSDL *renderer = static_cast(_gameRef->_renderer); if (!_loaded) { @@ -519,7 +519,7 @@ ERRORCODE CBSurfaceSDL::drawSprite(int x, int y, Rect32 *rect, float zoomX, floa return STATUS_OK; } -ERRORCODE CBSurfaceSDL::putSurface(const Graphics::Surface &surface, bool hasAlpha) { +bool CBSurfaceSDL::putSurface(const Graphics::Surface &surface, bool hasAlpha) { _loaded = true; _surface->copyFrom(surface); _hasAlpha = hasAlpha; diff --git a/engines/wintermute/Base/BSurfaceSDL.h b/engines/wintermute/Base/BSurfaceSDL.h index 289f75eaf3..fa70c97fdf 100644 --- a/engines/wintermute/Base/BSurfaceSDL.h +++ b/engines/wintermute/Base/BSurfaceSDL.h @@ -41,25 +41,25 @@ public: CBSurfaceSDL(CBGame *inGame); ~CBSurfaceSDL(); - 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); + bool create(const char *filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime = -1, bool keepLoaded = false); + bool create(int width, int height); - ERRORCODE createFromSDLSurface(Graphics::Surface *surface); //TODO: Rename function + bool createFromSDLSurface(Graphics::Surface *surface); //TODO: Rename function bool isTransparentAt(int x, int y); bool isTransparentAtLite(int x, int y); - ERRORCODE startPixelOp(); - ERRORCODE endPixelOp(); + bool startPixelOp(); + bool endPixelOp(); - ERRORCODE displayTransZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false); - ERRORCODE displayTrans(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false); - ERRORCODE displayTransOffset(int x, int y, Rect32 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, Rect32 rect, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false); - ERRORCODE displayZoom(int x, int y, Rect32 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, Rect32 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); + bool displayTransZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false); + bool displayTrans(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false); + bool displayTransOffset(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0); + bool display(int x, int y, Rect32 rect, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false); + bool displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, bool Transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false); + bool displayTransform(int x, int y, int hotX, int hotY, Rect32 Rect, float zoomX, float zoomY, uint32 alpha, float rotate, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false); + virtual bool 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);*/ @@ -86,7 +86,7 @@ private: Graphics::Surface *_surface; bool _loaded; void finishLoad(); - ERRORCODE drawSprite(int x, int y, Rect32 *rect, float zoomX, float zoomY, uint32 alpha, bool alphaDisable, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX = 0, int offsetY = 0); + bool drawSprite(int x, int y, Rect32 *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 0ffeb7a81c..34721c40f6 100644 --- a/engines/wintermute/Base/BSurfaceStorage.cpp +++ b/engines/wintermute/Base/BSurfaceStorage.cpp @@ -51,7 +51,7 @@ CBSurfaceStorage::~CBSurfaceStorage() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSurfaceStorage::cleanup(bool warn) { +bool CBSurfaceStorage::cleanup(bool warn) { for (int i = 0; i < _surfaces.getSize(); i++) { if (warn) _gameRef->LOG(0, "CBSurfaceStorage warning: purging surface '%s', usage:%d", _surfaces[i]->getFileName(), _surfaces[i]->_referenceCount); delete _surfaces[i]; @@ -63,7 +63,7 @@ ERRORCODE CBSurfaceStorage::cleanup(bool warn) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSurfaceStorage::initLoop() { +bool CBSurfaceStorage::initLoop() { if (_gameRef->_smartCache && _gameRef->_liveTimer - _lastCleanupTime >= _gameRef->_surfaceGCCycleTime) { _lastCleanupTime = _gameRef->_liveTimer; sortSurfaces(); @@ -81,7 +81,7 @@ ERRORCODE CBSurfaceStorage::initLoop() { ////////////////////////////////////////////////////////////////////// -ERRORCODE CBSurfaceStorage::removeSurface(CBSurface *surface) { +bool CBSurfaceStorage::removeSurface(CBSurface *surface) { for (int i = 0; i < _surfaces.getSize(); i++) { if (_surfaces[i] == surface) { _surfaces[i]->_referenceCount--; @@ -130,8 +130,8 @@ CBSurface *CBSurfaceStorage::addSurface(const char *filename, bool defaultCK, by ////////////////////////////////////////////////////////////////////// -ERRORCODE CBSurfaceStorage::restoreAll() { - ERRORCODE ret; +bool CBSurfaceStorage::restoreAll() { + bool ret; for (int i = 0; i < _surfaces.getSize(); i++) { ret = _surfaces[i]->restore(); if (ret != STATUS_OK) { @@ -145,7 +145,7 @@ ERRORCODE CBSurfaceStorage::restoreAll() { /* ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSurfaceStorage::persist(CBPersistMgr *persistMgr) +bool CBSurfaceStorage::persist(CBPersistMgr *persistMgr) { if(!persistMgr->_saving) cleanup(false); @@ -160,7 +160,7 @@ ERRORCODE CBSurfaceStorage::persist(CBPersistMgr *persistMgr) ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSurfaceStorage::sortSurfaces() { +bool CBSurfaceStorage::sortSurfaces() { qsort(_surfaces.getData(), _surfaces.getSize(), sizeof(CBSurface *), surfaceSortCB); return STATUS_OK; } diff --git a/engines/wintermute/Base/BSurfaceStorage.h b/engines/wintermute/Base/BSurfaceStorage.h index d93c82bf19..1e8074dc99 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; - ERRORCODE initLoop(); - ERRORCODE sortSurfaces(); + bool initLoop(); + bool sortSurfaces(); static int surfaceSortCB(const void *arg1, const void *arg2); - ERRORCODE cleanup(bool Warn = false); + bool cleanup(bool Warn = false); //DECLARE_PERSISTENT(CBSurfaceStorage, CBBase); - ERRORCODE restoreAll(); + bool restoreAll(); CBSurface *addSurface(const char *filename, bool defaultCK = true, byte ckRed = 0, byte ckGreen = 0, byte ckBlue = 0, int lifeTime = -1, bool keepLoaded = false); - ERRORCODE removeSurface(CBSurface *surface); + bool removeSurface(CBSurface *surface); CBSurfaceStorage(CBGame *inGame); virtual ~CBSurfaceStorage(); diff --git a/engines/wintermute/Base/BTransitionMgr.cpp b/engines/wintermute/Base/BTransitionMgr.cpp index 537fb0f2f5..81d80c40aa 100644 --- a/engines/wintermute/Base/BTransitionMgr.cpp +++ b/engines/wintermute/Base/BTransitionMgr.cpp @@ -58,7 +58,7 @@ bool CBTransitionMgr::isReady() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBTransitionMgr::start(TTransitionType type, bool nonInteractive) { +bool CBTransitionMgr::start(TTransitionType type, bool nonInteractive) { if (_state != TRANS_MGR_READY) return STATUS_OK; if (type == TRANSITION_NONE || type >= NUM_TRANSITION_TYPES) { @@ -83,7 +83,7 @@ ERRORCODE CBTransitionMgr::start(TTransitionType type, bool nonInteractive) { #define FADE_DURATION 200 ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBTransitionMgr::update() { +bool CBTransitionMgr::update() { if (isReady()) return STATUS_OK; if (!_started) { diff --git a/engines/wintermute/Base/BTransitionMgr.h b/engines/wintermute/Base/BTransitionMgr.h index 5999ac3391..8219afeb46 100644 --- a/engines/wintermute/Base/BTransitionMgr.h +++ b/engines/wintermute/Base/BTransitionMgr.h @@ -39,8 +39,8 @@ public: uint32 _lastTime; bool _origInteractive; bool _preserveInteractive; - ERRORCODE update(); - ERRORCODE start(TTransitionType type, bool nonInteractive = false); + bool update(); + bool 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 a245baf26d..8f0680dfb6 100644 --- a/engines/wintermute/Base/BViewport.cpp +++ b/engines/wintermute/Base/BViewport.cpp @@ -49,7 +49,7 @@ CBViewport::~CBViewport() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBViewport::persist(CBPersistMgr *persistMgr) { +bool CBViewport::persist(CBPersistMgr *persistMgr) { persistMgr->transfer(TMEMBER(_gameRef)); @@ -63,7 +63,7 @@ ERRORCODE CBViewport::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBViewport::setRect(int left, int top, int right, int bottom, bool noCheck) { +bool CBViewport::setRect(int left, int top, int right, int bottom, bool noCheck) { if (!noCheck) { left = MAX(left, 0); top = MAX(top, 0); diff --git a/engines/wintermute/Base/BViewport.h b/engines/wintermute/Base/BViewport.h index 83e89a6014..667d181dcd 100644 --- a/engines/wintermute/Base/BViewport.h +++ b/engines/wintermute/Base/BViewport.h @@ -39,7 +39,7 @@ public: int getHeight(); int getWidth(); Rect32 *getRect(); - ERRORCODE setRect(int left, int top, int right, int bottom, bool noCheck = false); + bool 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/file/BFile.h b/engines/wintermute/Base/file/BFile.h index 1ff3c109f8..cbdd0b1ff1 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 ERRORCODE seek(uint32 pos, int whence = SEEK_SET) = 0; - virtual ERRORCODE read(void *buffer, uint32 size) = 0; - virtual ERRORCODE close() = 0; - virtual ERRORCODE open(const Common::String &filename) = 0; + virtual bool seek(uint32 pos, int whence = SEEK_SET) = 0; + virtual bool read(void *buffer, uint32 size) = 0; + virtual bool close() = 0; + virtual bool 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 1784c1f53d..b61c2a586f 100644 --- a/engines/wintermute/Base/file/BSaveThumbFile.cpp +++ b/engines/wintermute/Base/file/BSaveThumbFile.cpp @@ -51,7 +51,7 @@ CBSaveThumbFile::~CBSaveThumbFile() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSaveThumbFile::open(const Common::String &filename) { +bool CBSaveThumbFile::open(const Common::String &filename) { close(); if (scumm_strnicmp(filename.c_str(), "savegame:", 9) != 0) return STATUS_FAILED; @@ -82,7 +82,7 @@ ERRORCODE CBSaveThumbFile::open(const Common::String &filename) { } _gameRef->_debugAbsolutePathWarning = true; - ERRORCODE res; + bool res; if (pm->_thumbnailDataSize != 0) { _data = new byte[pm->_thumbnailDataSize]; @@ -97,7 +97,7 @@ ERRORCODE CBSaveThumbFile::open(const Common::String &filename) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSaveThumbFile::close() { +bool CBSaveThumbFile::close() { delete[] _data; _data = NULL; @@ -109,7 +109,7 @@ ERRORCODE CBSaveThumbFile::close() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSaveThumbFile::read(void *buffer, uint32 size) { +bool CBSaveThumbFile::read(void *buffer, uint32 size) { if (!_data || _pos + size > _size) return STATUS_FAILED; memcpy(buffer, (byte *)_data + _pos, size); @@ -120,7 +120,7 @@ ERRORCODE CBSaveThumbFile::read(void *buffer, uint32 size) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBSaveThumbFile::seek(uint32 pos, int whence) { +bool CBSaveThumbFile::seek(uint32 pos, int whence) { if (!_data) return STATUS_FAILED; uint32 newPos = 0; diff --git a/engines/wintermute/Base/file/BSaveThumbFile.h b/engines/wintermute/Base/file/BSaveThumbFile.h index 7ec07824f9..777a4df903 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 ERRORCODE seek(uint32 pos, int whence = SEEK_SET); - virtual ERRORCODE read(void *buffer, uint32 size); - virtual ERRORCODE close(); - virtual ERRORCODE open(const Common::String &filename); + virtual bool seek(uint32 pos, int whence = SEEK_SET); + virtual bool read(void *buffer, uint32 size); + virtual bool close(); + virtual bool open(const Common::String &filename); private: byte *_data; }; diff --git a/engines/wintermute/Base/font/BFont.cpp b/engines/wintermute/Base/font/BFont.cpp index b910bdbd90..f797d49c5b 100644 --- a/engines/wintermute/Base/font/BFont.cpp +++ b/engines/wintermute/Base/font/BFont.cpp @@ -71,7 +71,7 @@ int CBFont::getTextWidth(byte *text, int maxLength) { /* ////////////////////////////////////////////////////////////////////// -ERRORCODE CBFont::loadFile(const char * Filename) +bool CBFont::loadFile(const char * Filename) { BYTE* Buffer = _gameRef->_fileManager->readWholeFile(filename); if(Buffer==NULL){ @@ -79,7 +79,7 @@ ERRORCODE CBFont::loadFile(const char * Filename) return STATUS_FAILED; } - ERRORCODE ret; + bool ret; _filename = new char [strlen(filename)+1]; strcpy(_filename, filename); @@ -96,7 +96,7 @@ TOKEN_DEF_START TOKEN_DEF (FONT) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////// -ERRORCODE CBFont::loadBuffer(byte * Buffer) +bool CBFont::loadBuffer(byte * Buffer) { TOKEN_TABLE_START(commands) TOKEN_TABLE (FONT) @@ -144,7 +144,7 @@ int CBFont::getLetterHeight() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFont::persist(CBPersistMgr *persistMgr) { +bool CBFont::persist(CBPersistMgr *persistMgr) { CBObject::persist(persistMgr); return STATUS_OK; diff --git a/engines/wintermute/Base/font/BFont.h b/engines/wintermute/Base/font/BFont.h index ac5a79299d..5fa9bf3c1c 100644 --- a/engines/wintermute/Base/font/BFont.h +++ b/engines/wintermute/Base/font/BFont.h @@ -51,8 +51,8 @@ public: static CBFont *createFromFile(CBGame *game, const char *filename); private: - //ERRORCODE loadBuffer(byte * Buffer); - //ERRORCODE loadFile(const char* Filename); + //bool loadBuffer(byte * Buffer); + //bool loadFile(const char* Filename); static bool isTrueType(CBGame *game, const char *filename); }; diff --git a/engines/wintermute/Base/font/BFontBitmap.cpp b/engines/wintermute/Base/font/BFontBitmap.cpp index 96a6387070..badf5ac646 100644 --- a/engines/wintermute/Base/font/BFontBitmap.cpp +++ b/engines/wintermute/Base/font/BFontBitmap.cpp @@ -243,14 +243,14 @@ void CBFontBitmap::drawChar(byte c, int x, int y) { ////////////////////////////////////////////////////////////////////// -ERRORCODE CBFontBitmap::loadFile(const char *filename) { +bool CBFontBitmap::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { _gameRef->LOG(0, "CBFontBitmap::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } - ERRORCODE ret; + bool ret; _filename = new char [strlen(filename) + 1]; strcpy(_filename, filename); @@ -282,7 +282,7 @@ TOKEN_DEF(WIDTHS_FRAME) TOKEN_DEF(PAINT_WHOLE_CELL) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////// -ERRORCODE CBFontBitmap::loadBuffer(byte *buffer) { +bool CBFontBitmap::loadBuffer(byte *buffer) { TOKEN_TABLE_START(commands) TOKEN_TABLE(FONTEXT_FIX) TOKEN_TABLE(FONT) @@ -454,7 +454,7 @@ ERRORCODE CBFontBitmap::loadBuffer(byte *buffer) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFontBitmap::persist(CBPersistMgr *persistMgr) { +bool CBFontBitmap::persist(CBPersistMgr *persistMgr) { CBFont::persist(persistMgr); persistMgr->transfer(TMEMBER(_numColumns)); @@ -487,7 +487,7 @@ int CBFontBitmap::getCharWidth(byte index) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFontBitmap::getWidths() { +bool CBFontBitmap::getWidths() { CBSurface *surf = NULL; if (_sprite) { diff --git a/engines/wintermute/Base/font/BFontBitmap.h b/engines/wintermute/Base/font/BFontBitmap.h index b834f919b9..94569e4dc7 100644 --- a/engines/wintermute/Base/font/BFontBitmap.h +++ b/engines/wintermute/Base/font/BFontBitmap.h @@ -37,8 +37,8 @@ class CBSubFrame; class CBFontBitmap : public CBFont { public: DECLARE_PERSISTENT(CBFontBitmap, CBFont) - ERRORCODE loadBuffer(byte *Buffer); - ERRORCODE loadFile(const char *filename); + bool loadBuffer(byte *Buffer); + bool 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(); - ERRORCODE getWidths(); + bool getWidths(); CBSprite *_sprite; int _widthsFrame; bool _fontextFix; diff --git a/engines/wintermute/Base/font/BFontStorage.cpp b/engines/wintermute/Base/font/BFontStorage.cpp index c9c6df9f6e..0e2e0af84d 100644 --- a/engines/wintermute/Base/font/BFontStorage.cpp +++ b/engines/wintermute/Base/font/BFontStorage.cpp @@ -51,7 +51,7 @@ CBFontStorage::~CBFontStorage() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFontStorage::cleanup(bool warn) { +bool CBFontStorage::cleanup(bool warn) { for (int i = 0; i < _fonts.getSize(); i++) { if (warn) _gameRef->LOG(0, "Removing orphan font '%s'", _fonts[i]->_filename); delete _fonts[i]; @@ -62,7 +62,7 @@ ERRORCODE CBFontStorage::cleanup(bool warn) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFontStorage::initLoop() { +bool CBFontStorage::initLoop() { for (int i = 0; i < _fonts.getSize(); i++) { _fonts[i]->initLoop(); } @@ -104,7 +104,7 @@ CBFont *CBFontStorage::addFont(const char *filename) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFontStorage::removeFont(CBFont *font) { +bool CBFontStorage::removeFont(CBFont *font) { if (!font) return STATUS_FAILED; for (int i = 0; i < _fonts.getSize(); i++) { @@ -122,7 +122,7 @@ ERRORCODE CBFontStorage::removeFont(CBFont *font) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFontStorage::persist(CBPersistMgr *persistMgr) { +bool CBFontStorage::persist(CBPersistMgr *persistMgr) { if (!persistMgr->_saving) cleanup(false); diff --git a/engines/wintermute/Base/font/BFontStorage.h b/engines/wintermute/Base/font/BFontStorage.h index 33a1bb056f..4f360c84c5 100644 --- a/engines/wintermute/Base/font/BFontStorage.h +++ b/engines/wintermute/Base/font/BFontStorage.h @@ -41,13 +41,13 @@ class CBFont; class CBFontStorage : public CBBase { public: DECLARE_PERSISTENT(CBFontStorage, CBBase) - ERRORCODE cleanup(bool warn = false); - ERRORCODE removeFont(CBFont *font); + bool cleanup(bool warn = false); + bool removeFont(CBFont *font); CBFont *addFont(const char *filename); CBFontStorage(CBGame *inGame); virtual ~CBFontStorage(); CBArray _fonts; - ERRORCODE initLoop(); + bool initLoop(); }; } // end of namespace WinterMute diff --git a/engines/wintermute/Base/font/BFontTT.cpp b/engines/wintermute/Base/font/BFontTT.cpp index e77d95985b..e4bd7cc719 100644 --- a/engines/wintermute/Base/font/BFontTT.cpp +++ b/engines/wintermute/Base/font/BFontTT.cpp @@ -405,14 +405,14 @@ int CBFontTT::getLetterHeight() { ////////////////////////////////////////////////////////////////////// -ERRORCODE CBFontTT::loadFile(const char *filename) { +bool CBFontTT::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { _gameRef->LOG(0, "CBFontTT::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } - ERRORCODE ret; + bool ret; _filename = new char [strlen(filename) + 1]; strcpy(_filename, filename); @@ -442,7 +442,7 @@ TOKEN_DEF(OFFSET_X) TOKEN_DEF(OFFSET_Y) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////// -ERRORCODE CBFontTT::loadBuffer(byte *buffer) { +bool CBFontTT::loadBuffer(byte *buffer) { TOKEN_TABLE_START(commands) TOKEN_TABLE(TTFONT) TOKEN_TABLE(SIZE) @@ -550,7 +550,7 @@ ERRORCODE CBFontTT::loadBuffer(byte *buffer) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFontTT::parseLayer(CBTTFontLayer *layer, byte *buffer) { +bool CBFontTT::parseLayer(CBTTFontLayer *layer, byte *buffer) { TOKEN_TABLE_START(commands) TOKEN_TABLE(OFFSET_X) TOKEN_TABLE(OFFSET_Y) @@ -593,7 +593,7 @@ ERRORCODE CBFontTT::parseLayer(CBTTFontLayer *layer, byte *buffer) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFontTT::persist(CBPersistMgr *persistMgr) { +bool CBFontTT::persist(CBPersistMgr *persistMgr) { CBFont::persist(persistMgr); persistMgr->transfer(TMEMBER(_isBold)); @@ -635,7 +635,7 @@ void CBFontTT::afterLoad() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CBFontTT::initFont() { +bool CBFontTT::initFont() { if (!_fontFile) return STATUS_FAILED; Common::SeekableReadStream *file = _gameRef->_fileManager->openFile(_fontFile); diff --git a/engines/wintermute/Base/font/BFontTT.h b/engines/wintermute/Base/font/BFontTT.h index 1ee9f1d105..058fc28755 100644 --- a/engines/wintermute/Base/font/BFontTT.h +++ b/engines/wintermute/Base/font/BFontTT.h @@ -80,7 +80,7 @@ public: _color = 0x00000000; } - ERRORCODE persist(CBPersistMgr *persistMgr) { + bool persist(CBPersistMgr *persistMgr) { persistMgr->transfer(TMEMBER(_offsetX)); persistMgr->transfer(TMEMBER(_offsetY)); persistMgr->transfer(TMEMBER(_color)); @@ -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(); - ERRORCODE loadBuffer(byte *buffer); - ERRORCODE loadFile(const char *filename); + bool loadBuffer(byte *buffer); + bool loadFile(const char *filename); float getLineHeight() const { return _lineHeight; @@ -134,7 +134,7 @@ public: void initLoop(); private: - ERRORCODE parseLayer(CBTTFontLayer *layer, byte *buffer); + bool 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]; - ERRORCODE initFont(); + bool initFont(); Graphics::Font *_deletableFont; const Graphics::Font *_font; diff --git a/engines/wintermute/Base/particles/PartEmitter.cpp b/engines/wintermute/Base/particles/PartEmitter.cpp index dc76dd696d..e113ab7399 100644 --- a/engines/wintermute/Base/particles/PartEmitter.cpp +++ b/engines/wintermute/Base/particles/PartEmitter.cpp @@ -116,7 +116,7 @@ CPartEmitter::~CPartEmitter(void) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CPartEmitter::addSprite(const char *filename) { +bool CPartEmitter::addSprite(const char *filename) { if (!filename) return STATUS_FAILED; // do we already have the file? @@ -139,7 +139,7 @@ ERRORCODE CPartEmitter::addSprite(const char *filename) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CPartEmitter::removeSprite(const char *filename) { +bool CPartEmitter::removeSprite(const char *filename) { for (int i = 0; i < _sprites.getSize(); i++) { if (scumm_stricmp(filename, _sprites[i]) == 0) { delete [] _sprites[i]; @@ -151,7 +151,7 @@ ERRORCODE CPartEmitter::removeSprite(const char *filename) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CPartEmitter::initParticle(CPartParticle *particle, uint32 currentTime, uint32 timerDelta) { +bool CPartEmitter::initParticle(CPartParticle *particle, uint32 currentTime, uint32 timerDelta) { if (!particle) return STATUS_FAILED; if (_sprites.getSize() == 0) return STATUS_FAILED; @@ -226,13 +226,13 @@ ERRORCODE CPartEmitter::initParticle(CPartParticle *particle, uint32 currentTime } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CPartEmitter::update() { +bool CPartEmitter::update() { if (!_running) return STATUS_OK; else return updateInternal(_gameRef->_timer, _gameRef->_timerDelta); } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CPartEmitter::updateInternal(uint32 currentTime, uint32 timerDelta) { +bool CPartEmitter::updateInternal(uint32 currentTime, uint32 timerDelta) { int numLive = 0; for (int i = 0; i < _particles.getSize(); i++) { @@ -288,7 +288,7 @@ ERRORCODE CPartEmitter::updateInternal(uint32 currentTime, uint32 timerDelta) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CPartEmitter::display(CBRegion *region) { +bool CPartEmitter::display(CBRegion *region) { if (_sprites.getSize() <= 1) _gameRef->_renderer->startSpriteBatch(); for (int i = 0; i < _particles.getSize(); i++) { @@ -305,7 +305,7 @@ ERRORCODE CPartEmitter::display(CBRegion *region) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CPartEmitter::start() { +bool CPartEmitter::start() { for (int i = 0; i < _particles.getSize(); i++) { _particles[i]->_isDead = true; } @@ -329,7 +329,7 @@ ERRORCODE CPartEmitter::start() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CPartEmitter::sortParticlesByZ() { +bool CPartEmitter::sortParticlesByZ() { // sort particles by _posY qsort(_particles.getData(), _particles.getSize(), sizeof(CPartParticle *), CPartEmitter::compareZ); return STATUS_OK; @@ -346,14 +346,14 @@ int CPartEmitter::compareZ(const void *obj1, const void *obj2) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CPartEmitter::setBorder(int x, int y, int width, int height) { +bool CPartEmitter::setBorder(int x, int y, int width, int height) { CBPlatform::setRect(&_border, x, y, x + width, y + height); return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CPartEmitter::setBorderThickness(int thicknessLeft, int thicknessRight, int thicknessTop, int thicknessBottom) { +bool CPartEmitter::setBorderThickness(int thicknessLeft, int thicknessRight, int thicknessTop, int thicknessBottom) { _borderThicknessLeft = thicknessLeft; _borderThicknessRight = thicknessRight; _borderThicknessTop = thicknessTop; @@ -384,7 +384,7 @@ CPartForce *CPartEmitter::addForceByName(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CPartEmitter::addForce(const char *name, CPartForce::TForceType type, int posX, int posY, float angle, float strength) { +bool CPartEmitter::addForce(const char *name, CPartForce::TForceType type, int posX, int posY, float angle, float strength) { CPartForce *force = addForceByName(name); if (!force) return STATUS_FAILED; @@ -400,7 +400,7 @@ ERRORCODE CPartEmitter::addForce(const char *name, CPartForce::TForceType type, } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CPartEmitter::removeForce(const char *name) { +bool CPartEmitter::removeForce(const char *name) { for (int i = 0; i < _forces.getSize(); i++) { if (scumm_stricmp(name, _forces[i]->_name) == 0) { delete _forces[i]; @@ -415,7 +415,7 @@ ERRORCODE CPartEmitter::removeForce(const char *name) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -ERRORCODE CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CPartEmitter::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // SetBorder ////////////////////////////////////////////////////////////////////////// @@ -833,7 +833,7 @@ CScValue *CPartEmitter::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CPartEmitter::scSetProperty(const char *name, CScValue *value) { +bool CPartEmitter::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// // X ////////////////////////////////////////////////////////////////////////// @@ -1098,7 +1098,7 @@ const char *CPartEmitter::scToString() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CPartEmitter::persist(CBPersistMgr *persistMgr) { +bool CPartEmitter::persist(CBPersistMgr *persistMgr) { CBObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_width)); diff --git a/engines/wintermute/Base/particles/PartEmitter.h b/engines/wintermute/Base/particles/PartEmitter.h index 6f517bf357..92918927ea 100644 --- a/engines/wintermute/Base/particles/PartEmitter.h +++ b/engines/wintermute/Base/particles/PartEmitter.h @@ -100,35 +100,35 @@ public: char *_emitEvent; CBScriptHolder *_owner; - ERRORCODE start(); + bool start(); - ERRORCODE update(); - ERRORCODE display() { return display(NULL); } // To avoid shadowing the inherited display-function. - ERRORCODE display(CBRegion *region); + bool update(); + bool display() { return display(NULL); } // To avoid shadowing the inherited display-function. + bool display(CBRegion *region); - 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); + bool sortParticlesByZ(); + bool addSprite(const char *filename); + bool removeSprite(const char *filename); + bool setBorder(int x, int y, int width, int height); + bool setBorderThickness(int thicknessLeft, int thicknessRight, int thicknessTop, int thicknessBottom); - ERRORCODE addForce(const char *name, CPartForce::TForceType type, int posX, int posY, float angle, float strength); - ERRORCODE removeForce(const char *name); + bool addForce(const char *name, CPartForce::TForceType type, int posX, int posY, float angle, float strength); + bool removeForce(const char *name); CBArray _forces; // scripting interface virtual CScValue *scGetProperty(const char *name); - virtual ERRORCODE scSetProperty(const char *name, CScValue *value); - virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual bool scSetProperty(const char *name, CScValue *value); + virtual bool 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); - ERRORCODE initParticle(CPartParticle *particle, uint32 currentTime, uint32 timerDelta); - ERRORCODE updateInternal(uint32 currentTime, uint32 timerDelta); + bool initParticle(CPartParticle *particle, uint32 currentTime, uint32 timerDelta); + bool updateInternal(uint32 currentTime, uint32 timerDelta); uint32 _lastGenTime; CBArray _particles; CBArray _sprites; diff --git a/engines/wintermute/Base/particles/PartForce.cpp b/engines/wintermute/Base/particles/PartForce.cpp index 2da74da14d..69f3f274d3 100644 --- a/engines/wintermute/Base/particles/PartForce.cpp +++ b/engines/wintermute/Base/particles/PartForce.cpp @@ -47,7 +47,7 @@ CPartForce::~CPartForce(void) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CPartForce::persist(CBPersistMgr *persistMgr) { +bool CPartForce::persist(CBPersistMgr *persistMgr) { persistMgr->transfer(TMEMBER(_name)); persistMgr->transfer(TMEMBER(_pos)); persistMgr->transfer(TMEMBER(_direction)); diff --git a/engines/wintermute/Base/particles/PartForce.h b/engines/wintermute/Base/particles/PartForce.h index cf5d697a79..d895e22ee7 100644 --- a/engines/wintermute/Base/particles/PartForce.h +++ b/engines/wintermute/Base/particles/PartForce.h @@ -49,7 +49,7 @@ public: Vector2 _direction; TForceType _type; - ERRORCODE persist(CBPersistMgr *PersistMgr); + bool persist(CBPersistMgr *PersistMgr); }; } // end of namespace WinterMute diff --git a/engines/wintermute/Base/particles/PartParticle.cpp b/engines/wintermute/Base/particles/PartParticle.cpp index ebb7fe9f7a..37f9796fe7 100644 --- a/engines/wintermute/Base/particles/PartParticle.cpp +++ b/engines/wintermute/Base/particles/PartParticle.cpp @@ -72,7 +72,7 @@ CPartParticle::~CPartParticle(void) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CPartParticle::setSprite(const char *filename) { +bool CPartParticle::setSprite(const char *filename) { if (_sprite && _sprite->_filename && scumm_stricmp(filename, _sprite->_filename) == 0) { _sprite->reset(); return STATUS_OK; @@ -96,7 +96,7 @@ ERRORCODE CPartParticle::setSprite(const char *filename) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CPartParticle::update(CPartEmitter *emitter, uint32 currentTime, uint32 timerDelta) { +bool CPartParticle::update(CPartEmitter *emitter, uint32 currentTime, uint32 timerDelta) { if (_state == PARTICLE_FADEIN) { if (currentTime - _fadeStart >= (uint32)_fadeTime) { _state = PARTICLE_NORMAL; @@ -182,7 +182,7 @@ ERRORCODE CPartParticle::update(CPartEmitter *emitter, uint32 currentTime, uint3 } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CPartParticle::display(CPartEmitter *emitter) { +bool CPartParticle::display(CPartEmitter *emitter) { if (!_sprite) return STATUS_FAILED; if (_isDead) return STATUS_OK; @@ -197,7 +197,7 @@ ERRORCODE CPartParticle::display(CPartEmitter *emitter) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CPartParticle::fadeIn(uint32 currentTime, int fadeTime) { +bool CPartParticle::fadeIn(uint32 currentTime, int fadeTime) { _currentAlpha = 0; _fadeStart = currentTime; _fadeTime = fadeTime; @@ -207,7 +207,7 @@ ERRORCODE CPartParticle::fadeIn(uint32 currentTime, int fadeTime) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CPartParticle::fadeOut(uint32 currentTime, int fadeTime) { +bool CPartParticle::fadeOut(uint32 currentTime, int fadeTime) { //_currentAlpha = 255; _fadeStartAlpha = _currentAlpha; _fadeStart = currentTime; @@ -218,7 +218,7 @@ ERRORCODE CPartParticle::fadeOut(uint32 currentTime, int fadeTime) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CPartParticle::persist(CBPersistMgr *persistMgr) { +bool CPartParticle::persist(CBPersistMgr *persistMgr) { persistMgr->transfer(TMEMBER(_alpha1)); persistMgr->transfer(TMEMBER(_alpha2)); persistMgr->transfer(TMEMBER(_border)); diff --git a/engines/wintermute/Base/particles/PartParticle.h b/engines/wintermute/Base/particles/PartParticle.h index aed559d337..c8ad1181d7 100644 --- a/engines/wintermute/Base/particles/PartParticle.h +++ b/engines/wintermute/Base/particles/PartParticle.h @@ -69,15 +69,15 @@ public: bool _isDead; TParticleState _state; - ERRORCODE update(CPartEmitter *emitter, uint32 currentTime, uint32 timerDelta); - ERRORCODE display(CPartEmitter *emitter); + bool update(CPartEmitter *emitter, uint32 currentTime, uint32 timerDelta); + bool display(CPartEmitter *emitter); - ERRORCODE setSprite(const char *filename); + bool setSprite(const char *filename); - ERRORCODE fadeIn(uint32 currentTime, int fadeTime); - ERRORCODE fadeOut(uint32 currentTime, int fadeTime); + bool fadeIn(uint32 currentTime, int fadeTime); + bool fadeOut(uint32 currentTime, int fadeTime); - ERRORCODE persist(CBPersistMgr *PersistMgr); + bool persist(CBPersistMgr *PersistMgr); private: uint32 _fadeStart; int _fadeTime; diff --git a/engines/wintermute/Base/scriptables/SXArray.cpp b/engines/wintermute/Base/scriptables/SXArray.cpp index a52a83db0a..e825e5ff97 100644 --- a/engines/wintermute/Base/scriptables/SXArray.cpp +++ b/engines/wintermute/Base/scriptables/SXArray.cpp @@ -93,7 +93,7 @@ const char *CSXArray::scToString() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CSXArray::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CSXArray::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // Push ////////////////////////////////////////////////////////////////////////// @@ -166,7 +166,7 @@ CScValue *CSXArray::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CSXArray::scSetProperty(const char *name, CScValue *value) { +bool CSXArray::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// // Length ////////////////////////////////////////////////////////////////////////// @@ -199,7 +199,7 @@ ERRORCODE CSXArray::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CSXArray::persist(CBPersistMgr *persistMgr) { +bool CSXArray::persist(CBPersistMgr *persistMgr) { CBScriptable::persist(persistMgr); persistMgr->transfer(TMEMBER(_length)); @@ -227,7 +227,7 @@ bool CSXArray::validNumber(const char *origStr, char *outStr) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CSXArray::push(CScValue *val) { +bool CSXArray::push(CScValue *val) { char paramName[20]; _length++; sprintf(paramName, "%d", _length - 1); diff --git a/engines/wintermute/Base/scriptables/SXArray.h b/engines/wintermute/Base/scriptables/SXArray.h index 040fbaf481..fcf29f7032 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: - ERRORCODE push(CScValue *Val); + bool 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); - ERRORCODE scSetProperty(const char *name, CScValue *value); - ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + bool scSetProperty(const char *name, CScValue *value); + bool 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 a9ffaf5dd5..214de237fe 100644 --- a/engines/wintermute/Base/scriptables/SXDate.cpp +++ b/engines/wintermute/Base/scriptables/SXDate.cpp @@ -75,7 +75,7 @@ const char *CSXDate::scToString() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CSXDate::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CSXDate::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // GetYear ////////////////////////////////////////////////////////////////////////// @@ -223,7 +223,7 @@ CScValue *CSXDate::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CSXDate::scSetProperty(const char *name, CScValue *value) { +bool CSXDate::scSetProperty(const char *name, CScValue *value) { /* ////////////////////////////////////////////////////////////////////////// // Name @@ -238,7 +238,7 @@ ERRORCODE CSXDate::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CSXDate::persist(CBPersistMgr *persistMgr) { +bool CSXDate::persist(CBPersistMgr *persistMgr) { CBScriptable::persist(persistMgr); persistMgr->transfer(TMEMBER(_tm.tm_year)); diff --git a/engines/wintermute/Base/scriptables/SXDate.h b/engines/wintermute/Base/scriptables/SXDate.h index 324e711e82..cb1ac4f98f 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); - ERRORCODE scSetProperty(const char *name, CScValue *value); - ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + bool scSetProperty(const char *name, CScValue *value); + bool 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 cc30c14e93..f6c34545d0 100644 --- a/engines/wintermute/Base/scriptables/SXFile.cpp +++ b/engines/wintermute/Base/scriptables/SXFile.cpp @@ -100,7 +100,7 @@ const char *CSXFile::scToString() { #define FILE_BUFFER_SIZE 32768 ////////////////////////////////////////////////////////////////////////// -ERRORCODE CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // SetFilename ////////////////////////////////////////////////////////////////////////// @@ -214,7 +214,7 @@ ERRORCODE CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *th uint32 counter = 0; byte b; bool foundNewLine = false; - ERRORCODE ret = STATUS_FAILED; + bool ret = STATUS_FAILED; do { ret = _readFile->read(&b, 1); if (ret != 1) break; @@ -265,7 +265,7 @@ ERRORCODE CSXFile::scCallMethod(CScScript *script, CScStack *stack, CScStack *th uint32 counter = 0; byte b; - ERRORCODE ret = STATUS_FAILED; + bool ret = STATUS_FAILED; while (counter < (uint32)textLen) { ret = _readFile->read(&b, 1); if (ret != 1) break; @@ -654,7 +654,7 @@ CScValue *CSXFile::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CSXFile::scSetProperty(const char *name, CScValue *value) { +bool CSXFile::scSetProperty(const char *name, CScValue *value) { /* ////////////////////////////////////////////////////////////////////////// // Length @@ -717,7 +717,7 @@ uint32 CSXFile::getLength() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CSXFile::persist(CBPersistMgr *persistMgr) { +bool CSXFile::persist(CBPersistMgr *persistMgr) { CBScriptable::persist(persistMgr); diff --git a/engines/wintermute/Base/scriptables/SXFile.h b/engines/wintermute/Base/scriptables/SXFile.h index f07e2a56cf..f772473dd6 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); - ERRORCODE scSetProperty(const char *name, CScValue *value); - ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + bool scSetProperty(const char *name, CScValue *value); + bool 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 aba58e2aa7..40e185d6cc 100644 --- a/engines/wintermute/Base/scriptables/SXMath.cpp +++ b/engines/wintermute/Base/scriptables/SXMath.cpp @@ -59,7 +59,7 @@ CSXMath::~CSXMath() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CSXMath::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // Abs ////////////////////////////////////////////////////////////////////////// @@ -286,7 +286,7 @@ double CSXMath::radianToDegree(double value) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CSXMath::persist(CBPersistMgr *persistMgr) { +bool CSXMath::persist(CBPersistMgr *persistMgr) { CBScriptable::persist(persistMgr); return STATUS_OK; diff --git a/engines/wintermute/Base/scriptables/SXMath.h b/engines/wintermute/Base/scriptables/SXMath.h index aceca5ea08..eb11b94f34 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 ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual bool 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 428a58a997..296326ebe5 100644 --- a/engines/wintermute/Base/scriptables/SXMemBuffer.cpp +++ b/engines/wintermute/Base/scriptables/SXMemBuffer.cpp @@ -76,7 +76,7 @@ void CSXMemBuffer::cleanup() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CSXMemBuffer::resize(int newSize) { +bool CSXMemBuffer::resize(int newSize) { int oldSize = _size; if (_size == 0) { @@ -124,7 +124,7 @@ const char *CSXMemBuffer::scToString() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CSXMemBuffer::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // SetSize ////////////////////////////////////////////////////////////////////////// @@ -457,7 +457,7 @@ CScValue *CSXMemBuffer::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CSXMemBuffer::scSetProperty(const char *name, CScValue *value) { +bool CSXMemBuffer::scSetProperty(const char *name, CScValue *value) { /* ////////////////////////////////////////////////////////////////////////// // Length @@ -480,7 +480,7 @@ ERRORCODE CSXMemBuffer::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CSXMemBuffer::persist(CBPersistMgr *persistMgr) { +bool CSXMemBuffer::persist(CBPersistMgr *persistMgr) { CBScriptable::persist(persistMgr); diff --git a/engines/wintermute/Base/scriptables/SXMemBuffer.h b/engines/wintermute/Base/scriptables/SXMemBuffer.h index 775f8247b2..9a8746288c 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); - ERRORCODE scSetProperty(const char *name, CScValue *value); - ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + bool scSetProperty(const char *name, CScValue *value); + bool 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: - ERRORCODE resize(int newSize); + bool resize(int newSize); void *_buffer; void cleanup(); bool checkBounds(CScScript *script, int start, int length); diff --git a/engines/wintermute/Base/scriptables/SXString.cpp b/engines/wintermute/Base/scriptables/SXString.cpp index 5e7043ee19..ba70551dde 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) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // Substring ////////////////////////////////////////////////////////////////////////// @@ -352,7 +352,7 @@ CScValue *CSXString::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CSXString::scSetProperty(const char *name, CScValue *value) { +bool CSXString::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// // Capacity ////////////////////////////////////////////////////////////////////////// @@ -377,7 +377,7 @@ ERRORCODE CSXString::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CSXString::persist(CBPersistMgr *persistMgr) { +bool CSXString::persist(CBPersistMgr *persistMgr) { CBScriptable::persist(persistMgr); diff --git a/engines/wintermute/Base/scriptables/SXString.h b/engines/wintermute/Base/scriptables/SXString.h index c9fcad6463..04f9bc80c3 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); - ERRORCODE scSetProperty(const char *name, CScValue *value); - ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + bool scSetProperty(const char *name, CScValue *value); + bool 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 d976707ce2..8e57c9a3eb 100644 --- a/engines/wintermute/Base/scriptables/ScEngine.cpp +++ b/engines/wintermute/Base/scriptables/ScEngine.cpp @@ -98,7 +98,7 @@ CScEngine::~CScEngine() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScEngine::cleanup() { +bool 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]; @@ -148,7 +148,7 @@ CScScript *CScEngine::runScript(const char *filename, CBScriptHolder *owner) { // add new script CScScript *script = new CScScript(_gameRef, this); - ERRORCODE ret = script->create(filename, compBuffer, compSize, owner); + bool ret = script->create(filename, compBuffer, compSize, owner); if (DID_FAIL(ret)) { _gameRef->LOG(ret, "Error running script '%s'...", filename); delete script; @@ -244,7 +244,7 @@ byte *CScEngine::getCompiledScript(const char *filename, uint32 *outSize, bool i ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScEngine::tick() { +bool CScEngine::tick() { if (_scripts.getSize() == 0) return STATUS_OK; @@ -344,7 +344,7 @@ ERRORCODE CScEngine::tick() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScEngine::tickUnbreakable() { +bool CScEngine::tickUnbreakable() { // execute unbreakable scripts for (int i = 0; i < _scripts.getSize(); i++) { if (!_scripts[i]->_unbreakable) continue; @@ -363,7 +363,7 @@ ERRORCODE CScEngine::tickUnbreakable() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScEngine::removeFinishedScripts() { +bool CScEngine::removeFinishedScripts() { // remove finished scripts for (int i = 0; i < _scripts.getSize(); i++) { if (_scripts[i]->_state == SCRIPT_FINISHED || _scripts[i]->_state == SCRIPT_ERROR) { @@ -411,7 +411,7 @@ int CScEngine::getNumScripts(int *running, int *waiting, int *persistent) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScEngine::emptyScriptCache() { +bool CScEngine::emptyScriptCache() { for (int i = 0; i < MAX_CACHED_SCRIPTS; i++) { if (_cachedScripts[i]) { delete _cachedScripts[i]; @@ -423,7 +423,7 @@ ERRORCODE CScEngine::emptyScriptCache() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScEngine::resetObject(CBObject *Object) { +bool 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) { @@ -437,7 +437,7 @@ ERRORCODE CScEngine::resetObject(CBObject *Object) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScEngine::resetScript(CScScript *script) { +bool 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) { @@ -448,7 +448,7 @@ ERRORCODE CScEngine::resetScript(CScScript *script) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScEngine::persist(CBPersistMgr *persistMgr) { +bool CScEngine::persist(CBPersistMgr *persistMgr) { if (!persistMgr->_saving) cleanup(); persistMgr->transfer(TMEMBER(_gameRef)); @@ -473,7 +473,7 @@ void CScEngine::editorCleanup() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScEngine::pauseAll() { +bool CScEngine::pauseAll() { for (int i = 0; i < _scripts.getSize(); i++) { if (_scripts[i] != _currentScript) _scripts[i]->pause(); } @@ -483,7 +483,7 @@ ERRORCODE CScEngine::pauseAll() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScEngine::resumeAll() { +bool CScEngine::resumeAll() { for (int i = 0; i < _scripts.getSize(); i++) _scripts[i]->resume(); @@ -500,13 +500,13 @@ bool CScEngine::isValidScript(CScScript *script) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScEngine::clearGlobals(bool includingNatives) { +bool CScEngine::clearGlobals(bool includingNatives) { _globals->CleanProps(includingNatives); return STATUS_OK; } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScEngine::dbgSendScripts(IWmeDebugClient *client) { +bool CScEngine::dbgSendScripts(IWmeDebugClient *client) { // send global variables _globals->dbgSendVariables(client, WME_DBGVAR_GLOBAL, NULL, 0); @@ -526,7 +526,7 @@ ERRORCODE CScEngine::dbgSendScripts(IWmeDebugClient *client) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScEngine::addBreakpoint(const char *scriptFilename, int line) { +bool CScEngine::addBreakpoint(const char *scriptFilename, int line) { if (!_gameRef->getDebugMgr()->_enabled) return STATUS_OK; CScBreakpoint *bp = NULL; @@ -553,7 +553,7 @@ ERRORCODE CScEngine::addBreakpoint(const char *scriptFilename, int line) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScEngine::removeBreakpoint(const char *scriptFilename, int line) { +bool CScEngine::removeBreakpoint(const char *scriptFilename, int line) { if (!_gameRef->getDebugMgr()->_enabled) return STATUS_OK; for (int i = 0; i < _breakpoints.getSize(); i++) { @@ -578,7 +578,7 @@ ERRORCODE CScEngine::removeBreakpoint(const char *scriptFilename, int line) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScEngine::refreshScriptBreakpoints() { +bool CScEngine::refreshScriptBreakpoints() { if (!_gameRef->getDebugMgr()->_enabled) return STATUS_OK; for (int i = 0; i < _scripts.getSize(); i++) { @@ -588,7 +588,7 @@ ERRORCODE CScEngine::refreshScriptBreakpoints() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScEngine::refreshScriptBreakpoints(CScScript *script) { +bool CScEngine::refreshScriptBreakpoints(CScScript *script) { if (!_gameRef->getDebugMgr()->_enabled) return STATUS_OK; if (!script || !script->_filename) return STATUS_FAILED; @@ -605,7 +605,7 @@ ERRORCODE CScEngine::refreshScriptBreakpoints(CScScript *script) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScEngine::saveBreakpoints() { +bool CScEngine::saveBreakpoints() { if (!_gameRef->getDebugMgr()->_enabled) return STATUS_OK; @@ -628,7 +628,7 @@ ERRORCODE CScEngine::saveBreakpoints() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScEngine::loadBreakpoints() { +bool CScEngine::loadBreakpoints() { if (!_gameRef->getDebugMgr()->_enabled) return STATUS_OK; char key[100]; diff --git a/engines/wintermute/Base/scriptables/ScEngine.h b/engines/wintermute/Base/scriptables/ScEngine.h index d439ab8eab..cca1c1aa6b 100644 --- a/engines/wintermute/Base/scriptables/ScEngine.h +++ b/engines/wintermute/Base/scriptables/ScEngine.h @@ -83,33 +83,33 @@ public: public: - ERRORCODE dbgSendScripts(IWmeDebugClient *client); + bool dbgSendScripts(IWmeDebugClient *client); CBArray _breakpoints; - 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 addBreakpoint(const char *scriptFilename, int line); + bool removeBreakpoint(const char *scriptFilename, int line); + bool refreshScriptBreakpoints(); + bool refreshScriptBreakpoints(CScScript *script); + bool saveBreakpoints(); + bool loadBreakpoints(); + + bool clearGlobals(bool includingNatives = false); + bool tickUnbreakable(); + bool removeFinishedScripts(); bool isValidScript(CScScript *script); CScScript *_currentScript; - ERRORCODE resumeAll(); - ERRORCODE pauseAll(); + bool resumeAll(); + bool pauseAll(); void editorCleanup(); - ERRORCODE resetObject(CBObject *Object); - ERRORCODE resetScript(CScScript *script); - ERRORCODE emptyScriptCache(); + bool resetObject(CBObject *Object); + bool resetScript(CScScript *script); + bool emptyScriptCache(); byte *getCompiledScript(const char *filename, uint32 *outSize, bool ignoreCache = false); DECLARE_PERSISTENT(CScEngine, CBBase) - ERRORCODE cleanup(); + bool cleanup(); int getNumScripts(int *running = NULL, int *waiting = NULL, int *persistent = NULL); - ERRORCODE tick(); + bool 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 e1cf791e31..bddb687934 100644 --- a/engines/wintermute/Base/scriptables/ScScript.cpp +++ b/engines/wintermute/Base/scriptables/ScScript.cpp @@ -118,7 +118,7 @@ void CScScript::readHeader() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScScript::initScript() { +bool CScScript::initScript() { if (!_scriptStream) { _scriptStream = new Common::MemoryReadStream(_buffer, _bufferSize); } @@ -165,7 +165,7 @@ ERRORCODE CScScript::initScript() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScScript::initTables() { +bool CScScript::initTables() { uint32 OrigIP = _iP; readHeader(); @@ -240,7 +240,7 @@ ERRORCODE CScScript::initTables() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScScript::create(const char *filename, byte *buffer, uint32 size, CBScriptHolder *owner) { +bool CScScript::create(const char *filename, byte *buffer, uint32 size, CBScriptHolder *owner) { cleanup(); _thread = false; @@ -259,7 +259,7 @@ ERRORCODE CScScript::create(const char *filename, byte *buffer, uint32 size, CBS _bufferSize = size; - ERRORCODE res = initScript(); + bool res = initScript(); if (DID_FAIL(res)) return res; // establish global variables table @@ -272,7 +272,7 @@ ERRORCODE CScScript::create(const char *filename, byte *buffer, uint32 size, CBS ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScScript::createThread(CScScript *original, uint32 initIP, const char *eventName) { +bool CScScript::createThread(CScScript *original, uint32 initIP, const char *eventName) { cleanup(); _thread = true; @@ -292,7 +292,7 @@ ERRORCODE CScScript::createThread(CScScript *original, uint32 initIP, const char _bufferSize = original->_bufferSize; // initialize - ERRORCODE res = initScript(); + bool res = initScript(); if (DID_FAIL(res)) return res; // copy globals @@ -316,7 +316,7 @@ ERRORCODE CScScript::createThread(CScScript *original, uint32 initIP, const char ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScScript::createMethodThread(CScScript *original, const char *methodName) { +bool CScScript::createMethodThread(CScScript *original, const char *methodName) { uint32 ip = original->getMethodPos(methodName); if (ip == 0) return STATUS_FAILED; @@ -339,7 +339,7 @@ ERRORCODE CScScript::createMethodThread(CScScript *original, const char *methodN _bufferSize = original->_bufferSize; // initialize - ERRORCODE res = initScript(); + bool res = initScript(); if (DID_FAIL(res)) return res; // copy globals @@ -470,8 +470,8 @@ char *CScScript::getString() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScScript::executeInstruction() { - ERRORCODE ret = STATUS_OK; +bool CScScript::executeInstruction() { + bool ret = STATUS_OK; uint32 dw; const char *str = NULL; @@ -560,7 +560,7 @@ ERRORCODE CScScript::executeInstruction() { CScValue *var = _stack->pop(); if (var->_type == VAL_VARIABLE_REF) var = var->_valRef; - ERRORCODE res = STATUS_FAILED; + bool res = STATUS_FAILED; bool TriedNative = false; // we are already calling this method, try native @@ -1120,7 +1120,7 @@ CScValue *CScScript::getVar(char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScScript::waitFor(CBObject *object) { +bool CScScript::waitFor(CBObject *object) { if (_unbreakable) { runtimeError("Script cannot be interrupted."); return STATUS_OK; @@ -1133,14 +1133,14 @@ ERRORCODE CScScript::waitFor(CBObject *object) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScScript::waitForExclusive(CBObject *object) { +bool CScScript::waitForExclusive(CBObject *object) { _engine->resetObject(object); return waitFor(object); } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScScript::sleep(uint32 duration) { +bool CScScript::sleep(uint32 duration) { if (_unbreakable) { runtimeError("Script cannot be interrupted."); return STATUS_OK; @@ -1159,7 +1159,7 @@ ERRORCODE CScScript::sleep(uint32 duration) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScScript::finish(bool includingThreads) { +bool CScScript::finish(bool includingThreads) { if (_state != SCRIPT_FINISHED && includingThreads) { _state = SCRIPT_FINISHED; finishThreads(); @@ -1171,7 +1171,7 @@ ERRORCODE CScScript::finish(bool includingThreads) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScScript::run() { +bool CScScript::run() { _state = SCRIPT_RUNNING; return STATUS_OK; } @@ -1195,7 +1195,7 @@ void CScScript::runtimeError(const char *fmt, ...) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScScript::persist(CBPersistMgr *persistMgr) { +bool CScScript::persist(CBPersistMgr *persistMgr) { persistMgr->transfer(TMEMBER(_gameRef)); @@ -1265,7 +1265,7 @@ CScScript *CScScript::invokeEventHandler(const char *eventName, bool unbreakable CScScript *thread = new CScScript(_gameRef, _engine); if (thread) { - ERRORCODE ret = thread->createThread(this, pos, eventName); + bool ret = thread->createThread(this, pos, eventName); if (DID_SUCCEED(ret)) { thread->_unbreakable = unbreakable; _engine->_scripts.add(thread); @@ -1302,7 +1302,7 @@ bool CScScript::canHandleMethod(const char *methodName) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScScript::pause() { +bool CScScript::pause() { if (_state == SCRIPT_PAUSED) { _gameRef->LOG(0, "Attempting to pause a paused script ('%s', line %d)", _filename, _currentLine); return STATUS_FAILED; @@ -1318,7 +1318,7 @@ ERRORCODE CScScript::pause() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScScript::resume() { +bool CScScript::resume() { if (_state != SCRIPT_PAUSED) return STATUS_OK; _state = _origState; @@ -1337,7 +1337,7 @@ CScScript::TExternalFunction *CScScript::getExternal(char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScScript::externalCall(CScStack *stack, CScStack *thisStack, CScScript::TExternalFunction *function) { +bool CScScript::externalCall(CScStack *stack, CScStack *thisStack, CScScript::TExternalFunction *function) { _gameRef->LOG(0, "External functions are not supported on this platform."); stack->correctParams(0); @@ -1347,7 +1347,7 @@ ERRORCODE CScScript::externalCall(CScStack *stack, CScStack *thisStack, CScScrip ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScScript::copyParameters(CScStack *stack) { +bool CScScript::copyParameters(CScStack *stack) { int i; int NumParams = stack->pop()->getInt(); for (i = NumParams - 1; i >= 0; i--) { @@ -1362,7 +1362,7 @@ ERRORCODE CScScript::copyParameters(CScStack *stack) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScScript::finishThreads() { +bool 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) @@ -1385,7 +1385,7 @@ const char *CScScript::dbgGetFilename() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScScript::dbgSendScript(IWmeDebugClient *client) { +bool CScScript::dbgSendScript(IWmeDebugClient *client) { if (_methodThread) client->onScriptMethodThreadInit(this, _parentScript, _threadEvent); else if (_thread) client->onScriptEventThreadInit(this, _parentScript, _threadEvent); else client->onScriptInit(this); @@ -1395,7 +1395,7 @@ ERRORCODE CScScript::dbgSendScript(IWmeDebugClient *client) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScScript::dbgSendVariables(IWmeDebugClient *client) { +bool CScScript::dbgSendVariables(IWmeDebugClient *client) { // send script globals _globals->dbgSendVariables(client, WME_DBGVAR_SCRIPT, this, 0); diff --git a/engines/wintermute/Base/scriptables/ScScript.h b/engines/wintermute/Base/scriptables/ScScript.h index 666edb8309..24d3f87fe5 100644 --- a/engines/wintermute/Base/scriptables/ScScript.h +++ b/engines/wintermute/Base/scriptables/ScScript.h @@ -43,37 +43,37 @@ class CScEngine; class CScStack; class CScScript : public CBBase, public IWmeDebugScript { public: - ERRORCODE dbgSendScript(IWmeDebugClient *client); - ERRORCODE dbgSendVariables(IWmeDebugClient *client); + bool dbgSendScript(IWmeDebugClient *client); + bool dbgSendVariables(IWmeDebugClient *client); CBArray _breakpoints; bool _tracingMode; CScScript *_parentScript; bool _unbreakable; - ERRORCODE finishThreads(); - ERRORCODE copyParameters(CScStack *stack); + bool finishThreads(); + bool copyParameters(CScStack *stack); void afterLoad(); CScValue *_operand; CScValue *_reg1; bool _freezable; - ERRORCODE resume(); - ERRORCODE pause(); + bool resume(); + bool pause(); bool canHandleEvent(const char *eventName); bool canHandleMethod(const char *methodName); - ERRORCODE createThread(CScScript *original, uint32 initIP, const char *eventName); - ERRORCODE createMethodThread(CScScript *original, const char *methodName); + bool createThread(CScScript *original, uint32 initIP, const char *eventName); + bool createMethodThread(CScScript *original, const char *methodName); CScScript *invokeEventHandler(const char *eventName, bool unbreakable = false); uint32 _timeSlice; DECLARE_PERSISTENT(CScScript, CBBase) void runtimeError(const char *fmt, ...); - ERRORCODE run(); - ERRORCODE finish(bool includingThreads = false); - ERRORCODE sleep(uint32 duration); - ERRORCODE waitForExclusive(CBObject *object); - ERRORCODE waitFor(CBObject *object); + bool run(); + bool finish(bool includingThreads = false); + bool sleep(uint32 duration); + bool waitForExclusive(CBObject *object); + bool waitFor(CBObject *object); uint32 _waitTime; bool _waitFrozen; CBObject *_waitObject; @@ -129,12 +129,12 @@ public: CScValue *_globals; CScEngine *_engine; int _currentLine; - ERRORCODE executeInstruction(); + bool executeInstruction(); char *getString(); uint32 getDWORD(); double getFloat(); void cleanup(); - ERRORCODE create(const char *filename, byte *buffer, uint32 size, CBScriptHolder *owner); + bool create(const char *filename, byte *buffer, uint32 size, CBScriptHolder *owner); uint32 _iP; private: void readHeader(); @@ -160,10 +160,10 @@ public: char *_threadEvent; CBScriptHolder *_owner; CScScript::TExternalFunction *getExternal(char *name); - ERRORCODE externalCall(CScStack *stack, CScStack *thisStack, CScScript::TExternalFunction *function); + bool externalCall(CScStack *stack, CScStack *thisStack, CScScript::TExternalFunction *function); private: - ERRORCODE initScript(); - ERRORCODE initTables(); + bool initScript(); + bool initTables(); // IWmeDebugScript interface implementation diff --git a/engines/wintermute/Base/scriptables/ScStack.cpp b/engines/wintermute/Base/scriptables/ScStack.cpp index c889b5ea9e..fd85e9a5d8 100644 --- a/engines/wintermute/Base/scriptables/ScStack.cpp +++ b/engines/wintermute/Base/scriptables/ScStack.cpp @@ -213,7 +213,7 @@ void CScStack::pushNative(CBScriptable *val, bool persistent) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScStack::persist(CBPersistMgr *persistMgr) { +bool CScStack::persist(CBPersistMgr *persistMgr) { persistMgr->transfer(TMEMBER(_gameRef)); diff --git a/engines/wintermute/Base/scriptables/ScValue.cpp b/engines/wintermute/Base/scriptables/ScValue.cpp index 2c5f388c3d..e75cb133bc 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) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScValue::deleteProp(const char *name) { +bool CScValue::deleteProp(const char *name) { if (_type == VAL_VARIABLE_REF) return _valRef->deleteProp(name); _valIter = _valObject.find(name); @@ -203,11 +203,11 @@ ERRORCODE CScValue::deleteProp(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScValue::setProp(const char *name, CScValue *val, bool copyWhole, bool setAsConst) { +bool CScValue::setProp(const char *name, CScValue *val, bool copyWhole, bool setAsConst) { if (_type == VAL_VARIABLE_REF) return _valRef->setProp(name, val); - ERRORCODE ret = STATUS_FAILED; + bool ret = STATUS_FAILED; if (_type == VAL_NATIVE && _valNative) { ret = _valNative->scSetProperty(name, val); } @@ -735,7 +735,7 @@ void CScValue::setValue(CScValue *val) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScValue::persist(CBPersistMgr *persistMgr) { +bool CScValue::persist(CBPersistMgr *persistMgr) { persistMgr->transfer(TMEMBER(_gameRef)); persistMgr->transfer(TMEMBER(_persistent)); @@ -819,7 +819,7 @@ ERRORCODE CScValue::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScValue::saveAsText(CBDynBuffer *buffer, int indent) { +bool CScValue::saveAsText(CBDynBuffer *buffer, int indent) { _valIter = _valObject.begin(); while (_valIter != _valObject.end()) { buffer->putTextIndent(indent, "PROPERTY {\n"); @@ -878,7 +878,7 @@ int CScValue::compareStrict(CScValue *val1, CScValue *val2) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CScValue::dbgSendVariables(IWmeDebugClient *client, EWmeDebuggerVariableType type, CScScript *script, unsigned int scopeID) { +bool 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()); diff --git a/engines/wintermute/Base/scriptables/ScValue.h b/engines/wintermute/Base/scriptables/ScValue.h index 2f946dffc5..3410111d71 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: - ERRORCODE dbgSendVariables(IWmeDebugClient *client, EWmeDebuggerVariableType type, CScScript *script, unsigned int scopeID); + bool 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; - ERRORCODE saveAsText(CBDynBuffer *buffer, int indent); + bool 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(); - ERRORCODE deleteProp(const char *name); + bool 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(); - ERRORCODE setProp(const char *name, CScValue *val, bool copyWhole = false, bool setAsConst = false); + bool 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 966eb0da09..ba961ed2ae 100644 --- a/engines/wintermute/Base/scriptables/SxObject.cpp +++ b/engines/wintermute/Base/scriptables/SxObject.cpp @@ -58,7 +58,7 @@ CSXObject::~CSXObject() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CSXObject::persist(CBPersistMgr *persistMgr) { +bool CSXObject::persist(CBPersistMgr *persistMgr) { CBObject::persist(persistMgr); return STATUS_OK; diff --git a/engines/wintermute/Sys/SysClassRegistry.cpp b/engines/wintermute/Sys/SysClassRegistry.cpp index b829aece35..66f3bed81f 100644 --- a/engines/wintermute/Sys/SysClassRegistry.cpp +++ b/engines/wintermute/Sys/SysClassRegistry.cpp @@ -167,7 +167,7 @@ bool checkHeader(const char *tag, CBPersistMgr *pm) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CSysClassRegistry::saveTable(CBGame *gameRef, CBPersistMgr *persistMgr, bool quickSave) { +bool CSysClassRegistry::saveTable(CBGame *gameRef, CBPersistMgr *persistMgr, bool quickSave) { persistMgr->putString(""); persistMgr->putDWORD(_classes.size()); @@ -191,7 +191,7 @@ ERRORCODE CSysClassRegistry::saveTable(CBGame *gameRef, CBPersistMgr *persistMgr ////////////////////////////////////////////////////////////////////////// -ERRORCODE CSysClassRegistry::loadTable(CBGame *gameRef, CBPersistMgr *persistMgr) { +bool CSysClassRegistry::loadTable(CBGame *gameRef, CBPersistMgr *persistMgr) { checkHeader("", persistMgr); // reset SavedID of current instances @@ -226,7 +226,7 @@ ERRORCODE CSysClassRegistry::loadTable(CBGame *gameRef, CBPersistMgr *persistMgr ////////////////////////////////////////////////////////////////////////// -ERRORCODE CSysClassRegistry::saveInstances(CBGame *gameRef, CBPersistMgr *persistMgr, bool quickSave) { +bool CSysClassRegistry::saveInstances(CBGame *gameRef, CBPersistMgr *persistMgr, bool quickSave) { Classes::iterator it; @@ -258,7 +258,7 @@ ERRORCODE CSysClassRegistry::saveInstances(CBGame *gameRef, CBPersistMgr *persis } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CSysClassRegistry::loadInstances(CBGame *gameRef, CBPersistMgr *persistMgr) { +bool CSysClassRegistry::loadInstances(CBGame *gameRef, CBPersistMgr *persistMgr) { // get total instances int numInstances = persistMgr->getDWORD(); @@ -294,7 +294,7 @@ ERRORCODE CSysClassRegistry::loadInstances(CBGame *gameRef, CBPersistMgr *persis ////////////////////////////////////////////////////////////////////////// -ERRORCODE CSysClassRegistry::enumInstances(SYS_INSTANCE_CALLBACK lpCallback, const char *className, void *lpData) { +bool CSysClassRegistry::enumInstances(SYS_INSTANCE_CALLBACK lpCallback, const char *className, void *lpData) { NameMap::iterator mapIt = _nameMap.find(className); if (mapIt == _nameMap.end()) return STATUS_FAILED; diff --git a/engines/wintermute/Sys/SysClassRegistry.h b/engines/wintermute/Sys/SysClassRegistry.h index 679c92030e..a4a410527d 100644 --- a/engines/wintermute/Sys/SysClassRegistry.h +++ b/engines/wintermute/Sys/SysClassRegistry.h @@ -66,11 +66,11 @@ public: CSysClassRegistry(); virtual ~CSysClassRegistry(); - 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); + bool enumInstances(SYS_INSTANCE_CALLBACK lpCallback, const char *className, void *lpData); + bool loadTable(CBGame *Game, CBPersistMgr *PersistMgr); + bool saveTable(CBGame *Game, CBPersistMgr *PersistMgr, bool quickSave); + bool loadInstances(CBGame *Game, CBPersistMgr *PersistMgr); + bool 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 5a8b994344..40c5166b45 100644 --- a/engines/wintermute/UI/UIButton.cpp +++ b/engines/wintermute/UI/UIButton.cpp @@ -95,14 +95,14 @@ CUIButton::~CUIButton() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIButton::loadFile(const char *filename) { +bool CUIButton::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { _gameRef->LOG(0, "CUIButton::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } - ERRORCODE ret; + bool ret; _filename = new char [strlen(filename) + 1]; strcpy(_filename, filename); @@ -154,7 +154,7 @@ TOKEN_DEF(PIXEL_PERFECT) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIButton::loadBuffer(byte *buffer, bool complete) { +bool CUIButton::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(BUTTON) TOKEN_TABLE(TEMPLATE) @@ -439,7 +439,7 @@ ERRORCODE CUIButton::loadBuffer(byte *buffer, bool complete) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIButton::saveAsText(CBDynBuffer *buffer, int indent) { +bool CUIButton::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent, "BUTTON\n"); buffer->putTextIndent(indent, "{\n"); @@ -577,7 +577,7 @@ void CUIButton::correctSize() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIButton::display(int offsetX, int offsetY) { +bool CUIButton::display(int offsetX, int offsetY) { if (!_visible) return STATUS_OK; @@ -666,7 +666,7 @@ void CUIButton::press() { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // SetDisabledFont ////////////////////////////////////////////////////////////////////////// @@ -967,7 +967,7 @@ CScValue *CUIButton::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIButton::scSetProperty(const char *name, CScValue *value) { +bool CUIButton::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// // TextAlign ////////////////////////////////////////////////////////////////////////// @@ -1011,7 +1011,7 @@ const char *CUIButton::scToString() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIButton::persist(CBPersistMgr *persistMgr) { +bool CUIButton::persist(CBPersistMgr *persistMgr) { CUIObject::persist(persistMgr); diff --git a/engines/wintermute/UI/UIButton.h b/engines/wintermute/UI/UIButton.h index a857e8ed2a..5bdc075ebc 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 ERRORCODE display(int offsetX = 0, int offsetY = 0); + virtual bool 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(); - ERRORCODE loadFile(const char *filename); - ERRORCODE loadBuffer(byte *buffer, bool complete = true); - virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent); + bool loadFile(const char *filename); + bool loadBuffer(byte *buffer, bool complete = true); + virtual bool saveAsText(CBDynBuffer *buffer, int indent); // scripting interface virtual CScValue *scGetProperty(const char *name); - virtual ERRORCODE scSetProperty(const char *name, CScValue *value); - virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual bool scSetProperty(const char *name, CScValue *value); + virtual bool 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 c3cb3ad810..f964ada462 100644 --- a/engines/wintermute/UI/UIEdit.cpp +++ b/engines/wintermute/UI/UIEdit.cpp @@ -91,14 +91,14 @@ CUIEdit::~CUIEdit() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIEdit::loadFile(const char *filename) { +bool CUIEdit::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { _gameRef->LOG(0, "CUIEdit::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } - ERRORCODE ret; + bool ret; _filename = new char [strlen(filename) + 1]; strcpy(_filename, filename); @@ -136,7 +136,7 @@ TOKEN_DEF(EDIT) TOKEN_DEF(CAPTION) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIEdit::loadBuffer(byte *buffer, bool complete) { +bool CUIEdit::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(TEMPLATE) TOKEN_TABLE(DISABLED) @@ -299,7 +299,7 @@ ERRORCODE CUIEdit::loadBuffer(byte *buffer, bool complete) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIEdit::saveAsText(CBDynBuffer *buffer, int indent) { +bool CUIEdit::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent, "EDIT\n"); buffer->putTextIndent(indent, "{\n"); @@ -358,7 +358,7 @@ ERRORCODE CUIEdit::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIEdit::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CUIEdit::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // SetSelectedFont ////////////////////////////////////////////////////////////////////////// @@ -454,7 +454,7 @@ CScValue *CUIEdit::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIEdit::scSetProperty(const char *name, CScValue *value) { +bool CUIEdit::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// // SelStart ////////////////////////////////////////////////////////////////////////// @@ -540,7 +540,7 @@ void CUIEdit::setCursorChar(const char *character) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIEdit::display(int offsetX, int offsetY) { +bool CUIEdit::display(int offsetX, int offsetY) { if (!_visible) return STATUS_OK; @@ -833,7 +833,7 @@ int CUIEdit::insertChars(int pos, byte *chars, int num) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIEdit::persist(CBPersistMgr *persistMgr) { +bool CUIEdit::persist(CBPersistMgr *persistMgr) { CUIObject::persist(persistMgr); diff --git a/engines/wintermute/UI/UIEdit.h b/engines/wintermute/UI/UIEdit.h index d47066c8f0..7249301592 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 ERRORCODE display(int offsetX, int offsetY); + virtual bool 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(); - ERRORCODE loadFile(const char *filename); - ERRORCODE loadBuffer(byte *buffer, bool complete = true); - virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent); + bool loadFile(const char *filename); + bool loadBuffer(byte *buffer, bool complete = true); + virtual bool saveAsText(CBDynBuffer *buffer, int indent); // scripting interface virtual CScValue *scGetProperty(const char *name); - virtual ERRORCODE scSetProperty(const char *name, CScValue *value); - virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual bool scSetProperty(const char *name, CScValue *value); + virtual bool 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 7df6493fd5..a479cd9bd1 100644 --- a/engines/wintermute/UI/UIEntity.cpp +++ b/engines/wintermute/UI/UIEntity.cpp @@ -55,14 +55,14 @@ CUIEntity::~CUIEntity() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIEntity::loadFile(const char *filename) { +bool CUIEntity::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { _gameRef->LOG(0, "CUIEntity::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } - ERRORCODE ret; + bool ret; _filename = new char [strlen(filename) + 1]; strcpy(_filename, filename); @@ -89,7 +89,7 @@ TOKEN_DEF(SCRIPT) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIEntity::loadBuffer(byte *buffer, bool complete) { +bool CUIEntity::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(ENTITY_CONTAINER) TOKEN_TABLE(TEMPLATE) @@ -174,7 +174,7 @@ ERRORCODE CUIEntity::loadBuffer(byte *buffer, bool complete) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIEntity::saveAsText(CBDynBuffer *buffer, int indent) { +bool CUIEntity::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent, "ENTITY_CONTAINER\n"); buffer->putTextIndent(indent, "{\n"); @@ -208,7 +208,7 @@ ERRORCODE CUIEntity::saveAsText(CBDynBuffer *buffer, int indent) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIEntity::setEntity(const char *filename) { +bool CUIEntity::setEntity(const char *filename) { if (_entity) _gameRef->unregisterObject(_entity); _entity = new CAdEntity(_gameRef); if (!_entity || DID_FAIL(_entity->loadFile(filename))) { @@ -225,7 +225,7 @@ ERRORCODE CUIEntity::setEntity(const char *filename) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIEntity::display(int offsetX, int offsetY) { +bool CUIEntity::display(int offsetX, int offsetY) { if (!_visible) return STATUS_OK; if (_entity) { @@ -251,7 +251,7 @@ ERRORCODE CUIEntity::display(int offsetX, int offsetY) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIEntity::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CUIEntity::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // GetEntity ////////////////////////////////////////////////////////////////////////// @@ -310,7 +310,7 @@ CScValue *CUIEntity::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIEntity::scSetProperty(const char *name, CScValue *value) { +bool CUIEntity::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// // Freezable ////////////////////////////////////////////////////////////////////////// @@ -328,7 +328,7 @@ const char *CUIEntity::scToString() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIEntity::persist(CBPersistMgr *persistMgr) { +bool CUIEntity::persist(CBPersistMgr *persistMgr) { CUIObject::persist(persistMgr); diff --git a/engines/wintermute/UI/UIEntity.h b/engines/wintermute/UI/UIEntity.h index bef73b5e05..b0711838a5 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(); - ERRORCODE loadFile(const char *filename); - ERRORCODE loadBuffer(byte *buffer, bool complete); - virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent); + bool loadFile(const char *filename); + bool loadBuffer(byte *buffer, bool complete); + virtual bool saveAsText(CBDynBuffer *buffer, int indent); - virtual ERRORCODE display(int offsetX = 0, int offsetY = 0); + virtual bool display(int offsetX = 0, int offsetY = 0); CAdEntity *_entity; - ERRORCODE setEntity(const char *filename); + bool setEntity(const char *filename); // scripting interface virtual CScValue *scGetProperty(const char *name); - virtual ERRORCODE scSetProperty(const char *name, CScValue *value); - virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual bool scSetProperty(const char *name, CScValue *value); + virtual bool 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 e7e6fa3b7a..28241c4ae4 100644 --- a/engines/wintermute/UI/UIObject.cpp +++ b/engines/wintermute/UI/UIObject.cpp @@ -98,7 +98,7 @@ void CUIObject::setText(const char *text) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIObject::display(int offsetX, int offsetY) { +bool CUIObject::display(int offsetX, int offsetY) { return STATUS_OK; } @@ -137,7 +137,7 @@ void CUIObject::correctSize() { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CUIObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // SetFont ////////////////////////////////////////////////////////////////////////// @@ -418,7 +418,7 @@ CScValue *CUIObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIObject::scSetProperty(const char *name, CScValue *value) { +bool CUIObject::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// // Name ////////////////////////////////////////////////////////////////////////// @@ -500,7 +500,7 @@ bool CUIObject::isFocused() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIObject::handleMouse(TMouseEvent event, TMouseButton button) { +bool CUIObject::handleMouse(TMouseEvent event, TMouseButton button) { // handle focus change if (event == MOUSE_CLICK && button == MOUSE_BUTTON_LEFT) { focus(); @@ -510,7 +510,7 @@ ERRORCODE CUIObject::handleMouse(TMouseEvent event, TMouseButton button) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIObject::focus() { +bool CUIObject::focus() { CUIObject *obj = this; bool disabled = false; while (obj) { @@ -537,7 +537,7 @@ ERRORCODE CUIObject::focus() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIObject::getTotalOffset(int *offsetX, int *offsetY) { +bool CUIObject::getTotalOffset(int *offsetX, int *offsetY) { int offX = 0, offY = 0; CUIObject *obj = _parent; @@ -555,7 +555,7 @@ ERRORCODE CUIObject::getTotalOffset(int *offsetX, int *offsetY) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIObject::persist(CBPersistMgr *persistMgr) { +bool CUIObject::persist(CBPersistMgr *persistMgr) { CBObject::persist(persistMgr); @@ -582,7 +582,7 @@ ERRORCODE CUIObject::persist(CBPersistMgr *persistMgr) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIObject::saveAsText(CBDynBuffer *buffer, int indent) { +bool CUIObject::saveAsText(CBDynBuffer *buffer, int indent) { return STATUS_FAILED; } diff --git a/engines/wintermute/UI/UIObject.h b/engines/wintermute/UI/UIObject.h index 92dc84eeef..a51df9485d 100644 --- a/engines/wintermute/UI/UIObject.h +++ b/engines/wintermute/UI/UIObject.h @@ -40,15 +40,15 @@ class CBFont; class CUIObject : public CBObject { public: - ERRORCODE getTotalOffset(int *offsetX, int *offsetY); + bool getTotalOffset(int *offsetX, int *offsetY); bool _canFocus; - ERRORCODE focus(); - virtual ERRORCODE handleMouse(TMouseEvent event, TMouseButton button); + bool focus(); + virtual bool handleMouse(TMouseEvent event, TMouseButton button); bool isFocused(); bool _parentNotify; DECLARE_PERSISTENT(CUIObject, CBObject) CUIObject *_parent; - virtual ERRORCODE display(int offsetX = 0, int offsetY = 0); + virtual bool 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 ERRORCODE saveAsText(CBDynBuffer *buffer, int indent); + virtual bool saveAsText(CBDynBuffer *buffer, int indent); // scripting interface virtual CScValue *scGetProperty(const char *name); - virtual ERRORCODE scSetProperty(const char *name, CScValue *value); - virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual bool scSetProperty(const char *name, CScValue *value); + virtual bool 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 e219adb262..3ca8e135c1 100644 --- a/engines/wintermute/UI/UIText.cpp +++ b/engines/wintermute/UI/UIText.cpp @@ -62,7 +62,7 @@ CUIText::~CUIText() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIText::display(int offsetX, int offsetY) { +bool CUIText::display(int offsetX, int offsetY) { if (!_visible) return STATUS_OK; @@ -95,14 +95,14 @@ ERRORCODE CUIText::display(int offsetX, int offsetY) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIText::loadFile(const char *filename) { +bool CUIText::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { _gameRef->LOG(0, "CUIText::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } - ERRORCODE ret; + bool ret; _filename = new char [strlen(filename) + 1]; strcpy(_filename, filename); @@ -138,7 +138,7 @@ TOKEN_DEF(PARENT_NOTIFY) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIText::loadBuffer(byte *buffer, bool complete) { +bool CUIText::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(STATIC) TOKEN_TABLE(TEMPLATE) @@ -293,7 +293,7 @@ ERRORCODE CUIText::loadBuffer(byte *buffer, bool complete) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIText::saveAsText(CBDynBuffer *buffer, int indent) { +bool CUIText::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent, "STATIC\n"); buffer->putTextIndent(indent, "{\n"); @@ -376,7 +376,7 @@ ERRORCODE CUIText::saveAsText(CBDynBuffer *buffer, int indent) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIText::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CUIText::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // SizeToFit ////////////////////////////////////////////////////////////////////////// @@ -434,7 +434,7 @@ CScValue *CUIText::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIText::scSetProperty(const char *name, CScValue *value) { +bool CUIText::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// // TextAlign ////////////////////////////////////////////////////////////////////////// @@ -467,7 +467,7 @@ const char *CUIText::scToString() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIText::persist(CBPersistMgr *persistMgr) { +bool CUIText::persist(CBPersistMgr *persistMgr) { CUIObject::persist(persistMgr); persistMgr->transfer(TMEMBER_INT(_textAlign)); @@ -478,7 +478,7 @@ ERRORCODE CUIText::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIText::sizeToFit() { +bool CUIText::sizeToFit() { if (_font && _text) { _width = _font->getTextWidth((byte *)_text); _height = _font->getTextHeight((byte *)_text, _width); diff --git a/engines/wintermute/UI/UIText.h b/engines/wintermute/UI/UIText.h index 35428fc283..62fbf00b0a 100644 --- a/engines/wintermute/UI/UIText.h +++ b/engines/wintermute/UI/UIText.h @@ -36,22 +36,22 @@ namespace WinterMute { class CUIText : public CUIObject { private: - ERRORCODE sizeToFit(); + bool sizeToFit(); public: - virtual ERRORCODE display(int offsetX, int offsetY); + virtual bool display(int offsetX, int offsetY); DECLARE_PERSISTENT(CUIText, CUIObject) CUIText(CBGame *inGame = NULL); virtual ~CUIText(); TTextAlign _textAlign; TVerticalAlign _verticalAlign; - ERRORCODE loadFile(const char *filename); - ERRORCODE loadBuffer(byte *buffer, bool complete = true); - virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent); + bool loadFile(const char *filename); + bool loadBuffer(byte *buffer, bool complete = true); + virtual bool saveAsText(CBDynBuffer *buffer, int indent); // scripting interface virtual CScValue *scGetProperty(const char *name); - virtual ERRORCODE scSetProperty(const char *name, CScValue *value); - virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual bool scSetProperty(const char *name, CScValue *value); + virtual bool 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 fc8f43ee2f..12e392a18f 100644 --- a/engines/wintermute/UI/UITiledImage.cpp +++ b/engines/wintermute/UI/UITiledImage.cpp @@ -64,7 +64,7 @@ CUITiledImage::~CUITiledImage() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUITiledImage::display(int x, int y, int width, int height) { +bool CUITiledImage::display(int x, int y, int width, int height) { if (!_image) return STATUS_FAILED; int tileWidth = _middleMiddle.right - _middleMiddle.left; @@ -119,14 +119,14 @@ ERRORCODE CUITiledImage::display(int x, int y, int width, int height) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUITiledImage::loadFile(const char *filename) { +bool CUITiledImage::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { _gameRef->LOG(0, "CUITiledImage::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } - ERRORCODE ret; + bool ret; _filename = new char [strlen(filename) + 1]; strcpy(_filename, filename); @@ -158,7 +158,7 @@ TOKEN_DEF(HORIZONTAL_TILES) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUITiledImage::loadBuffer(byte *buffer, bool complete) { +bool CUITiledImage::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(TILED_IMAGE) TOKEN_TABLE(TEMPLATE) @@ -307,7 +307,7 @@ ERRORCODE CUITiledImage::loadBuffer(byte *buffer, bool complete) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUITiledImage::saveAsText(CBDynBuffer *buffer, int indent) { +bool CUITiledImage::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent, "TILED_IMAGE\n"); buffer->putTextIndent(indent, "{\n"); @@ -350,7 +350,7 @@ void CUITiledImage::correctSize(int *width, int *height) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUITiledImage::persist(CBPersistMgr *persistMgr) { +bool CUITiledImage::persist(CBPersistMgr *persistMgr) { CBObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_downLeft)); diff --git a/engines/wintermute/UI/UITiledImage.h b/engines/wintermute/UI/UITiledImage.h index 35083c15a8..379af85e81 100644 --- a/engines/wintermute/UI/UITiledImage.h +++ b/engines/wintermute/UI/UITiledImage.h @@ -39,11 +39,11 @@ class CUITiledImage : public CBObject { public: DECLARE_PERSISTENT(CUITiledImage, CBObject) void correctSize(int *width, int *height); - ERRORCODE loadFile(const char *filename); - ERRORCODE loadBuffer(byte *buffer, bool complete = true); - virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent); + bool loadFile(const char *filename); + bool loadBuffer(byte *buffer, bool complete = true); + virtual bool saveAsText(CBDynBuffer *buffer, int indent); - ERRORCODE display(int x, int y, int width, int height); + bool 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 9126a1ca7b..1541ca3a1d 100644 --- a/engines/wintermute/UI/UIWindow.cpp +++ b/engines/wintermute/UI/UIWindow.cpp @@ -113,7 +113,7 @@ void CUIWindow::cleanup() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIWindow::display(int offsetX, int offsetY) { +bool CUIWindow::display(int offsetX, int offsetY) { // go exclusive if (_mode == WINDOW_EXCLUSIVE || _mode == WINDOW_SYSTEM_EXCLUSIVE) { if (!_shieldWindow) _shieldWindow = new CUIWindow(_gameRef); @@ -207,14 +207,14 @@ ERRORCODE CUIWindow::display(int offsetX, int offsetY) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIWindow::loadFile(const char *filename) { +bool CUIWindow::loadFile(const char *filename) { byte *buffer = _gameRef->_fileManager->readWholeFile(filename); if (buffer == NULL) { _gameRef->LOG(0, "CUIWindow::LoadFile failed for file '%s'", filename); return STATUS_FAILED; } - ERRORCODE ret; + bool ret; _filename = new char [strlen(filename) + 1]; strcpy(_filename, filename); @@ -266,7 +266,7 @@ TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF(EDIT) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIWindow::loadBuffer(byte *buffer, bool complete) { +bool CUIWindow::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(WINDOW) TOKEN_TABLE(ALPHA_COLOR) @@ -575,7 +575,7 @@ ERRORCODE CUIWindow::loadBuffer(byte *buffer, bool complete) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIWindow::saveAsText(CBDynBuffer *buffer, int indent) { +bool CUIWindow::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent, "WINDOW\n"); buffer->putTextIndent(indent, "{\n"); @@ -678,7 +678,7 @@ ERRORCODE CUIWindow::saveAsText(CBDynBuffer *buffer, int indent) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIWindow::enableWidget(const char *name, bool Enable) { +bool 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; } @@ -687,7 +687,7 @@ ERRORCODE CUIWindow::enableWidget(const char *name, bool Enable) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIWindow::showWidget(const char *name, bool Visible) { +bool 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; } @@ -698,7 +698,7 @@ ERRORCODE CUIWindow::showWidget(const char *name, bool Visible) { ////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { +bool CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) { ////////////////////////////////////////////////////////////////////////// // GetWidget / GetControl ////////////////////////////////////////////////////////////////////////// @@ -1013,7 +1013,7 @@ CScValue *CUIWindow::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIWindow::scSetProperty(const char *name, CScValue *value) { +bool CUIWindow::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// // Name ////////////////////////////////////////////////////////////////////////// @@ -1128,8 +1128,8 @@ bool CUIWindow::handleMouseWheel(int Delta) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIWindow::handleMouse(TMouseEvent event, TMouseButton button) { - ERRORCODE res = CUIObject::handleMouse(event, button); +bool CUIWindow::handleMouse(TMouseEvent event, TMouseButton button) { + bool res = CUIObject::handleMouse(event, button); // handle window dragging if (!CBPlatform::isRectEmpty(&_dragRect)) { @@ -1158,7 +1158,7 @@ ERRORCODE CUIWindow::handleMouse(TMouseEvent event, TMouseButton button) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIWindow::persist(CBPersistMgr *persistMgr) { +bool CUIWindow::persist(CBPersistMgr *persistMgr) { CUIObject::persist(persistMgr); @@ -1189,7 +1189,7 @@ ERRORCODE CUIWindow::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIWindow::moveFocus(bool forward) { +bool CUIWindow::moveFocus(bool forward) { int i; bool found = false; for (i = 0; i < _widgets.getSize(); i++) { @@ -1230,7 +1230,7 @@ ERRORCODE CUIWindow::moveFocus(bool forward) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIWindow::goExclusive() { +bool CUIWindow::goExclusive() { if (_mode == WINDOW_EXCLUSIVE) return STATUS_OK; if (_mode == WINDOW_NORMAL) { @@ -1245,7 +1245,7 @@ ERRORCODE CUIWindow::goExclusive() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIWindow::goSystemExclusive() { +bool CUIWindow::goSystemExclusive() { if (_mode == WINDOW_SYSTEM_EXCLUSIVE) return STATUS_OK; makeFreezable(false); @@ -1262,7 +1262,7 @@ ERRORCODE CUIWindow::goSystemExclusive() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIWindow::close() { +bool CUIWindow::close() { if (_mode == WINDOW_SYSTEM_EXCLUSIVE) { _gameRef->unfreeze(); } @@ -1276,7 +1276,7 @@ ERRORCODE CUIWindow::close() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIWindow::listen(CBScriptHolder *param1, uint32 param2) { +bool CUIWindow::listen(CBScriptHolder *param1, uint32 param2) { CUIObject *obj = (CUIObject *)param1; switch (obj->_type) { @@ -1302,7 +1302,7 @@ void CUIWindow::makeFreezable(bool freezable) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CUIWindow::getWindowObjects(CBArray &objects, bool interactiveOnly) { +bool CUIWindow::getWindowObjects(CBArray &objects, bool interactiveOnly) { for (int i = 0; i < _widgets.getSize(); i++) { CUIObject *control = _widgets[i]; if (control->_disable && interactiveOnly) continue; diff --git a/engines/wintermute/UI/UIWindow.h b/engines/wintermute/UI/UIWindow.h index e597debaaa..f1d46711ff 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: - ERRORCODE getWindowObjects(CBArray &Objects, bool InteractiveOnly); + bool getWindowObjects(CBArray &Objects, bool InteractiveOnly); bool _pauseMusic; void cleanup(); @@ -53,38 +53,38 @@ public: virtual bool handleMouseWheel(int delta); CUIWindow *_shieldWindow; CUIButton *_shieldButton; - ERRORCODE close(); - ERRORCODE goSystemExclusive(); - ERRORCODE goExclusive(); + bool close(); + bool goSystemExclusive(); + bool goExclusive(); TWindowMode _mode; - ERRORCODE moveFocus(bool forward = true); - virtual ERRORCODE handleMouse(TMouseEvent Event, TMouseButton Button); + bool moveFocus(bool forward = true); + virtual bool handleMouse(TMouseEvent Event, TMouseButton Button); Point32 _dragFrom; bool _dragging; DECLARE_PERSISTENT(CUIWindow, CUIObject) bool _transparent; - ERRORCODE showWidget(const char *name, bool visible = true); - ERRORCODE enableWidget(const char *name, bool enable = true); + bool showWidget(const char *name, bool visible = true); + bool enableWidget(const char *name, bool enable = true); Rect32 _titleRect; Rect32 _dragRect; - virtual ERRORCODE display(int offsetX = 0, int offsetY = 0); + virtual bool display(int offsetX = 0, int offsetY = 0); CUIWindow(CBGame *inGame); virtual ~CUIWindow(); virtual bool handleKeypress(Common::Event *event, bool printable = false); CBArray _widgets; TTextAlign _titleAlign; - ERRORCODE loadFile(const char *filename); - ERRORCODE loadBuffer(byte *buffer, bool complete = true); + bool loadFile(const char *filename); + bool loadBuffer(byte *buffer, bool complete = true); CUITiledImage *_backInactive; CBFont *_fontInactive; CBSprite *_imageInactive; - virtual ERRORCODE listen(CBScriptHolder *param1, uint32 param2); - virtual ERRORCODE saveAsText(CBDynBuffer *buffer, int indent); + virtual bool listen(CBScriptHolder *param1, uint32 param2); + virtual bool saveAsText(CBDynBuffer *buffer, int indent); // scripting interface virtual CScValue *scGetProperty(const char *name); - virtual ERRORCODE scSetProperty(const char *name, CScValue *value); - virtual ERRORCODE scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name); + virtual bool scSetProperty(const char *name, CScValue *value); + virtual bool 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 0c71b3ec6e..fc1d0205c8 100644 --- a/engines/wintermute/coll_templ.h +++ b/engines/wintermute/coll_templ.h @@ -88,7 +88,7 @@ public: // Clean up void freeExtra(); void removeAll(); - ERRORCODE persist(CBPersistMgr *persistMgr); + bool persist(CBPersistMgr *persistMgr); // Accessing elements TYPE getAt(int nIndex) const; @@ -346,7 +346,7 @@ void CBArray::insertAt(int nStartIndex, CBArray *pNewArray) { ///////////////////////////////////////////////////////////////////////////// template -ERRORCODE CBArray::persist(CBPersistMgr *persistMgr) { +bool CBArray::persist(CBPersistMgr *persistMgr) { int i, j; if (persistMgr->_saving) { j = getSize(); diff --git a/engines/wintermute/persistent.h b/engines/wintermute/persistent.h index efdd651154..af1224c200 100644 --- a/engines/wintermute/persistent.h +++ b/engines/wintermute/persistent.h @@ -37,7 +37,7 @@ class CBPersistMgr; // persistence support typedef void *(*PERSISTBUILD)(void); -typedef ERRORCODE(*PERSISTLOAD)(void *, CBPersistMgr *); +typedef bool(*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 ERRORCODE persistLoad(void* Instance, CBPersistMgr* PersistMgr);\ + static bool persistLoad(void* Instance, CBPersistMgr* PersistMgr);\ class_name(TDynamicConstructor p1, TDynamicConstructor p2):parent_class(p1, p2){ /*memset(this, 0, sizeof(class_name));*/ };\ - virtual ERRORCODE persist(CBPersistMgr* PersistMgr);\ + virtual bool 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);\ }\ \ - ERRORCODE class_name::persistLoad(void* Instance, CBPersistMgr* PersistMgr){\ + bool class_name::persistLoad(void* Instance, CBPersistMgr* PersistMgr){\ return ((class_name*)Instance)->persist(PersistMgr);\ }\ \ diff --git a/engines/wintermute/video/VidPlayer.cpp b/engines/wintermute/video/VidPlayer.cpp index a962608691..93f3196eee 100644 --- a/engines/wintermute/video/VidPlayer.cpp +++ b/engines/wintermute/video/VidPlayer.cpp @@ -45,7 +45,7 @@ CVidPlayer::CVidPlayer(CBGame *inGame): CBBase(inGame) { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CVidPlayer::SetDefaults() { +bool CVidPlayer::SetDefaults() { _playing = false; /* _aviFile = NULL; @@ -91,7 +91,7 @@ CVidPlayer::~CVidPlayer() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CVidPlayer::cleanup() { +bool CVidPlayer::cleanup() { #if 0 if (_sound) _sound->Stop(); if (_videoPGF) AVIStreamGetFrameClose(_videoPGF); @@ -124,7 +124,7 @@ ERRORCODE CVidPlayer::cleanup() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CVidPlayer::initialize(const char *inFilename, const char *SubtitleFile) { +bool CVidPlayer::initialize(const char *inFilename, const char *SubtitleFile) { #if 0 cleanup(); @@ -183,7 +183,7 @@ ERRORCODE CVidPlayer::initialize(const char *inFilename, const char *SubtitleFil // create sound buffer - ERRORCODE res; + bool res; if (_soundAvailable) { _sound = new CBSoundAVI(_gameRef); @@ -204,11 +204,11 @@ ERRORCODE CVidPlayer::initialize(const char *inFilename, const char *SubtitleFil ////////////////////////////////////////////////////////////////////////// -ERRORCODE CVidPlayer::update() { +bool CVidPlayer::update() { #if 0 if (!m_Playing) return STATUS_OK; - ERRORCODE res; + bool res; if (_soundAvailable && m_Sound) { res = _sound->update(); @@ -274,11 +274,11 @@ ERRORCODE CVidPlayer::update() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CVidPlayer::display() { +bool CVidPlayer::display() { #if 0 if (!m_Playing) return STATUS_OK; - ERRORCODE res; + bool res; if (_vidRenderer) res = _vidRenderer->display(m_PlayPosX, m_PlayPosY, m_PlayZoom); else res = STATUS_FAILED; @@ -298,7 +298,7 @@ ERRORCODE CVidPlayer::display() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CVidPlayer::play(TVideoPlayback Type, int X, int Y, bool FreezeMusic) { +bool CVidPlayer::play(TVideoPlayback Type, int X, int Y, bool FreezeMusic) { #if 0 if (!_videoStream || !_vidRenderer) return STATUS_FAILED; @@ -359,7 +359,7 @@ ERRORCODE CVidPlayer::play(TVideoPlayback Type, int X, int Y, bool FreezeMusic) ////////////////////////////////////////////////////////////////////////// -ERRORCODE CVidPlayer::stop() { +bool CVidPlayer::stop() { #if 0 if (!_playing) return STATUS_OK; @@ -378,7 +378,7 @@ bool CVidPlayer::isPlaying() { ////////////////////////////////////////////////////////////////////////// -ERRORCODE CVidPlayer::loadSubtitles(const char *filename, const char *SubtitleFile) { +bool CVidPlayer::loadSubtitles(const char *filename, const char *SubtitleFile) { #if 0 if (!Filename) return STATUS_OK; diff --git a/engines/wintermute/video/VidPlayer.h b/engines/wintermute/video/VidPlayer.h index 6b729cac20..fd587aa609 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; - ERRORCODE loadSubtitles(const char *filename, const char *SubtitleFile); + bool loadSubtitles(const char *filename, const char *SubtitleFile); bool _slowRendering; bool isPlaying(); char *_filename; - ERRORCODE stop(); - ERRORCODE play(TVideoPlayback Type = VID_PLAY_CENTER, int X = 0, int Y = 0, bool FreezeMusic = true); + bool stop(); + bool 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; - ERRORCODE SetDefaults(); + bool SetDefaults(); bool _playing; - ERRORCODE display(); - ERRORCODE update(); - ERRORCODE initialize(const char *inFilename, const char *SubtitleFile = NULL); - ERRORCODE cleanup(); + bool display(); + bool update(); + bool initialize(const char *inFilename, const char *SubtitleFile = NULL); + bool cleanup(); CVidPlayer(CBGame *inGame); virtual ~CVidPlayer(); diff --git a/engines/wintermute/video/VidTheoraPlayer.cpp b/engines/wintermute/video/VidTheoraPlayer.cpp index 6a622449ab..d7e8850177 100644 --- a/engines/wintermute/video/VidTheoraPlayer.cpp +++ b/engines/wintermute/video/VidTheoraPlayer.cpp @@ -133,7 +133,7 @@ void CVidTheoraPlayer::cleanup() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CVidTheoraPlayer::initialize(const Common::String &filename, const Common::String &subtitleFile) { +bool CVidTheoraPlayer::initialize(const Common::String &filename, const Common::String &subtitleFile) { cleanup(); _filename = filename; @@ -294,7 +294,7 @@ ERRORCODE CVidTheoraPlayer::initialize(const Common::String &filename, const Com vorbis_comment_clear(&m_VorbisComment); } - ERRORCODE Res = STATUS_OK; + bool Res = STATUS_OK; // create sound buffer if (m_VorbisStreams && _gameRef->m_SoundMgr->m_SoundAvailable) { @@ -334,7 +334,7 @@ ERRORCODE CVidTheoraPlayer::initialize(const Common::String &filename, const Com ////////////////////////////////////////////////////////////////////////// -ERRORCODE CVidTheoraPlayer::resetStream() { +bool CVidTheoraPlayer::resetStream() { warning("VidTheoraPlayer::resetStream - stubbed"); #if 0 if (_sound) _sound->Stop(); @@ -347,7 +347,7 @@ ERRORCODE CVidTheoraPlayer::resetStream() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CVidTheoraPlayer::play(TVideoPlayback type, int x, int y, bool freezeGame, bool freezeMusic, bool looping, uint32 startTime, float forceZoom, int volume) { +bool 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) @@ -451,7 +451,7 @@ ERRORCODE CVidTheoraPlayer::play(TVideoPlayback type, int x, int y, bool freezeG } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CVidTheoraPlayer::stop() { +bool CVidTheoraPlayer::stop() { _theoraDecoder->close(); _state = THEORA_STATE_FINISHED; if (_freezeGame) { @@ -466,7 +466,7 @@ ERRORCODE CVidTheoraPlayer::stop() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CVidTheoraPlayer::update() { +bool CVidTheoraPlayer::update() { _currentTime = _freezeGame ? _gameRef->_liveTimer : _gameRef->_timer; if (!isPlaying()) return STATUS_OK; @@ -614,7 +614,7 @@ uint32 CVidTheoraPlayer::getMovieFrame() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CVidTheoraPlayer::WriteVideo() { +bool CVidTheoraPlayer::WriteVideo() { if (!_texture) return STATUS_FAILED; _texture->startPixelOp(); @@ -651,9 +651,9 @@ void CVidTheoraPlayer::writeAlpha() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CVidTheoraPlayer::display(uint32 alpha) { +bool CVidTheoraPlayer::display(uint32 alpha) { Rect32 rc; - ERRORCODE res; + bool res; if (_texture && _videoFrameReady) { CBPlatform::setRect(&rc, 0, 0, _texture->getWidth(), _texture->getHeight()); @@ -667,7 +667,7 @@ ERRORCODE CVidTheoraPlayer::display(uint32 alpha) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CVidTheoraPlayer::setAlphaImage(const Common::String &filename) { +bool CVidTheoraPlayer::setAlphaImage(const Common::String &filename) { warning("CVidTheoraPlayer::SetAlphaImage(%s) - Not implemented", filename.c_str()); delete _alphaImage; @@ -716,7 +716,7 @@ inline int intlog(int num) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CVidTheoraPlayer::SeekToTime(uint32 time) { +bool CVidTheoraPlayer::SeekToTime(uint32 time) { warning("CVidTheoraPlayer::SeekToTime(%d) - not supported", time); #if 0 if (!m_TheoraStreams) return STATUS_FAILED; @@ -780,7 +780,7 @@ finish: } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CVidTheoraPlayer::pause() { +bool CVidTheoraPlayer::pause() { if (_state == THEORA_STATE_PLAYING) { _state = THEORA_STATE_PAUSED; _theoraDecoder->pauseVideo(true); @@ -791,7 +791,7 @@ ERRORCODE CVidTheoraPlayer::pause() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CVidTheoraPlayer::resume() { +bool CVidTheoraPlayer::resume() { if (_state == THEORA_STATE_PAUSED) { _state = THEORA_STATE_PLAYING; _theoraDecoder->pauseVideo(false); @@ -802,7 +802,7 @@ ERRORCODE CVidTheoraPlayer::resume() { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CVidTheoraPlayer::persist(CBPersistMgr *persistMgr) { +bool CVidTheoraPlayer::persist(CBPersistMgr *persistMgr) { //CBBase::persist(persistMgr); if (persistMgr->_saving) { @@ -832,7 +832,7 @@ ERRORCODE CVidTheoraPlayer::persist(CBPersistMgr *persistMgr) { } ////////////////////////////////////////////////////////////////////////// -ERRORCODE CVidTheoraPlayer::initializeSimple() { +bool CVidTheoraPlayer::initializeSimple() { if (DID_SUCCEED(initialize(_filename))) { if (_alphaFilename != "") setAlphaImage(_alphaFilename); play(_playbackType, _posX, _posY, false, false, _looping, _savedPos, _playZoom); diff --git a/engines/wintermute/video/VidTheoraPlayer.h b/engines/wintermute/video/VidTheoraPlayer.h index 6061ad3199..74fc0ce5b4 100644 --- a/engines/wintermute/video/VidTheoraPlayer.h +++ b/engines/wintermute/video/VidTheoraPlayer.h @@ -63,16 +63,16 @@ public: //CVidSubtitler *_subtitler; // control methods - 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); + bool initialize(const Common::String &filename, const Common::String &subtitleFile = NULL); + bool initializeSimple(); + bool update(); + bool 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); + bool stop(); + bool display(uint32 alpha = 0xFFFFFFFF); + //bool RenderFrame(CBSurface *Texture, yuv_buffer *yuv); - ERRORCODE pause(); - ERRORCODE resume(); + bool pause(); + bool resume(); bool isPlaying() { return _state == THEORA_STATE_PLAYING; @@ -99,15 +99,15 @@ public: // alpha related CBImage *_alphaImage; Common::String _alphaFilename; - ERRORCODE setAlphaImage(const Common::String &filename); + bool setAlphaImage(const Common::String &filename); __inline byte getAlphaAt(int x, int y); void writeAlpha(); - ERRORCODE SeekToTime(uint32 Time); + bool SeekToTime(uint32 Time); void cleanup(); - ERRORCODE resetStream(); + bool resetStream(); // video properties TVideoPlayback _playbackType; @@ -137,7 +137,7 @@ private: bool _videoFrameReady; float _videobufTime; - ERRORCODE WriteVideo(); + bool WriteVideo(); bool _playbackStarted; diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp index 60abe21cc6..ce66e197b3 100644 --- a/engines/wintermute/wintermute.cpp +++ b/engines/wintermute/wintermute.cpp @@ -205,7 +205,7 @@ int WinterMuteEngine::init() { - ERRORCODE ret; + bool ret; // initialize the renderer ret = _game->_renderer->initRenderer(_game->_settingsResWidth, _game->_settingsResHeight, windowedMode); diff --git a/engines/wintermute/wintypes.h b/engines/wintermute/wintypes.h index 678fb6bb6b..04a657c644 100644 --- a/engines/wintermute/wintypes.h +++ b/engines/wintermute/wintypes.h @@ -41,10 +41,8 @@ namespace WinterMute { #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 DID_SUCCEED(hr) ((bool)(hr)) +#define DID_FAIL(hr) (!((bool)(hr))) #define STATUS_OK (true) #define STATUS_FAILED (false) -- cgit v1.2.3