aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Göffringmann2003-12-21 17:34:44 +0000
committerRobert Göffringmann2003-12-21 17:34:44 +0000
commit44887cc33d3ac01a846526ec56cb0559d2f6b45b (patch)
treeaa63f4325f43dfa85f24fbcc61e23cd02971c6d2
parented991734a32e4d484fee81be6efeab0b4747926e (diff)
downloadscummvm-rg350-44887cc33d3ac01a846526ec56cb0559d2f6b45b.tar.gz
scummvm-rg350-44887cc33d3ac01a846526ec56cb0559d2f6b45b.tar.bz2
scummvm-rg350-44887cc33d3ac01a846526ec56cb0559d2f6b45b.zip
fixed parallax drawing for room 54
svn-id: r11828
-rw-r--r--sword1/screen.cpp27
-rw-r--r--sword1/screen.h4
-rw-r--r--sword1/sword1.cpp3
3 files changed, 21 insertions, 13 deletions
diff --git a/sword1/screen.cpp b/sword1/screen.cpp
index 4075aebeb8..08dfc4488e 100644
--- a/sword1/screen.cpp
+++ b/sword1/screen.cpp
@@ -276,13 +276,24 @@ void SwordScreen::quitScreen(void) {
_resMan->resClose(_roomDefTable[_currentScreen].parallax[1]);
}
-void SwordScreen::recreate() {
- memcpy(_screenBuf, _layerBlocks[0], _scrnSizeX * _scrnSizeY);
-}
-
-void SwordScreen::spritesAndParallax(void) {
- if ((_currentScreen == 54) && _parallax[0])
- renderParallax(_parallax[0]); // rm54 has a BACKGROUND parallax layer in parallax[0]
+void SwordScreen::draw(void) {
+ if (_currentScreen == 54) {
+ // rm54 has a BACKGROUND parallax layer in parallax[0]
+ if (_parallax[0])
+ renderParallax(_parallax[0]);
+ uint8 *src = _layerBlocks[0];
+ uint8 *dest = _screenBuf;
+ for (uint16 cnty = 0; cnty < _scrnSizeY; cnty++)
+ for (uint16 cntx = 0; cntx < _scrnSizeX; cntx++) {
+ if (*src)
+ *dest = *src;
+ dest++;
+ src++;
+ }
+ } else
+ memcpy(_screenBuf, _layerBlocks[0], _scrnSizeX * _scrnSizeY);
+
+
for (uint8 cnt = 0; cnt < _backLength; cnt++)
processImage(_backList[cnt]);
@@ -454,7 +465,7 @@ void SwordScreen::renderParallax(uint8 *data) {
for (uint16 cnty = 0; cnty < SCREEN_DEPTH; cnty++) {
uint8 *src = data + READ_LE_UINT32(header->lineIndexes + cnty + scrlY);
- uint8 *dest = _screenBuf + SwordLogic::_scriptVars[SCROLL_OFFSET_X] + cnty * _scrnSizeX;
+ uint8 *dest = _screenBuf + SwordLogic::_scriptVars[SCROLL_OFFSET_X] + (cnty + SwordLogic::_scriptVars[SCROLL_OFFSET_Y]) * _scrnSizeX;
uint16 remain = scrlX;
uint16 xPos = 0;
bool copyFirst = false;
diff --git a/sword1/screen.h b/sword1/screen.h
index e3b5c52c5b..21ccba695e 100644
--- a/sword1/screen.h
+++ b/sword1/screen.h
@@ -75,13 +75,11 @@ public:
void addToGraphicList(uint8 listId, uint32 objId);
- void recreate();
- void spritesAndParallax(void);
+ void draw(void);
void fadeDownPalette(void);
void fadeUpPalette(void);
void fnSetPalette(uint8 start, uint16 length, uint32 id, bool fadeUp);
- //void fnSetFadeTargetPalette(uint32 id);
bool stillFading(void);
void updateScreen(void);
diff --git a/sword1/sword1.cpp b/sword1/sword1.cpp
index a5cf8c18a5..f26c6c7ec7 100644
--- a/sword1/sword1.cpp
+++ b/sword1/sword1.cpp
@@ -1090,8 +1090,7 @@ void SwordEngine::mainLoop(void) {
_logic->engine();
_logic->updateScreenParams(); // sets scrolling
- _screen->recreate();
- _screen->spritesAndParallax();
+ _screen->draw();
_mouse->animate();
newTime = _system->get_msecs();