From 9bbbcf268d72261d7d82a13d0652c9fa59abc7d7 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 2 Oct 2013 10:52:40 +0200 Subject: SAGA: Clean up variable scope --- engines/saga/sprite.cpp | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) (limited to 'engines/saga') 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); -- cgit v1.2.3