diff options
Diffstat (limited to 'engines/parallaction')
-rw-r--r-- | engines/parallaction/disk.cpp | 31 | ||||
-rw-r--r-- | engines/parallaction/graphics.cpp | 103 | ||||
-rw-r--r-- | engines/parallaction/graphics.h | 11 | ||||
-rw-r--r-- | engines/parallaction/inventory.cpp | 4 | ||||
-rw-r--r-- | engines/parallaction/parallaction.cpp | 19 | ||||
-rw-r--r-- | engines/parallaction/parallaction.h | 10 | ||||
-rw-r--r-- | engines/parallaction/walk.cpp | 16 | ||||
-rw-r--r-- | engines/parallaction/zone.cpp | 2 |
8 files changed, 112 insertions, 84 deletions
diff --git a/engines/parallaction/disk.cpp b/engines/parallaction/disk.cpp index 2e6d9e4820..4070f41e1c 100644 --- a/engines/parallaction/disk.cpp +++ b/engines/parallaction/disk.cpp @@ -412,9 +412,9 @@ void DosDisk::loadBackground(const char *filename) { parseBackground(_resArchive); - byte *bg = (byte*)calloc(1, SCREEN_WIDTH*SCREEN_HEIGHT); - byte *mask = (byte*)calloc(1, SCREENMASK_WIDTH*SCREEN_HEIGHT); - byte *path = (byte*)calloc(1, SCREENPATH_WIDTH*SCREEN_HEIGHT); + byte *bg = (byte*)calloc(1, _vm->_screenSize); + byte *mask = (byte*)calloc(1, _vm->_screenMaskSize); + byte *path = (byte*)calloc(1, _vm->_screenPathSize); Graphics::PackBitsReadStream stream(_resArchive); @@ -444,13 +444,13 @@ void DosDisk::loadMaskAndPath(const char *name) { if (!_resArchive.openArchivedFile(path)) errorFileNotFound(name); - byte *maskBuf = (byte*)calloc(1, SCREENMASK_WIDTH*SCREEN_HEIGHT); - byte *pathBuf = (byte*)calloc(1, SCREENPATH_WIDTH*SCREEN_HEIGHT); + byte *maskBuf = (byte*)calloc(1, _vm->_screenMaskSize); + byte *pathBuf = (byte*)calloc(1, _vm->_screenPathSize); parseDepths(_resArchive); - _resArchive.read(pathBuf, SCREENPATH_WIDTH*SCREEN_HEIGHT); - _resArchive.read(maskBuf, SCREENMASK_WIDTH*SCREEN_HEIGHT); + _resArchive.read(pathBuf, _vm->_screenPathSize); + _resArchive.read(maskBuf, _vm->_screenMaskSize); _vm->_gfx->setMask(maskBuf); _vm->setPath(pathBuf); @@ -932,7 +932,12 @@ Common::SeekableReadStream *AmigaDisk::openArchivedFile(const char* name, bool e return NULL; } -// FIXME: mask values are not computed correctly for level 1 and 2 +/* + FIXME: mask values are not computed correctly for level 1 and 2 + + NOTE: this routine is only able to build masks for Nippon Safes, since mask widths are hardcoded + into the main loop. +*/ void buildMask(byte* buf) { byte mask1[16] = { 0, 0x80, 0x20, 0xA0, 8, 0x88, 0x28, 0xA8, 2, 0x82, 0x22, 0xA2, 0xA, 0x8A, 0x2A, 0xAA }; @@ -941,7 +946,7 @@ void buildMask(byte* buf) { byte plane0[40]; byte plane1[40]; - for (uint32 i = 0; i < 200; i++) { + for (int32 i = 0; i < _vm->_screenHeight; i++) { memcpy(plane0, buf, 40); memcpy(plane1, buf+40, 40); @@ -1051,8 +1056,8 @@ void AmigaDisk::loadMask(const char *name) { s->seek(0x126, SEEK_SET); // HACK: skipping IFF/ILBM header should be done by analysis, not magic Graphics::PackBitsReadStream stream(*s); - byte *buf = (byte*)malloc(SCREENMASK_WIDTH*SCREEN_HEIGHT); - stream.read(buf, SCREENMASK_WIDTH*SCREEN_HEIGHT); + byte *buf = (byte*)malloc(_vm->_screenMaskSize); + stream.read(buf, _vm->_screenMaskSize); buildMask(buf); _vm->_gfx->setMask(buf); free(buf); @@ -1074,8 +1079,8 @@ void AmigaDisk::loadPath(const char *name) { s->seek(0x120, SEEK_SET); // HACK: skipping IFF/ILBM header should be done by analysis, not magic Graphics::PackBitsReadStream stream(*s); - byte *buf = (byte*)malloc(SCREENPATH_WIDTH*SCREEN_HEIGHT); - stream.read(buf, SCREENPATH_WIDTH*SCREEN_HEIGHT); + byte *buf = (byte*)malloc(_vm->_screenPathSize); + stream.read(buf, _vm->_screenPathSize); _vm->setPath(buf); free(buf); delete s; diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index cdbf41eb2c..04f2ef1040 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -80,7 +80,7 @@ void Gfx::drawBalloon(const Common::Rect& r, uint16 winding) { winding = (winding == 0 ? 1 : 0); byte *s = _resBalloon[winding]; - byte *d = _buffers[kBitFront] + (r.left + (r.width()+5)/2 - 5) + (r.bottom - 1) * SCREEN_WIDTH; + byte *d = _buffers[kBitFront] + (r.left + (r.width()+5)/2 - 5) + (r.bottom - 1) * _vm->_screenWidth; for (uint16 i = 0; i < BALLOON_HEIGHT; i++) { for (uint16 j = 0; j < BALLOON_WIDTH; j++) { @@ -89,7 +89,7 @@ void Gfx::drawBalloon(const Common::Rect& r, uint16 winding) { s++; } - d += (SCREEN_WIDTH - BALLOON_WIDTH); + d += (_vm->_screenWidth - BALLOON_WIDTH); } // printf("done\n"); @@ -255,7 +255,7 @@ void Gfx::setHalfbriteMode(bool enable) { void Gfx::updateScreen() { // printf("Gfx::updateScreen()\n"); - g_system->copyRectToScreen(_buffers[kBitFront], SCREEN_WIDTH, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + g_system->copyRectToScreen(_buffers[kBitFront], _vm->_screenWidth, 0, 0, _vm->_screenWidth, _vm->_screenHeight); g_system->updateScreen(); return; } @@ -274,7 +274,7 @@ void Gfx::swapBuffers() { // graphic primitives // void Gfx::clearScreen(Gfx::Buffers buffer) { - memset(_buffers[buffer], 0, SCREEN_WIDTH*SCREEN_HEIGHT); + memset(_buffers[buffer], 0, _vm->_screenSize); if (buffer == kBitFront) updateScreen(); @@ -283,7 +283,7 @@ void Gfx::clearScreen(Gfx::Buffers buffer) { void Gfx::copyScreen(Gfx::Buffers srcbuffer, Gfx::Buffers dstbuffer) { - memcpy(_buffers[dstbuffer], _buffers[srcbuffer], SCREEN_WIDTH*SCREEN_HEIGHT); + memcpy(_buffers[dstbuffer], _buffers[srcbuffer], _vm->_screenSize); // if (dstbuffer == kBitFront) updateScreen(); @@ -293,25 +293,25 @@ void Gfx::copyScreen(Gfx::Buffers srcbuffer, Gfx::Buffers dstbuffer) { void Gfx::floodFill(Gfx::Buffers buffer, const Common::Rect& r, byte color) { // printf("Gfx::floodFill(%i, %i, %i, %i, %i)\n", color, left, top, right, bottom); - byte *d = _buffers[buffer] + (r.left + r.top * SCREEN_WIDTH); + byte *d = _buffers[buffer] + (r.left + r.top * _vm->_screenWidth); uint16 w = r.width() + 1; uint16 h = r.height() + 1; for (uint16 i = 0; i < h; i++) { memset(d, color, w); - d += SCREEN_WIDTH; + d += _vm->_screenWidth; } return; } -void screenClip(Common::Rect& r, Common::Point& p) { +void Gfx::screenClip(Common::Rect& r, Common::Point& p) { int32 x = r.left; int32 y = r.top; - Common::Rect screen(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + Common::Rect screen(0, 0, _vm->_screenWidth, _vm->_screenHeight); r.clip(screen); @@ -332,7 +332,7 @@ void Gfx::flatBlit(const Common::Rect& r, byte *data, Gfx::Buffers buffer) { screenClip(q, dp); byte *s = data + q.left + q.top * r.width(); - byte *d = _buffers[buffer] + dp.x + dp.y * SCREEN_WIDTH; + byte *d = _buffers[buffer] + dp.x + dp.y * _vm->_screenWidth; for (uint16 i = q.top; i < q.bottom; i++) { for (uint16 j = q.left; j < q.right; j++) { @@ -342,7 +342,7 @@ void Gfx::flatBlit(const Common::Rect& r, byte *data, Gfx::Buffers buffer) { } s += (r.width() - q.width()); - d += (SCREEN_WIDTH - q.width()); + d += (_vm->_screenWidth - q.width()); } return; @@ -357,12 +357,12 @@ void Gfx::blit(const Common::Rect& r, uint16 z, byte *data, Gfx::Buffers buffer) screenClip(q, dp); byte *s = data + q.left + q.top * r.width(); - byte *d = _buffers[buffer] + dp.x + dp.y * SCREEN_WIDTH; + byte *d = _buffers[buffer] + dp.x + dp.y * _vm->_screenWidth; for (uint16 i = q.top; i < q.bottom; i++) { uint16 n = dp.x % 4; - byte *m = _buffers[kMask0] + dp.x/4 + (dp.y + i - q.top)*SCREENMASK_WIDTH; + byte *m = _buffers[kMask0] + dp.x/4 + (dp.y + i - q.top)*_vm->_screenMaskWidth; for (uint16 j = q.left; j < q.right; j++) { if (*s != 0) { @@ -379,7 +379,7 @@ void Gfx::blit(const Common::Rect& r, uint16 z, byte *data, Gfx::Buffers buffer) } s += (r.width() - q.right + q.left); - d += (SCREEN_WIDTH - q.right + q.left); + d += (_vm->_screenWidth - q.right + q.left); } return; @@ -417,8 +417,8 @@ void jobEraseLabel(void *parm, Job *j) { if (_si < 0) _si = 0; if (_di > 190) _di = 190; - if (label->_cnv._width + _si > SCREEN_WIDTH) - _si = SCREEN_WIDTH - label->_cnv._width; + if (label->_cnv._width + _si > _vm->_screenWidth) + _si = _vm->_screenWidth - label->_cnv._width; Common::Rect r(label->_cnv._width, label->_cnv._height); r.moveTo(_vm->_gfx->_labelPosition[1]); @@ -512,13 +512,13 @@ void Gfx::blitCnv(StaticCnv *cnv, int16 x, int16 y, uint16 z, Gfx::Buffers buffe void Gfx::backupDoorBackground(DoorData *data, int16 x, int16 y) { - byte *s = _buffers[kBit2] + x + y * SCREEN_WIDTH; + byte *s = _buffers[kBit2] + x + y * _vm->_screenWidth; byte *d = data->_background; for (uint16 i = 0; i < data->_cnv->_height ; i++) { memcpy(d, s, data->_cnv->_width); - s += SCREEN_WIDTH; + s += _vm->_screenWidth; d += data->_cnv->_width; } @@ -528,7 +528,7 @@ void Gfx::backupDoorBackground(DoorData *data, int16 x, int16 y) { void Gfx::backupGetBackground(GetData *data, int16 x, int16 y) { byte *t = data->_cnv->_data0; - byte *s = _buffers[kBitBack] + x + y * SCREEN_WIDTH; + byte *s = _buffers[kBitBack] + x + y * _vm->_screenWidth; byte *d = data->_backup; for (uint16 i = 0; i < data->_cnv->_height ; i++) { @@ -540,7 +540,7 @@ void Gfx::backupGetBackground(GetData *data, int16 x, int16 y) { s++; } - s += (SCREEN_WIDTH - data->_cnv->_width); + s += (_vm->_screenWidth - data->_cnv->_width); } return; @@ -591,17 +591,17 @@ void Gfx::makeCnvFromString(StaticCnv *cnv, char *text) { } void Gfx::displayString(uint16 x, uint16 y, const char *text, byte color) { - byte *dst = _buffers[kBitFront] + x + y*SCREEN_WIDTH; + byte *dst = _buffers[kBitFront] + x + y*_vm->_screenWidth; _font->setColor(color); - _font->drawString(dst, SCREEN_WIDTH, text); + _font->drawString(dst, _vm->_screenWidth, text); } void Gfx::displayCenteredString(uint16 y, const char *text) { - uint16 x = (SCREEN_WIDTH - getStringWidth(text)) / 2; + uint16 x = (_vm->_screenWidth - getStringWidth(text)) / 2; displayString(x, y, text, 1); } -bool Gfx::displayWrappedString(char *text, uint16 x, uint16 y, byte color, uint16 wrapwidth) { +bool Gfx::displayWrappedString(char *text, uint16 x, uint16 y, byte color, int16 wrapwidth) { // printf("Gfx::displayWrappedString(%s, %i, %i, %i, %i)...", text, x, y, color, wrapwidth); uint16 lines = 0; @@ -613,6 +613,9 @@ bool Gfx::displayWrappedString(char *text, uint16 x, uint16 y, byte color, uint1 char token[40]; + if (wrapwidth == -1) + wrapwidth = _vm->_screenWidth; + while (strlen(text) > 0) { text = parseNextToken(text, token, 40, " ", true); @@ -701,11 +704,11 @@ void Gfx::restoreBackground(const Common::Rect& r) { if (left < 0) left = 0; if (top < 0) top = 0; - if (left >= SCREEN_WIDTH) return; - if (top >= SCREEN_HEIGHT) return; + if (left >= _vm->_screenWidth) return; + if (top >= _vm->_screenHeight) return; - if (left+width >= SCREEN_WIDTH) width = SCREEN_WIDTH - left; - if (top+height >= SCREEN_HEIGHT) height = SCREEN_HEIGHT - top; + if (left+width >= _vm->_screenWidth) width = _vm->_screenWidth - left; + if (top+height >= _vm->_screenHeight) height = _vm->_screenHeight - top; Common::Rect q(width, height); q.moveTo(left, top); @@ -713,8 +716,8 @@ void Gfx::restoreBackground(const Common::Rect& r) { copyRect( kBitBack, q, - _buffers[kBit2] + q.left + q.top * SCREEN_WIDTH, - SCREEN_WIDTH + _buffers[kBit2] + q.left + q.top * _vm->_screenWidth, + _vm->_screenWidth ); return; @@ -735,26 +738,26 @@ void Gfx::freeStaticCnv(StaticCnv *cnv) { void Gfx::setBackground(byte *background) { - memcpy(_buffers[kBitBack], background, SCREEN_WIDTH*SCREEN_HEIGHT); + memcpy(_buffers[kBitBack], background, _vm->_screenSize); copyScreen(kBitBack, kBit2); } void Gfx::setMask(byte *mask) { - memcpy(_buffers[kMask0], mask, SCREENMASK_WIDTH*SCREEN_HEIGHT); + memcpy(_buffers[kMask0], mask, _vm->_screenMaskSize); } void Gfx::copyRect(Gfx::Buffers dstbuffer, const Common::Rect& r, byte *src, uint16 pitch) { - byte *d = _buffers[dstbuffer] + r.left + SCREEN_WIDTH * r.top; + byte *d = _buffers[dstbuffer] + r.left + _vm->_screenWidth * r.top; byte *s = src; for (uint16 _si = 0; _si < r.height(); _si++) { memcpy(d, s, r.width()); s += pitch; - d += SCREEN_WIDTH; + d += _vm->_screenWidth; } @@ -763,51 +766,49 @@ void Gfx::copyRect(Gfx::Buffers dstbuffer, const Common::Rect& r, byte *src, uin void Gfx::grabRect(byte *dst, const Common::Rect& r, Gfx::Buffers srcbuffer, uint16 pitch) { - byte *s = _buffers[srcbuffer] + r.left + SCREEN_WIDTH * r.top; + byte *s = _buffers[srcbuffer] + r.left + _vm->_screenWidth * r.top; for (uint16 i = 0; i < r.height(); i++) { memcpy(dst, s, r.width()); - s += SCREEN_WIDTH; + s += _vm->_screenWidth; dst += pitch; } return; } +/* + the following 3 routines are hacks for Nippon Safes coming from the original code, + so they shouldn't be modified when adding support for other games +*/ void Gfx::plotMaskPixel(uint16 x, uint16 y, byte color) { - uint16 _ax = x + y * SCREEN_WIDTH; + uint16 _ax = x + y * _vm->_screenWidth; _buffers[kMask0][_ax >> 2] &= ~(3 << ((_ax & 3) << 1)); return; } - - - void Gfx::fillMaskRect(const Common::Rect& r, byte color) { - uint16 _di = r.left/4 + r.top*80; + uint16 _di = r.left/4 + r.top * _vm->_screenMaskWidth; for (uint16 _si = r.top; _si < r.bottom; _si++) { memset(&_buffers[kMask0][_di], color, r.width()/4+1); - _di += 80; + _di += _vm->_screenMaskWidth; } return; } - -// HACK -// this routine is only invoked from the 'intgrotta scenario' -// void Gfx::intGrottaHackMask() { memset(_buffers[kMask0] + 3600, 0, 3600); _bgLayers[1] = 500; return; } + int16 Gfx::queryMask(int16 v) { for (uint16 _si = 0; _si < 3; _si++) { @@ -821,13 +822,13 @@ Gfx::Gfx(Parallaction* vm) : _vm(vm) { g_system->beginGFXTransaction(); - g_system->initSize(SCREEN_WIDTH, SCREEN_HEIGHT); + g_system->initSize(_vm->_screenWidth, _vm->_screenHeight); g_system->endGFXTransaction(); - _buffers[kBitFront] = (byte*)malloc(SCREEN_SIZE); - _buffers[kBitBack] = (byte*)malloc(SCREEN_SIZE); - _buffers[kBit2] = (byte*)malloc(SCREEN_SIZE); - _buffers[kMask0] = (byte*)malloc(SCREENMASK_WIDTH * SCREEN_HEIGHT); + _buffers[kBitFront] = (byte*)malloc(_vm->_screenSize); + _buffers[kBitBack] = (byte*)malloc(_vm->_screenSize); + _buffers[kBit2] = (byte*)malloc(_vm->_screenSize); + _buffers[kMask0] = (byte*)malloc(_vm->_screenMaskWidth * _vm->_screenHeight); setBlackPalette(); diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h index 05b7dac2ec..6f0f7996d3 100644 --- a/engines/parallaction/graphics.h +++ b/engines/parallaction/graphics.h @@ -36,14 +36,6 @@ namespace Parallaction { - -#define SCREEN_WIDTH 320 -#define SCREEN_HEIGHT 200 -#define SCREEN_SIZE SCREEN_WIDTH*SCREEN_HEIGHT - -#define SCREENMASK_WIDTH SCREEN_WIDTH/4 -#define SCREENPATH_WIDTH SCREEN_WIDTH/8 - #define BASE_PALETTE_COLORS 32 #define FIRST_BASE_COLOR 0 #define LAST_BASE_COLOR (FIRST_BASE_COLOR+BASE_PALETTE_COLORS-1) @@ -168,12 +160,13 @@ public: }; public: + void screenClip(Common::Rect& r, Common::Point& p); // dialogue and text void drawBalloon(const Common::Rect& r, uint16 arg_8); void displayString(uint16 x, uint16 y, const char *text, byte color); void displayCenteredString(uint16 y, const char *text); - bool displayWrappedString(char *text, uint16 x, uint16 y, byte color, uint16 wrapwidth = SCREEN_WIDTH); + bool displayWrappedString(char *text, uint16 x, uint16 y, byte color, int16 wrapwidth = -1); uint16 getStringWidth(const char *text); void getStringExtent(char *text, uint16 maxwidth, int16* width, int16* height); diff --git a/engines/parallaction/inventory.cpp b/engines/parallaction/inventory.cpp index b7ff835dcc..c9e74b2074 100644 --- a/engines/parallaction/inventory.cpp +++ b/engines/parallaction/inventory.cpp @@ -280,8 +280,8 @@ void openInventory() { int16 slot = getNumUsedSlots(); uint16 lines = (slot + 4) / INVENTORY_ITEMS_PER_LINE; - _invPosition.x = CLIP(_vm->_mousePos.x - (INVENTORY_WIDTH / 2), 0, SCREEN_WIDTH - INVENTORY_WIDTH); - _invPosition.y = CLIP(_vm->_mousePos.y - 2 - (lines * INVENTORYITEM_HEIGHT), 0, SCREEN_HEIGHT - lines * INVENTORYITEM_HEIGHT); + _invPosition.x = CLIP(_vm->_mousePos.x - (INVENTORY_WIDTH / 2), 0, (int)(_vm->_screenWidth - INVENTORY_WIDTH)); + _invPosition.y = CLIP(_vm->_mousePos.y - 2 - (lines * INVENTORYITEM_HEIGHT), 0, (int)(_vm->_screenHeight - lines * INVENTORYITEM_HEIGHT)); refreshInventory(); diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index 15601eaedf..ca6ed73aa4 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -174,6 +174,25 @@ int Parallaction::init() { _baseTime = 0; + + if (_vm->getGameType() == GType_Nippon) { + _screenWidth = 320; + _screenHeight = 200; + } else + if (_vm->getGameType() == GType_BRA) { + _screenWidth = 640; + _screenHeight = 400; + } + + _screenMaskWidth = _screenWidth / 4; + _screenPathWidth = _screenWidth / 8; + + _screenSize = _screenWidth * _screenHeight; + _screenMaskSize = _screenMaskWidth * _screenHeight; + _screenPathSize = _screenPathWidth * _screenHeight; + + + if (getPlatform() == Common::kPlatformPC) { _disk = new DosDisk(this); } else { diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index ad8db9e3f4..3a2ecd8f0b 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -361,6 +361,16 @@ private: const PARALLACTIONGameDescription *_gameDescription; public: + // info + int32 _screenWidth; + int32 _screenHeight; + int32 _screenSize; + + int32 _screenMaskWidth; + int32 _screenMaskSize; + int32 _screenPathWidth; + int32 _screenPathSize; + SoundMan *_soundMan; Gfx* _gfx; diff --git a/engines/parallaction/walk.cpp b/engines/parallaction/walk.cpp index 43ded244c5..5d2d005e9f 100644 --- a/engines/parallaction/walk.cpp +++ b/engines/parallaction/walk.cpp @@ -59,11 +59,11 @@ void PathBuilder::correctPathPoint(Common::Point &to) { int16 left = to.x; do { right++; - } while ((queryPath(right, to.y) == 0) && (right < SCREEN_WIDTH)); + } while ((queryPath(right, to.y) == 0) && (right < _vm->_screenWidth)); do { left--; } while ((queryPath(left, to.y) == 0) && (left > 0)); - right = (right == SCREEN_WIDTH) ? 1000 : right - to.x; + right = (right == _vm->_screenWidth) ? 1000 : right - to.x; left = (left == 0) ? 1000 : to.x - left; @@ -74,9 +74,9 @@ void PathBuilder::correctPathPoint(Common::Point &to) { } while ((queryPath(to.x, top) == 0) && (top > 0)); do { bottom++; - } while ((queryPath(to.x, bottom) == 0) && (bottom < SCREEN_HEIGHT)); + } while ((queryPath(to.x, bottom) == 0) && (bottom < _vm->_screenHeight)); top = (top == 0) ? 1000 : to.y - top; - bottom = (bottom == SCREEN_HEIGHT) ? 1000 : bottom - to.y; + bottom = (bottom == _vm->_screenHeight) ? 1000 : bottom - to.y; int16 closeX = (right >= left) ? left : right; @@ -272,7 +272,7 @@ uint16 PathBuilder::walkFunc1(int16 x, int16 y, WalkNode *Node) { void Parallaction::clipMove(Common::Point& pos, const WalkNode* from) { - if ((pos.x < from->_x) && (pos.x < SCREEN_WIDTH) && (queryPath(_vm->_char._ani.width()/2 + pos.x + 2, _vm->_char._ani.height() + pos.y) != 0)) { + if ((pos.x < from->_x) && (pos.x < _screenWidth) && (queryPath(_vm->_char._ani.width()/2 + pos.x + 2, _vm->_char._ani.height() + pos.y) != 0)) { pos.x = (pos.x + 2 < from->_x) ? pos.x + 2 : from->_x; } @@ -280,7 +280,7 @@ void Parallaction::clipMove(Common::Point& pos, const WalkNode* from) { pos.x = (pos.x - 2 > from->_x) ? pos.x - 2 : from->_x; } - if ((pos.y < from->_y) && (pos.y < (SCREEN_HEIGHT - _vm->_char._ani.height())) && (queryPath(_vm->_char._ani.width()/2 + pos.x, _vm->_char._ani.height() + pos.y + 2) != 0)) { + if ((pos.y < from->_y) && (pos.y < (_screenHeight - _vm->_char._ani.height())) && (queryPath(_vm->_char._ani.width()/2 + pos.x, _vm->_char._ani.height() + pos.y + 2) != 0)) { pos.y = (pos.y + 2 <= from->_y) ? pos.y + 2 : from->_y; } @@ -429,11 +429,11 @@ void jobWalk(void *parm, Job *j) { void Parallaction::setPath(byte *path) { - memcpy(_buffer, path, SCREENPATH_WIDTH*SCREEN_HEIGHT); + memcpy(_buffer, path, _screenPathSize); } void Parallaction::initWalk() { - _buffer = (byte*)malloc(SCREENPATH_WIDTH * SCREEN_HEIGHT); + _buffer = (byte*)malloc(_screenPathSize); } diff --git a/engines/parallaction/zone.cpp b/engines/parallaction/zone.cpp index 99ef8c60f9..485bec1c05 100644 --- a/engines/parallaction/zone.cpp +++ b/engines/parallaction/zone.cpp @@ -333,7 +333,7 @@ void Parallaction::displayItemComment(ExamineData *data) { char v68[PATH_LEN]; strcpy(v68, data->_filename); data->_cnv = _disk->loadStatic(v68); - _gfx->flatBlitCnv(data->_cnv, 140, (SCREEN_HEIGHT - data->_cnv->_height)/2, Gfx::kBitFront); + _gfx->flatBlitCnv(data->_cnv, 140, (_screenHeight - data->_cnv->_height)/2, Gfx::kBitFront); _gfx->freeStaticCnv(data->_cnv); delete data->_cnv; |