Skip to content

Commit

Permalink
PRINCE: Warings fix, drawAsShadow update - kShadowColor to graphics.h
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaslw committed Jun 22, 2014
1 parent 6383449 commit a2b1f2f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion engines/prince/graphics.cpp
Expand Up @@ -93,7 +93,7 @@ void GraphicsMan::drawAsShadow(int32 posX, int32 posY, const Graphics::Surface *
for (int y = 0; y < s->h; y++) {
for (int x = 0; x < s->w; x++) {
byte pixel = *((byte*)s->getBasePtr(x, y));
if (pixel != 255) {
if (pixel == kShadowColor) {
if (x + posX < _frontScreen->w && x + posX >= 0) {
if (y + posY < _frontScreen->h && y + posY >= 0) {
byte *background = (byte *)_frontScreen->getBasePtr(x + posX, y + posY);
Expand Down
2 changes: 2 additions & 0 deletions engines/prince/graphics.h
Expand Up @@ -54,6 +54,8 @@ class GraphicsMan
byte *_shadowTable70;
byte *_shadowTable50;

static const byte kShadowColor = 191;

private:

PrinceEngine *_vm;
Expand Down
6 changes: 3 additions & 3 deletions engines/prince/hero.cpp
Expand Up @@ -245,7 +245,7 @@ void Hero::showHeroShadow(Graphics::Surface *heroFrame) {

for (int x = 0; x < _frameXSize; x++, dst++, src++) {
if (*src != 0xFF) {
*dst = kShadowColor;
*dst = _graph->kShadowColor;
} else {
*dst = *src;
}
Expand Down Expand Up @@ -397,7 +397,7 @@ void Hero::showHeroShadow(Graphics::Surface *heroFrame) {
if (shadZoomX < 0 && _scaleValue != 10000) {
shadZoomX += _scaleValue;
} else {
if (*shadowHero == kShadowColor) {
if (*shadowHero == _graph->kShadowColor) {
if ((shadBitMaskCopyTrans & _shadowBitmap[shadBitAddrCopyTrans]) != 0) {
if (shadWallDown == 0) {
if ((shadBitMaskCopyTrans & _shadowBitmap[shadBitAddrCopyTrans + kShadowBitmapSize]) != 0) {
Expand Down Expand Up @@ -455,7 +455,7 @@ void Hero::showHeroShadow(Graphics::Surface *heroFrame) {
shadZoomXWall += _scaleValue;
} else {
//point_ok:
if (*shadowHero == kShadowColor) {
if (*shadowHero == _graph->kShadowColor) {
if ((shadBitMaskWallCopyTrans & _shadowBitmap[shadBitAddrWallCopyTrans + kShadowBitmapSize]) != 0) {
*background = *(sprShadow + *background);
}
Expand Down
4 changes: 1 addition & 3 deletions engines/prince/hero.h
Expand Up @@ -47,8 +47,6 @@ class Hero {
static const int32 kShadowBitmapSize = kMaxPicWidth * kMaxPicHeight / 8;
static const int16 kScreenWidth = 640;

static const byte kShadowColor = 191;

enum State {
STAY = 0,
TURN = 1,
Expand Down Expand Up @@ -163,7 +161,7 @@ class Hero {
// DestDir
// LeftRight previous left/right direction
// UpDown previous up/down direction
uint _phase; // Phase animation phase
int32 _phase; // Phase animation phase
// Step x/y step size depends on direction
// MaxBoredom stand still timeout
int16 _boredomTime;// Boredom current boredom time in frames
Expand Down
6 changes: 3 additions & 3 deletions engines/prince/prince.cpp
Expand Up @@ -117,7 +117,7 @@ PrinceEngine::~PrinceEngine() {

for (uint i = 0; i < _backAnimList.size(); i++) {
int anims = _backAnimList[i]._seq._anims != 0 ? _backAnimList[i]._seq._anims : 1;
for (uint j = 0; j < anims; j++) {
for (int j = 0; j < anims; j++) {
delete _backAnimList[i].backAnims[j]._animData;
delete _backAnimList[i].backAnims[j]._shadowData;
}
Expand Down Expand Up @@ -328,9 +328,9 @@ bool PrinceEngine::loadLocation(uint16 locationNr) {
_mainHero->setShadowScale(_script->getShadowScale(_locationNr));

_room->loadRoom(_script->getRoomOffset(_locationNr));
for (uint32 i = 0; i < _backAnimList.size(); i++) {
for (uint i = 0; i < _backAnimList.size(); i++) {
int anims = _backAnimList[i]._seq._anims != 0 ? _backAnimList[i]._seq._anims : 1;
for (uint32 j = 0; j < anims; j++) {
for (int j = 0; j < anims; j++) {
delete _backAnimList[i].backAnims[j]._animData;
delete _backAnimList[i].backAnims[j]._shadowData;
}
Expand Down

0 comments on commit a2b1f2f

Please sign in to comment.