From de74b1d018d8271081ea1c0127f8fa90b678dd02 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Wed, 4 Jul 2012 21:57:21 +0200 Subject: WINTERMUTE: Rename FuncName/VarName -> funcName/varName in the rest of the Ad-classes. --- engines/wintermute/Ad/AdActor.cpp | 2 +- engines/wintermute/Ad/AdEntity.cpp | 2 +- engines/wintermute/Ad/AdObject.cpp | 2 +- engines/wintermute/Ad/AdSceneNode.cpp | 12 ++--- engines/wintermute/Ad/AdSceneNode.h | 4 +- engines/wintermute/Ad/AdSentence.cpp | 34 ++++++------ engines/wintermute/Ad/AdSentence.h | 2 +- engines/wintermute/Ad/AdSpriteSet.cpp | 47 ++++++++--------- engines/wintermute/Ad/AdSpriteSet.h | 2 +- engines/wintermute/Ad/AdTalkHolder.cpp | 87 +++++++++++++++++-------------- engines/wintermute/Ad/AdTalkNode.cpp | 25 +++++---- engines/wintermute/Ad/AdTypes.h | 40 +++++++++----- engines/wintermute/Ad/AdWaypointGroup.cpp | 23 ++++---- engines/wintermute/Ad/AdWaypointGroup.h | 2 +- 14 files changed, 155 insertions(+), 129 deletions(-) (limited to 'engines') diff --git a/engines/wintermute/Ad/AdActor.cpp b/engines/wintermute/Ad/AdActor.cpp index 04152db456..4724be5c1d 100644 --- a/engines/wintermute/Ad/AdActor.cpp +++ b/engines/wintermute/Ad/AdActor.cpp @@ -410,7 +410,7 @@ HRESULT CAdActor::loadBuffer(byte *buffer, bool complete) { } else { _wptGroup = wpt; _currentWptGroup = cwpt; - _currentWptGroup->Mimic(_wptGroup); + _currentWptGroup->mimic(_wptGroup); } } break; diff --git a/engines/wintermute/Ad/AdEntity.cpp b/engines/wintermute/Ad/AdEntity.cpp index c4de591706..ef87d90a32 100644 --- a/engines/wintermute/Ad/AdEntity.cpp +++ b/engines/wintermute/Ad/AdEntity.cpp @@ -366,7 +366,7 @@ HRESULT CAdEntity::loadBuffer(byte *buffer, bool complete) { } else { _wptGroup = wpt; _currentWptGroup = cwpt; - _currentWptGroup->Mimic(_wptGroup); + _currentWptGroup->mimic(_wptGroup); } } break; diff --git a/engines/wintermute/Ad/AdObject.cpp b/engines/wintermute/Ad/AdObject.cpp index d7d829445b..f594f91100 100644 --- a/engines/wintermute/Ad/AdObject.cpp +++ b/engines/wintermute/Ad/AdObject.cpp @@ -1043,7 +1043,7 @@ HRESULT CAdObject::updateBlockRegion() { _currentBlockRegion->Mimic(_blockRegion, _zoomable ? adGame->_scene->getScaleAt(_posY) : 100.0f, _posX, _posY); if (_wptGroup && _currentWptGroup) - _currentWptGroup->Mimic(_wptGroup, _zoomable ? adGame->_scene->getScaleAt(_posY) : 100.0f, _posX, _posY); + _currentWptGroup->mimic(_wptGroup, _zoomable ? adGame->_scene->getScaleAt(_posY) : 100.0f, _posX, _posY); } return S_OK; } diff --git a/engines/wintermute/Ad/AdSceneNode.cpp b/engines/wintermute/Ad/AdSceneNode.cpp index 2c734bf87b..0fc4a6a7d6 100644 --- a/engines/wintermute/Ad/AdSceneNode.cpp +++ b/engines/wintermute/Ad/AdSceneNode.cpp @@ -53,18 +53,18 @@ CAdSceneNode::~CAdSceneNode() { ////////////////////////////////////////////////////////////////////////// -HRESULT CAdSceneNode::setEntity(CAdEntity *Entity) { +HRESULT CAdSceneNode::setEntity(CAdEntity *entity) { _type = OBJECT_ENTITY; - _entity = Entity; - return Game->registerObject(Entity); + _entity = entity; + return Game->registerObject(entity); } ////////////////////////////////////////////////////////////////////////// -HRESULT CAdSceneNode::setRegion(CAdRegion *Region) { +HRESULT CAdSceneNode::setRegion(CAdRegion *region) { _type = OBJECT_REGION; - _region = Region; - return Game->registerObject(Region); + _region = region; + return Game->registerObject(region); } diff --git a/engines/wintermute/Ad/AdSceneNode.h b/engines/wintermute/Ad/AdSceneNode.h index 198a83beb8..0ba0c5d7b6 100644 --- a/engines/wintermute/Ad/AdSceneNode.h +++ b/engines/wintermute/Ad/AdSceneNode.h @@ -39,8 +39,8 @@ namespace WinterMute { class CAdSceneNode : public CBObject { public: DECLARE_PERSISTENT(CAdSceneNode, CBObject) - HRESULT setRegion(CAdRegion *Region); - HRESULT setEntity(CAdEntity *Entity); + HRESULT setRegion(CAdRegion *region); + HRESULT setEntity(CAdEntity *entity); CAdEntity *_entity; CAdRegion *_region; TObjectType _type; diff --git a/engines/wintermute/Ad/AdSentence.cpp b/engines/wintermute/Ad/AdSentence.cpp index d95fd313e0..7548655ee6 100644 --- a/engines/wintermute/Ad/AdSentence.cpp +++ b/engines/wintermute/Ad/AdSentence.cpp @@ -122,7 +122,7 @@ char *CAdSentence::getNextStance() { ////////////////////////////////////////////////////////////////////////// -char *CAdSentence::getStance(int Stance) { +char *CAdSentence::getStance(int stance) { if (_stances == NULL) return NULL; if (_tempStance) delete [] _tempStance; @@ -132,17 +132,17 @@ char *CAdSentence::getStance(int Stance) { char *curr; int pos; - if (Stance == 0) start = _stances; + if (stance == 0) start = _stances; else { pos = 0; start = NULL; curr = _stances; - while (pos < Stance) { + while (pos < stance) { if (*curr == '\0') break; if (*curr == ',') pos++; curr++; } - if (pos == Stance) start = curr; + if (pos == stance) start = curr; } if (start == NULL) return NULL; @@ -273,23 +273,23 @@ HRESULT CAdSentence::setupTalkFile(const char *soundFilename) { HRESULT CAdSentence::update(TDirection dir) { if (!_talkDef) return S_OK; - uint32 CurrentTime; + uint32 currentTime; // if sound is available, synchronize with sound, otherwise use timer /* if (_sound) CurrentTime = _sound->GetPositionTime(); else CurrentTime = Game->_timer - _startTime; */ - CurrentTime = Game->_timer - _startTime; + currentTime = Game->_timer - _startTime; - bool TalkNodeFound = false; + bool talkNodeFound = false; for (int i = 0; i < _talkDef->_nodes.GetSize(); i++) { - if (_talkDef->_nodes[i]->isInTimeInterval(CurrentTime, dir)) { - TalkNodeFound = true; + if (_talkDef->_nodes[i]->isInTimeInterval(currentTime, dir)) { + talkNodeFound = true; - CBSprite *NewSprite = _talkDef->_nodes[i]->getSprite(dir); - if (NewSprite != _currentSprite) NewSprite->Reset(); - _currentSprite = NewSprite; + CBSprite *newSprite = _talkDef->_nodes[i]->getSprite(dir); + if (newSprite != _currentSprite) newSprite->Reset(); + _currentSprite = newSprite; if (!_talkDef->_nodes[i]->_playToEnd) break; } @@ -297,11 +297,11 @@ HRESULT CAdSentence::update(TDirection dir) { // no talk node, try to use default sprite instead (if any) - if (!TalkNodeFound) { - CBSprite *NewSprite = _talkDef->getDefaultSprite(dir); - if (NewSprite) { - if (NewSprite != _currentSprite) NewSprite->Reset(); - _currentSprite = NewSprite; + if (!talkNodeFound) { + CBSprite *newSprite = _talkDef->getDefaultSprite(dir); + if (newSprite) { + if (newSprite != _currentSprite) newSprite->Reset(); + _currentSprite = newSprite; } else _currentSprite = NULL; } diff --git a/engines/wintermute/Ad/AdSentence.h b/engines/wintermute/Ad/AdSentence.h index 7a5fe6e891..38b44bd619 100644 --- a/engines/wintermute/Ad/AdSentence.h +++ b/engines/wintermute/Ad/AdSentence.h @@ -74,7 +74,7 @@ public: private: char *_tempStance; - char *getStance(int Stance); + char *getStance(int stance); }; diff --git a/engines/wintermute/Ad/AdSpriteSet.cpp b/engines/wintermute/Ad/AdSpriteSet.cpp index 111f7ff535..26844667d9 100644 --- a/engines/wintermute/Ad/AdSpriteSet.cpp +++ b/engines/wintermute/Ad/AdSpriteSet.cpp @@ -38,8 +38,8 @@ namespace WinterMute { IMPLEMENT_PERSISTENT(CAdSpriteSet, false) ////////////////////////////////////////////////////////////////////////// -CAdSpriteSet::CAdSpriteSet(CBGame *inGame, CBObject *Owner): CBObject(inGame) { - _owner = Owner; +CAdSpriteSet::CAdSpriteSet(CBGame *inGame, CBObject *owner): CBObject(inGame) { + _owner = owner; for (int i = 0; i < NUM_DIRECTIONS; i++) _sprites[i] = NULL; @@ -90,7 +90,7 @@ TOKEN_DEF(TEMPLATE) TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -HRESULT CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int LifeTime, TSpriteCacheType CacheType) { +HRESULT CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteCacheType CacheType) { TOKEN_TABLE_START(commands) TOKEN_TABLE(SPRITESET) TOKEN_TABLE(NAME) @@ -122,7 +122,7 @@ HRESULT CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int LifeTime, TSpr while ((cmd = parser.GetCommand((char **)&buffer, commands, (char **)¶ms)) > 0) { switch (cmd) { case TOKEN_TEMPLATE: - if (FAILED(loadFile((char *)params, LifeTime, CacheType))) cmd = PARSERR_GENERIC; + if (FAILED(loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC; break; case TOKEN_NAME: @@ -133,7 +133,7 @@ HRESULT CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int LifeTime, TSpr delete _sprites[DI_LEFT]; _sprites[DI_LEFT] = NULL; spr = new CBSprite(Game, _owner); - if (!spr || FAILED(spr->loadFile((char *)params, LifeTime, CacheType))) cmd = PARSERR_GENERIC; + if (!spr || FAILED(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC; else _sprites[DI_LEFT] = spr; break; @@ -141,7 +141,7 @@ HRESULT CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int LifeTime, TSpr delete _sprites[DI_RIGHT]; _sprites[DI_RIGHT] = NULL; spr = new CBSprite(Game, _owner); - if (!spr || FAILED(spr->loadFile((char *)params, LifeTime, CacheType))) cmd = PARSERR_GENERIC; + if (!spr || FAILED(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC; else _sprites[DI_RIGHT] = spr; break; @@ -149,7 +149,7 @@ HRESULT CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int LifeTime, TSpr delete _sprites[DI_UP]; _sprites[DI_UP] = NULL; spr = new CBSprite(Game, _owner); - if (!spr || FAILED(spr->loadFile((char *)params, LifeTime, CacheType))) cmd = PARSERR_GENERIC; + if (!spr || FAILED(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC; else _sprites[DI_UP] = spr; break; @@ -157,7 +157,7 @@ HRESULT CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int LifeTime, TSpr delete _sprites[DI_DOWN]; _sprites[DI_DOWN] = NULL; spr = new CBSprite(Game, _owner); - if (!spr || FAILED(spr->loadFile((char *)params, LifeTime, CacheType))) cmd = PARSERR_GENERIC; + if (!spr || FAILED(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC; else _sprites[DI_DOWN] = spr; break; @@ -165,7 +165,7 @@ HRESULT CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int LifeTime, TSpr delete _sprites[DI_UPLEFT]; _sprites[DI_UPLEFT] = NULL; spr = new CBSprite(Game, _owner); - if (!spr || FAILED(spr->loadFile((char *)params, LifeTime, CacheType))) cmd = PARSERR_GENERIC; + if (!spr || FAILED(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC; else _sprites[DI_UPLEFT] = spr; break; @@ -173,7 +173,7 @@ HRESULT CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int LifeTime, TSpr delete _sprites[DI_UPRIGHT]; _sprites[DI_UPRIGHT] = NULL; spr = new CBSprite(Game, _owner); - if (!spr || FAILED(spr->loadFile((char *)params, LifeTime, CacheType))) cmd = PARSERR_GENERIC; + if (!spr || FAILED(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC; else _sprites[DI_UPRIGHT] = spr; break; @@ -181,7 +181,7 @@ HRESULT CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int LifeTime, TSpr delete _sprites[DI_DOWNLEFT]; _sprites[DI_DOWNLEFT] = NULL; spr = new CBSprite(Game, _owner); - if (!spr || FAILED(spr->loadFile((char *)params, LifeTime, CacheType))) cmd = PARSERR_GENERIC; + if (!spr || FAILED(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC; else _sprites[DI_DOWNLEFT] = spr; break; @@ -189,7 +189,7 @@ HRESULT CAdSpriteSet::loadBuffer(byte *buffer, bool complete, int LifeTime, TSpr delete _sprites[DI_DOWNRIGHT]; _sprites[DI_DOWNRIGHT] = NULL; spr = new CBSprite(Game, _owner); - if (!spr || FAILED(spr->loadFile((char *)params, LifeTime, CacheType))) cmd = PARSERR_GENERIC; + if (!spr || FAILED(spr->loadFile((char *)params, lifeTime, CacheType))) cmd = PARSERR_GENERIC; else _sprites[DI_DOWNRIGHT] = spr; break; @@ -229,26 +229,25 @@ HRESULT CAdSpriteSet::persist(CBPersistMgr *persistMgr) { ////////////////////////////////////////////////////////////////////////// CBSprite *CAdSpriteSet::getSprite(TDirection direction) { - int Dir = (int)direction; - if (Dir < 0) Dir = 0; - if (Dir >= NUM_DIRECTIONS) Dir = NUM_DIRECTIONS - 1; + int dir = (int)direction; + if (dir < 0) dir = 0; + if (dir >= NUM_DIRECTIONS) dir = NUM_DIRECTIONS - 1; CBSprite *ret = NULL; // find nearest set sprite - int i; - int NumSteps = 0; - for (i = Dir, NumSteps = 0; i >= 0; i--) { + int numSteps = 0; + for (int i = dir, NumSteps = 0; i >= 0; i--) { if (_sprites[i] != NULL) { ret = _sprites[i]; - NumSteps = Dir - i; + numSteps = dir - i; break; } } - for (i = Dir; i < NUM_DIRECTIONS; i++) { + for (int i = dir; i < NUM_DIRECTIONS; i++) { if (_sprites[i] != NULL) { - if (ret == NULL || NumSteps > i - Dir) return _sprites[i]; + if (ret == NULL || numSteps > i - dir) return _sprites[i]; else return ret; } } @@ -301,11 +300,11 @@ HRESULT CAdSpriteSet::saveAsText(CBDynBuffer *buffer, int indent) { } ////////////////////////////////////////////////////////////////////////// -bool CAdSpriteSet::containsSprite(CBSprite *Sprite) { - if (!Sprite) return false; +bool CAdSpriteSet::containsSprite(CBSprite *sprite) { + if (!sprite) return false; for (int i = 0; i < NUM_DIRECTIONS; i++) { - if (_sprites[i] == Sprite) return true; + if (_sprites[i] == sprite) return true; } return false; } diff --git a/engines/wintermute/Ad/AdSpriteSet.h b/engines/wintermute/Ad/AdSpriteSet.h index e1e527c267..7d457048df 100644 --- a/engines/wintermute/Ad/AdSpriteSet.h +++ b/engines/wintermute/Ad/AdSpriteSet.h @@ -45,7 +45,7 @@ public: CAdSpriteSet(CBGame *inGame, CBObject *owner = NULL); virtual ~CAdSpriteSet(); HRESULT loadFile(const char *filename, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL); - HRESULT loadBuffer(byte *buffer, bool complete = true, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL); + HRESULT loadBuffer(byte *buffer, bool complete = true, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL); CBSprite *_sprites[NUM_DIRECTIONS]; }; diff --git a/engines/wintermute/Ad/AdTalkHolder.cpp b/engines/wintermute/Ad/AdTalkHolder.cpp index d5746a4530..9d4c4c8e8b 100644 --- a/engines/wintermute/Ad/AdTalkHolder.cpp +++ b/engines/wintermute/Ad/AdTalkHolder.cpp @@ -53,11 +53,12 @@ CAdTalkHolder::~CAdTalkHolder() { delete _sprite; _sprite = NULL; - int i; - for (i = 0; i < _talkSprites.GetSize(); i++) delete _talkSprites[i]; + for (int i = 0; i < _talkSprites.GetSize(); i++) + delete _talkSprites[i]; _talkSprites.RemoveAll(); - for (i = 0; i < _talkSpritesEx.GetSize(); i++) delete _talkSpritesEx[i]; + for (int i = 0; i < _talkSpritesEx.GetSize(); i++) + delete _talkSpritesEx[i]; _talkSpritesEx.RemoveAll(); } @@ -125,27 +126,27 @@ HRESULT CAdTalkHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack if (strcmp(name, "SetSprite") == 0) { stack->correctParams(1); - CScValue *Val = stack->pop(); + CScValue *val = stack->pop(); - bool SetCurrent = false; - if (_currentSprite && _currentSprite == _sprite) SetCurrent = true; + bool setCurrent = false; + if (_currentSprite && _currentSprite == _sprite) setCurrent = true; delete _sprite; _sprite = NULL; - if (Val->isNULL()) { + if (val->isNULL()) { _sprite = NULL; - if (SetCurrent) _currentSprite = NULL; + if (setCurrent) _currentSprite = NULL; stack->pushBool(true); } else { - const char *filename = Val->getString(); + const char *filename = val->getString(); CBSprite *spr = new CBSprite(Game, this); if (!spr || FAILED(spr->loadFile(filename))) { script->RuntimeError("SetSprite method failed for file '%s'", filename); stack->pushBool(false); } else { _sprite = spr; - if (SetCurrent) _currentSprite = _sprite; + if (setCurrent) _currentSprite = _sprite; stack->pushBool(true); } } @@ -202,27 +203,30 @@ HRESULT CAdTalkHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack stack->correctParams(2); const char *filename = stack->pop()->getString(); - bool Ex = stack->pop()->getBool(); - int i; + bool ex = stack->pop()->getBool(); - bool SetCurrent = false; - bool SetTemp2 = false; + bool setCurrent = false; + bool setTemp2 = false; - if (Ex) { - for (i = 0; i < _talkSpritesEx.GetSize(); i++) { + if (ex) { + for (int i = 0; i < _talkSpritesEx.GetSize(); i++) { if (scumm_stricmp(_talkSpritesEx[i]->_filename, filename) == 0) { - if (_currentSprite == _talkSpritesEx[i]) SetCurrent = true; - if (_tempSprite2 == _talkSpritesEx[i]) SetTemp2 = true; + if (_currentSprite == _talkSpritesEx[i]) + setCurrent = true; + if (_tempSprite2 == _talkSpritesEx[i]) + setTemp2 = true; delete _talkSpritesEx[i]; _talkSpritesEx.RemoveAt(i); break; } } } else { - for (i = 0; i < _talkSprites.GetSize(); i++) { + for (int i = 0; i < _talkSprites.GetSize(); i++) { if (scumm_stricmp(_talkSprites[i]->_filename, filename) == 0) { - if (_currentSprite == _talkSprites[i]) SetCurrent = true; - if (_tempSprite2 == _talkSprites[i]) SetTemp2 = true; + if (_currentSprite == _talkSprites[i]) + setCurrent = true; + if (_tempSprite2 == _talkSprites[i]) + setTemp2 = true; delete _talkSprites[i]; _talkSprites.RemoveAt(i); break; @@ -232,8 +236,10 @@ HRESULT CAdTalkHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack } stack->pushBool(true); - if (SetCurrent) _currentSprite = _sprite; - if (SetTemp2) _tempSprite2 = _sprite; + if (setCurrent) + _currentSprite = _sprite; + if (setTemp2) + _tempSprite2 = _sprite; return S_OK; } @@ -245,9 +251,9 @@ HRESULT CAdTalkHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack stack->correctParams(2); const char *filename = stack->pop()->getString(); - bool Ex = stack->pop()->getBool(); - bool SetCurrent = false; - bool SetTemp2 = false; + bool ex = stack->pop()->getBool(); + bool setCurrent = false; + bool setTemp2 = false; CBSprite *spr = new CBSprite(Game, this); if (!spr || FAILED(spr->loadFile(filename))) { @@ -256,30 +262,35 @@ HRESULT CAdTalkHolder::scCallMethod(CScScript *script, CScStack *stack, CScStack } else { // delete current - int i; - if (Ex) { - for (i = 0; i < _talkSpritesEx.GetSize(); i++) { - if (_talkSpritesEx[i] == _currentSprite) SetCurrent = true; - if (_talkSpritesEx[i] == _tempSprite2) SetTemp2 = true; + if (ex) { + for (int i = 0; i < _talkSpritesEx.GetSize(); i++) { + if (_talkSpritesEx[i] == _currentSprite) + setCurrent = true; + if (_talkSpritesEx[i] == _tempSprite2) + setTemp2 = true; delete _talkSpritesEx[i]; } _talkSpritesEx.RemoveAll(); } else { - for (i = 0; i < _talkSprites.GetSize(); i++) { - if (_talkSprites[i] == _currentSprite) SetCurrent = true; - if (_talkSprites[i] == _tempSprite2) SetTemp2 = true; + for (int i = 0; i < _talkSprites.GetSize(); i++) { + if (_talkSprites[i] == _currentSprite) setCurrent = true; + if (_talkSprites[i] == _tempSprite2) setTemp2 = true; delete _talkSprites[i]; } _talkSprites.RemoveAll(); } // set new - if (Ex) _talkSpritesEx.Add(spr); - else _talkSprites.Add(spr); + if (ex) + _talkSpritesEx.Add(spr); + else + _talkSprites.Add(spr); stack->pushBool(true); - if (SetCurrent) _currentSprite = spr; - if (SetTemp2) _tempSprite2 = spr; + if (setCurrent) + _currentSprite = spr; + if (setTemp2) + _tempSprite2 = spr; } return S_OK; } diff --git a/engines/wintermute/Ad/AdTalkNode.cpp b/engines/wintermute/Ad/AdTalkNode.cpp index 0880e1f7ac..0cfadf396a 100644 --- a/engines/wintermute/Ad/AdTalkNode.cpp +++ b/engines/wintermute/Ad/AdTalkNode.cpp @@ -161,22 +161,25 @@ HRESULT CAdTalkNode::loadBuffer(byte *buffer, bool complete) { return E_FAIL; } - if (_endTime == 0) _playToEnd = true; - else _playToEnd = false; + if (_endTime == 0) + _playToEnd = true; + else + _playToEnd = false; if (_preCache && _spriteFilename) { delete _sprite; _sprite = new CBSprite(Game); - if (!_sprite || FAILED(_sprite->loadFile(_spriteFilename))) return E_FAIL; + if (!_sprite || FAILED(_sprite->loadFile(_spriteFilename))) + return E_FAIL; } if (_preCache && _spriteSetFilename) { delete _spriteSet; _spriteSet = new CAdSpriteSet(Game); - if (!_spriteSet || FAILED(_spriteSet->loadFile(_spriteSetFilename))) return E_FAIL; + if (!_spriteSet || FAILED(_spriteSet->loadFile(_spriteSetFilename))) + return E_FAIL; } - return S_OK; } @@ -241,22 +244,22 @@ HRESULT CAdTalkNode::loadSprite() { ////////////////////////////////////////////////////////////////////////// -bool CAdTalkNode::isInTimeInterval(uint32 Time, TDirection Dir) { - if (Time >= _startTime) { +bool CAdTalkNode::isInTimeInterval(uint32 time, TDirection dir) { + if (time >= _startTime) { if (_playToEnd) { if ((_spriteFilename && _sprite == NULL) || (_sprite && _sprite->_finished == false)) return true; - else if ((_spriteSetFilename && _spriteSet == NULL) || (_spriteSet && _spriteSet->getSprite(Dir) && _spriteSet->getSprite(Dir)->_finished == false)) return true; + else if ((_spriteSetFilename && _spriteSet == NULL) || (_spriteSet && _spriteSet->getSprite(dir) && _spriteSet->getSprite(dir)->_finished == false)) return true; else return false; - } else return _endTime >= Time; + } else return _endTime >= time; } else return false; } ////////////////////////////////////////////////////////////////////////// -CBSprite *CAdTalkNode::getSprite(TDirection Dir) { +CBSprite *CAdTalkNode::getSprite(TDirection dir) { loadSprite(); if (_sprite) return _sprite; - else if (_spriteSet) return _spriteSet->getSprite(Dir); + else if (_spriteSet) return _spriteSet->getSprite(dir); else return NULL; } diff --git a/engines/wintermute/Ad/AdTypes.h b/engines/wintermute/Ad/AdTypes.h index 6531927350..b88d6fe259 100644 --- a/engines/wintermute/Ad/AdTypes.h +++ b/engines/wintermute/Ad/AdTypes.h @@ -32,20 +32,22 @@ namespace WinterMute { typedef enum { - GAME_NORMAL, GAME_WAITING_RESPONSE + GAME_NORMAL, + GAME_WAITING_RESPONSE } TGameStateEx; - typedef enum { - OBJECT_ENTITY, OBJECT_REGION, OBJECT_ACTOR, OBJECT_NONE + OBJECT_ENTITY, + OBJECT_REGION, + OBJECT_ACTOR, + OBJECT_NONE } TObjectType; - typedef enum { - ENTITY_NORMAL, ENTITY_SOUND + ENTITY_NORMAL, + ENTITY_SOUND } TEntityType; - typedef enum { STATE_NONE, STATE_IDLE, @@ -63,29 +65,41 @@ typedef enum { } TObjectState; typedef enum { - DIRECT_WALK_NONE, DIRECT_WALK_FW, DIRECT_WALK_BK + DIRECT_WALK_NONE, + DIRECT_WALK_FW, + DIRECT_WALK_BK } TDirectWalkMode; typedef enum { - DIRECT_TURN_NONE, DIRECT_TURN_CW, DIRECT_TURN_CCW + DIRECT_TURN_NONE, + DIRECT_TURN_CW, + DIRECT_TURN_CCW } TDirectTurnMode; typedef enum { - RESPONSE_TEXT, RESPONSE_ICON + RESPONSE_TEXT, + RESPONSE_ICON } TResponseStyle; typedef enum { - RESPONSE_ALWAYS, RESPONSE_ONCE, RESPONSE_ONCE_GAME + RESPONSE_ALWAYS, + RESPONSE_ONCE, + RESPONSE_ONCE_GAME } TResponseType; typedef enum { - TALK_SKIP_LEFT = 0, TALK_SKIP_RIGHT = 1, TALK_SKIP_BOTH = 2, TALK_SKIP_NONE = 3 + TALK_SKIP_LEFT = 0, + TALK_SKIP_RIGHT = 1, + TALK_SKIP_BOTH = 2, + TALK_SKIP_NONE = 3 } TTalkSkipButton; - typedef enum { - GEOM_WAYPOINT, GEOM_WALKPLANE, GEOM_BLOCKED, GEOM_GENERIC + GEOM_WAYPOINT, + GEOM_WALKPLANE, + GEOM_BLOCKED, + GEOM_GENERIC } TGeomNodeType; } // end of namespace WinterMute diff --git a/engines/wintermute/Ad/AdWaypointGroup.cpp b/engines/wintermute/Ad/AdWaypointGroup.cpp index 22727834c5..0dde814fed 100644 --- a/engines/wintermute/Ad/AdWaypointGroup.cpp +++ b/engines/wintermute/Ad/AdWaypointGroup.cpp @@ -170,7 +170,8 @@ HRESULT CAdWaypointGroup::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "EDITOR_SELECTED=%s\n", _editorSelected ? "TRUE" : "FALSE"); buffer->putTextIndent(indent + 2, "EDITOR_SELECTED_POINT=%d\n", _editorSelectedPoint); - if (_scProp) _scProp->saveAsText(buffer, indent + 2); + if (_scProp) + _scProp->saveAsText(buffer, indent + 2); CBBase::saveAsText(buffer, indent + 2); for (int i = 0; i < _points.GetSize(); i++) { @@ -238,23 +239,21 @@ HRESULT CAdWaypointGroup::scSetProperty(const char *name, CScValue *value) { ////////////////////////////////////////////////////////////////////////// -HRESULT CAdWaypointGroup::Mimic(CAdWaypointGroup *Wpt, float Scale, int X, int Y) { - if (Scale == _lastMimicScale && X == _lastMimicX && Y == _lastMimicY) return S_OK; +HRESULT CAdWaypointGroup::mimic(CAdWaypointGroup *wpt, float scale, int argX, int argY) { + if (scale == _lastMimicScale && argX == _lastMimicX && argY == _lastMimicY) return S_OK; cleanup(); - for (int i = 0; i < Wpt->_points.GetSize(); i++) { - int x, y; + for (int i = 0; i < wpt->_points.GetSize(); i++) { + int x = (int)((float)wpt->_points[i]->x * scale / 100.0f); + int y = (int)((float)wpt->_points[i]->y * scale / 100.0f); - x = (int)((float)Wpt->_points[i]->x * Scale / 100.0f); - y = (int)((float)Wpt->_points[i]->y * Scale / 100.0f); - - _points.Add(new CBPoint(x + X, y + Y)); + _points.Add(new CBPoint(x + argX, y + argY)); } - _lastMimicScale = Scale; - _lastMimicX = X; - _lastMimicY = Y; + _lastMimicScale = scale; + _lastMimicX = argX; + _lastMimicY = argY; return S_OK; } diff --git a/engines/wintermute/Ad/AdWaypointGroup.h b/engines/wintermute/Ad/AdWaypointGroup.h index 690bdf972d..6b4d65f0dd 100644 --- a/engines/wintermute/Ad/AdWaypointGroup.h +++ b/engines/wintermute/Ad/AdWaypointGroup.h @@ -39,7 +39,7 @@ public: int _lastMimicX; int _lastMimicY; void cleanup(); - HRESULT Mimic(CAdWaypointGroup *Wpt, float Scale = 100.0f, int X = 0, int Y = 0); + HRESULT mimic(CAdWaypointGroup *wpt, float scale = 100.0f, int x = 0, int y = 0); DECLARE_PERSISTENT(CAdWaypointGroup, CBObject) virtual HRESULT saveAsText(CBDynBuffer *buffer, int indent); bool _active; -- cgit v1.2.3