Skip to content

Commit

Permalink
PRINCE: showHeroShadow - small fix for doubled lines and wrong colors
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaslw committed Jun 22, 2014
1 parent 2c9559b commit 7239843
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions engines/prince/hero.cpp
Expand Up @@ -315,6 +315,8 @@ void Hero::showHeroShadow(Graphics::Surface *heroFrame) {
int blackHeroX = 0;
int blackHeroY = frameYSize - 1;

int shadLastY = 0;

byte *shadowStart = (byte *)makeShadow->getBasePtr(blackHeroX, blackHeroY); // esi, first pixel from last row of black hero
byte *background = (byte *)_graph->_frontScreen->getBasePtr(sprDestX, sprDestY); // eax, pixel of background where shadow sprite starts

Expand Down Expand Up @@ -348,7 +350,8 @@ void Hero::showHeroShadow(Graphics::Surface *heroFrame) {
break;
}
//line_y_ok
if (shadPosY >= 0 && shadPosY < 480 && shadPosX < 640) {
if (shadLastY != shadPosY && shadPosY >= 0 && shadPosY < 480 && shadPosX < 640) {
shadLastY = shadPosY;
if (shadPosX < 0) { //when it happens?
shadSkipX = -1 * shadPosX;
background += shadSkipX;
Expand Down Expand Up @@ -533,12 +536,10 @@ void Hero::showHeroShadow(Graphics::Surface *heroFrame) {
shadBitAddr -= kMaxPicWidth / 8;
shadPosY--;
diffY--;
background = (byte *)_graph->_frontScreen->getBasePtr(sprDestX + diffX, sprDestY + diffY);
} else if (*(shadowLineStart + 2) > *(shadowLineStart - 2)) {
shadBitAddr += kMaxPicWidth / 8;
shadPosY++;
diffY++;
background = (byte *)_graph->_frontScreen->getBasePtr(sprDestX + diffX, sprDestY + diffY);
}
//no_change_y
if (*shadowLineStart < *(shadowLineStart - 4)) {
Expand Down Expand Up @@ -570,6 +571,7 @@ void Hero::showHeroShadow(Graphics::Surface *heroFrame) {
break;
}
blackHeroX = 0;
background = (byte *)_graph->_frontScreen->getBasePtr(sprDestX + diffX, sprDestY + diffY);
shadowStart = (byte *)makeShadow->getBasePtr(blackHeroX, blackHeroY);
}
//koniec_bajki
Expand Down

0 comments on commit 7239843

Please sign in to comment.