diff options
Diffstat (limited to 'sword1/screen.cpp')
-rw-r--r-- | sword1/screen.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/sword1/screen.cpp b/sword1/screen.cpp index 076aa3cbb5..85708bc34f 100644 --- a/sword1/screen.cpp +++ b/sword1/screen.cpp @@ -221,6 +221,7 @@ void SwordScreen::updateScreen(void) { } void SwordScreen::newScreen(uint32 screen) { + uint8 cnt; // set sizes and scrolling, initialize/load screengrid, force screen refresh _currentScreen = screen; _scrnSizeX = _roomDefTable[screen].sizeX; @@ -243,13 +244,13 @@ void SwordScreen::newScreen(uint32 screen) { _screenBuf = (uint8*)malloc(_scrnSizeX * _scrnSizeY); _screenGrid = (uint8*)malloc(_gridSizeX * _gridSizeY); memset(_screenGrid, 0x80, _gridSizeX * _gridSizeY); // force refresh - for (uint8 cnt = 0; cnt < _roomDefTable[_currentScreen].totalLayers; cnt++) { + for (cnt = 0; cnt < _roomDefTable[_currentScreen].totalLayers; cnt++) { // open and lock all resources, will be closed in quitScreen() _layerBlocks[cnt] = (uint8*)_resMan->openFetchRes(_roomDefTable[_currentScreen].layers[cnt]); if (cnt > 0) _layerBlocks[cnt] += sizeof(Header); } - for (uint8 cnt = 0; cnt < _roomDefTable[_currentScreen].totalLayers - 1; cnt++) { + for (cnt = 0; cnt < _roomDefTable[_currentScreen].totalLayers - 1; cnt++) { // there's no grid for the background layer, so it's totalLayers - 1 _layerGrid[cnt] = (uint16*)_resMan->openFetchRes(_roomDefTable[_currentScreen].grids[cnt]); _layerGrid[cnt] += 14; @@ -265,9 +266,10 @@ void SwordScreen::newScreen(uint32 screen) { } void SwordScreen::quitScreen(void) { - for (uint8 cnt = 0; cnt < _roomDefTable[_currentScreen].totalLayers; cnt++) + uint8 cnt; + for (cnt = 0; cnt < _roomDefTable[_currentScreen].totalLayers; cnt++) _resMan->resClose(_roomDefTable[_currentScreen].layers[cnt]); - for (uint8 cnt = 0; cnt < _roomDefTable[_currentScreen].totalLayers - 1; cnt++) + for (cnt = 0; cnt < _roomDefTable[_currentScreen].totalLayers - 1; cnt++) _resMan->resClose(_roomDefTable[_currentScreen].grids[cnt]); if (_roomDefTable[_currentScreen].parallax[0]) _resMan->resClose(_roomDefTable[_currentScreen].parallax[0]); @@ -276,6 +278,7 @@ void SwordScreen::quitScreen(void) { } void SwordScreen::draw(void) { + uint8 cnt; if (_currentScreen == 54) { // rm54 has a BACKGROUND parallax layer in parallax[0] if (_parallax[0]) @@ -292,15 +295,15 @@ void SwordScreen::draw(void) { } else memcpy(_screenBuf, _layerBlocks[0], _scrnSizeX * _scrnSizeY); - for (uint8 cnt = 0; cnt < _backLength; cnt++) + for (cnt = 0; cnt < _backLength; cnt++) processImage(_backList[cnt]); - for (uint8 cnt = 0; cnt < _sortLength - 1; cnt++) + for (cnt = 0; cnt < _sortLength - 1; cnt++) for (uint8 sCnt = 0; sCnt < _sortLength - 1; sCnt++) if (_sortList[sCnt].y > _sortList[sCnt + 1].y) { SWAP(_sortList[sCnt], _sortList[sCnt + 1]); } - for (uint8 cnt = 0; cnt < _sortLength; cnt++) + for (cnt = 0; cnt < _sortLength; cnt++) processImage(_sortList[cnt].id); if ((_currentScreen != 54) && _parallax[0]) @@ -308,7 +311,7 @@ void SwordScreen::draw(void) { if (_parallax[1]) renderParallax(_parallax[1]); - for (uint8 cnt = 0; cnt < _foreLength; cnt++) + for (cnt = 0; cnt < _foreLength; cnt++) processImage(_foreList[cnt]); _backLength = _sortLength = _foreLength = 0; @@ -543,7 +546,8 @@ void SwordScreen::fastShrink(uint8 *src, uint32 width, uint32 height, uint32 sca uint32 oldRow = 0; uint8 *destPos = dest; - for (uint16 lnCnt = 0; lnCnt < resHeight; lnCnt++) { + uint16 lnCnt; + for (lnCnt = 0; lnCnt < resHeight; lnCnt++) { while (oldRow < (newRow >> 8)) { oldRow++; src += width; @@ -554,7 +558,7 @@ void SwordScreen::fastShrink(uint8 *src, uint32 width, uint32 height, uint32 sca newRow += step; } // scaled, now stipple shadows if there are any - for (uint16 lnCnt = 0; lnCnt < resHeight; lnCnt++) { + for (lnCnt = 0; lnCnt < resHeight; lnCnt++) { uint16 xCnt = lnCnt & 1; destPos = dest + lnCnt * resWidth + (lnCnt & 1); while (xCnt < resWidth) { |