diff options
author | Willem Jan Palenstijn | 2013-10-02 10:52:40 +0200 |
---|---|---|
committer | Willem Jan Palenstijn | 2013-10-02 10:52:40 +0200 |
commit | 9bbbcf268d72261d7d82a13d0652c9fa59abc7d7 (patch) | |
tree | 4745ad1c097bdd9cb359f6311bb6765461e8eb32 /engines/saga | |
parent | 693947ddfc77ff6b0a0089d485f8819db8ccebe0 (diff) | |
download | scummvm-rg350-9bbbcf268d72261d7d82a13d0652c9fa59abc7d7.tar.gz scummvm-rg350-9bbbcf268d72261d7d82a13d0652c9fa59abc7d7.tar.bz2 scummvm-rg350-9bbbcf268d72261d7d82a13d0652c9fa59abc7d7.zip |
SAGA: Clean up variable scope
Diffstat (limited to 'engines/saga')
-rw-r--r-- | engines/saga/sprite.cpp | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/engines/saga/sprite.cpp b/engines/saga/sprite.cpp index fe281afe3e..bf550659e9 100644 --- a/engines/saga/sprite.cpp +++ b/engines/saga/sprite.cpp @@ -71,17 +71,7 @@ Sprite::~Sprite() { } void Sprite::loadList(int resourceId, SpriteList &spriteList) { - SpriteInfo *spriteInfo; ByteArray spriteListData; - uint16 oldSpriteCount; - uint16 newSpriteCount; - uint16 spriteCount; - uint i; - int outputLength, inputLength; - uint32 offset; - const byte *spritePointer; - const byte *spriteDataPointer; - _vm->_resource->loadResource(_spriteContext, resourceId, spriteListData); if (spriteListData.empty()) { @@ -90,18 +80,19 @@ void Sprite::loadList(int resourceId, SpriteList &spriteList) { ByteArrayReadStreamEndian readS(spriteListData, _spriteContext->isBigEndian()); - spriteCount = readS.readUint16(); + uint16 spriteCount = readS.readUint16(); debug(9, "Sprites: %d", spriteCount); - oldSpriteCount = spriteList.size(); - newSpriteCount = oldSpriteCount + spriteCount; + uint16 oldSpriteCount = spriteList.size(); + uint16 newSpriteCount = oldSpriteCount + spriteCount; spriteList.resize(newSpriteCount); bool bigHeader = _vm->getGameId() == GID_IHNM || _vm->isMacResources(); - for (i = oldSpriteCount; i < spriteList.size(); i++) { + for (uint i = oldSpriteCount; i < spriteList.size(); i++) { + uint32 offset; if (bigHeader) offset = readS.readUint32(); else @@ -114,10 +105,11 @@ void Sprite::loadList(int resourceId, SpriteList &spriteList) { return; } - spritePointer = spriteListData.getBuffer(); + const byte *spritePointer = spriteListData.getBuffer(); spritePointer += offset; - spriteInfo = &spriteList[i]; + const byte *spriteDataPointer; + SpriteInfo *spriteInfo = &spriteList[i]; if (bigHeader) { Common::MemoryReadStreamEndian readS2(spritePointer, 8, _spriteContext->isBigEndian()); @@ -139,8 +131,8 @@ void Sprite::loadList(int resourceId, SpriteList &spriteList) { spriteDataPointer = spritePointer + readS2.pos(); } - outputLength = spriteInfo->width * spriteInfo->height; - inputLength = spriteListData.size() - (spriteDataPointer - spriteListData.getBuffer()); + int outputLength = spriteInfo->width * spriteInfo->height; + int inputLength = spriteListData.size() - (spriteDataPointer - spriteListData.getBuffer()); spriteInfo->decodedBuffer.resize(outputLength); if (outputLength > 0) { decodeRLEBuffer(spriteDataPointer, inputLength, outputLength); |