From 6e751af6c09e0eb4727cb985744fa55df41f78c8 Mon Sep 17 00:00:00 2001 From: Paweł Kołodziejski Date: Sat, 31 Aug 2002 16:29:17 +0000 Subject: changed resolution values from static to dynamic, I hope I don't break something svn-id: r4885 --- scumm/costume.cpp | 44 +++++++++++++++---------------- scumm/gfx.cpp | 76 +++++++++++++++++++++++++++--------------------------- scumm/saveload.cpp | 4 +-- scumm/scummvm.cpp | 32 +++++++++++++---------- scumm/string.cpp | 20 +++++++------- 5 files changed, 90 insertions(+), 86 deletions(-) (limited to 'scumm') diff --git a/scumm/costume.cpp b/scumm/costume.cpp index 2b6b5447de..9bc6e6b73c 100644 --- a/scumm/costume.cpp +++ b/scumm/costume.cpp @@ -160,7 +160,7 @@ byte CostumeRenderer::mainRoutine(Actor *a, int slot, int frame) _right = _left = _xpos; _scaleIndexX = unk19; for (i = 0; i < _width; i++) { - if (_left > 319) { + if (_left > (_realWidth - 1)) { s++; unk19 = _scaleIndexX; } @@ -217,10 +217,10 @@ byte CostumeRenderer::mainRoutine(Actor *a, int slot, int frame) if (_top >= (int)_outheight || _bottom <= 0) return 0; - _ypitch = _height * 320; + _ypitch = _height * _realWidth; _docontinue = 0; b = 1; - if (_left > 319 || _right <= 0) + if (_left > (_realWidth - 1) || _right <= 0) return 1; if (_mirror) { _ypitch--; @@ -235,7 +235,7 @@ byte CostumeRenderer::mainRoutine(Actor *a, int slot, int frame) _docontinue = 1; } } else { - s = _right - 320; + s = _right - _realWidth; if (s <= 0) { b = 2; } else { @@ -245,12 +245,12 @@ byte CostumeRenderer::mainRoutine(Actor *a, int slot, int frame) } else { _ypitch++; if (scaling == 0) - s = _right - 320; + s = _right - _realWidth; if (s > 0) { if (!newAmiCost) { _width2 -= s; ignorePakCols(s); - _xpos = 319; + _xpos = _realWidth - 1; _docontinue = 1; } } else { @@ -646,7 +646,7 @@ void CostumeRenderer::proc2() _scaleIndexX = t + _scaleIndexXStep; if (cost_scaleTable[t] < _scaleX) { _xpos += _scaleIndexXStep; - if (_xpos >= 320) + if (_xpos >= _realWidth) return; maskbit = revBitMask[_xpos & 7]; _backbuff_ptr += _scaleIndexXStep; @@ -694,7 +694,7 @@ void CostumeRenderer::proc1() pcolor = _shadow_table[*dst]; *dst = pcolor; } - dst += 320; + dst += _realWidth; y++; } if (!--height) { @@ -707,7 +707,7 @@ void CostumeRenderer::proc1() _scaleIndexX = t + _scaleIndexXStep; if (cost_scaleTable[t] < _scaleX) { _xpos += _scaleIndexXStep; - if (_xpos >= 320) + if (_xpos >= _realWidth) return; _backbuff_ptr += _scaleIndexXStep; } @@ -745,7 +745,7 @@ void CostumeRenderer::proc6_ami() len = *src++; do { - if (color && x >= 0 && x < 320) { + if (color && x >= 0 && x < _realWidth) { pcolor = _palette[color]; /* if (pcolor == 13) { pcolor = _shadow_table[*dst]; @@ -759,7 +759,7 @@ void CostumeRenderer::proc6_ami() if (!--height) return; width = _width; - dst += 320-step*_width; + dst += _realWidth - step * _width; x = _xpos; y++; if (y >= scrheight) @@ -795,7 +795,7 @@ void CostumeRenderer::proc5_ami() len = *src++; do { - if (color && x >=0 && x < 320 && !(*mask & maskbit)) { + if (color && x >=0 && x < _realWidth && !(*mask & maskbit)) { pcolor = _palette[color]; /* if (pcolor == 13) pcolor = _shadow_table[*dst];*/ @@ -824,7 +824,7 @@ void CostumeRenderer::proc5_ami() width = _width; x = _xpos; y++; - dst += 320-step*_width; + dst += _realWidth - step * _width; _mask_ptr+=40; mask = _mask_ptr; maskbit = revBitMask[_xpos & 7]; @@ -861,7 +861,7 @@ void CostumeRenderer::proc4_ami() len = *src++; do { - if (color && x >= 0 && x < 320 && !((*mask | mask[_imgbufoffs]) & maskbit)) { + if (color && x >= 0 && x < _realWidth && !((*mask | mask[_imgbufoffs]) & maskbit)) { pcolor = _palette[color]; /* if (pcolor == 13) pcolor = _shadow_table[*dst];*/ @@ -888,7 +888,7 @@ void CostumeRenderer::proc4_ami() width = _width; y++; x = _xpos; - dst += 320-step*_width; + dst += _realWidth - step * _width; _mask_ptr+= 40; mask = _mask_ptr; maskbit = revBitMask[_xpos & 7]; @@ -949,7 +949,7 @@ void CostumeRenderer::proc3_ami() return; if (_xpos != oldXpos) { - dst += 320-(_xpos-oldXpos); + dst += _realWidth - (_xpos - oldXpos); _mask_ptr += 40; mask = _mask_ptr; y++; @@ -990,7 +990,7 @@ void CostumeRenderer::proc2_ami() len = *src++; do { if (cost_scaleTable[_scaleIndexY] < _scaleY) { - if (color && _xpos >= 0 && _xpos < 320 && !(*mask & maskbit)) { + if (color && _xpos >= 0 && _xpos < _realWidth && !(*mask & maskbit)) { pcolor = _palette[color]; /* if (pcolor == 13) pcolor = _shadow_table[*dst];*/ @@ -1014,7 +1014,7 @@ void CostumeRenderer::proc2_ami() return; if (_xpos != oldXpos) { - dst += 320-(_xpos-oldXpos); + dst += _realWidth - (_xpos - oldXpos); _mask_ptr += 40; mask = _mask_ptr; y++; @@ -1059,7 +1059,7 @@ void CostumeRenderer::proc1_ami() do { if (cost_scaleTable[_scaleIndexY] < _scaleY) { - if (color && _xpos >= 0 && _xpos < 320) { + if (color && _xpos >= 0 && _xpos < _realWidth) { pcolor = _palette[color]; /* if (pcolor == 13) pcolor = _shadow_table[*dst];*/ @@ -1081,7 +1081,7 @@ void CostumeRenderer::proc1_ami() return; if (_xpos != oldXpos) { - dst += 320-(_xpos-oldXpos); + dst += _realWidth - (_xpos - oldXpos); y++; } width = _width; @@ -1166,7 +1166,7 @@ void CostumeRenderer::proc_special(Actor *a, byte mask2) *dst = pcolor; } } - dst += 320; + dst += _realWidth; mask += 40; y++; } @@ -1180,7 +1180,7 @@ void CostumeRenderer::proc_special(Actor *a, byte mask2) _scaleIndexX = t + _scaleIndexXStep; if (cost_scaleTable[t] < _scaleX) { _xpos += _scaleIndexXStep; - if (_xpos >= 320) + if (_xpos >= _realWidth) return; maskbit = revBitMask[_xpos & 7]; _backbuff_ptr += _scaleIndexXStep; diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp index cea37d85a0..63c5151593 100644 --- a/scumm/gfx.cpp +++ b/scumm/gfx.cpp @@ -85,7 +85,7 @@ void Scumm::initVirtScreen(int slot, int number, int top, int width, int height, vs->number = slot; vs->unk1 = 0; - vs->width = 320; + vs->width = _realWidth; vs->topline = top; vs->height = height; vs->alloctwobuffers = twobufs; @@ -96,7 +96,7 @@ void Scumm::initVirtScreen(int slot, int number, int top, int width, int height, vs->backBuf = NULL; if (vs->scrollable) - size += 320 * 4; + size += _realWidth * 4; createResource(rtBuffer, slot + 1, size); vs->screenPtr = getResourceAddress(rtBuffer, slot + 1); @@ -148,7 +148,7 @@ void Scumm::drawDirtyScreenParts() vs = &virtscr[0]; src = vs->screenPtr + _screenStartStrip * 8 + camera._cur.y - 100; - _system->copy_rect(src, 320, 0, vs->topline, 320, vs->height); + _system->copy_rect(src, _realWidth, 0, vs->topline, _realWidth, vs->height); for (i = 0; i < NUM_STRIPS; i++) { vs->tdirty[i] = (byte)vs->height; @@ -225,15 +225,15 @@ void Gdi::drawStripToScreen(VirtScreen *vs, int x, int w, int t, int b) b = vs->height; height = b - t; - if (height > 200) - height = 200; + if (height > _realHeight) + height = _realHeight; - scrollY = _vm->camera._cur.y - 100; - if (scrollY == -100) + scrollY = _vm->camera._cur.y - (_realHeight / 2); + if (scrollY == -(_realHeight / 2)) scrollY = 0; - ptr = vs->screenPtr + (t * NUM_STRIPS + x) * 8 + _readOffs + scrollY * 320; - _vm->_system->copy_rect(ptr, 320, x * 8, vs->topline + t, w, height); + ptr = vs->screenPtr + (t * NUM_STRIPS + x) * 8 + _readOffs + scrollY * _realWidth; + _vm->_system->copy_rect(ptr, _realWidth, x * 8, vs->topline + t, w, height); } void blit(byte *dst, byte *src, int w, int h) @@ -269,7 +269,7 @@ void Scumm::setCameraAt(int pos_x, int pos_y) camera._dest = camera._cur; - assert(camera._cur.x >= 160 && camera._cur.y >= 100); + assert(camera._cur.x >= (_realWidth / 2) && camera._cur.y >= (_realHeight / 2)); if ((camera._cur.x != old.x || camera._cur.y != old.y) && _vars[VAR_SCROLL_SCRIPT]) { @@ -280,7 +280,7 @@ void Scumm::setCameraAt(int pos_x, int pos_y) } else { int t; - if (camera._mode != CM_FOLLOW_ACTOR || abs(pos_x - camera._cur.x) > 160) { + if (camera._mode != CM_FOLLOW_ACTOR || abs(pos_x - camera._cur.x) > (_realWidth / 2)) { camera._cur.x = pos_x; } camera._dest.x = pos_x; @@ -318,7 +318,7 @@ void Scumm::setCameraFollows(Actor *a) ax = abs(a->x - camera._cur.x); ay = abs(a->y - camera._cur.y); - if (ax > _vars[VAR_CAMERA_THRESHOLD_X] || ay > _vars[VAR_CAMERA_THRESHOLD_Y] || ax > 160 || ay > 100) { + if (ax > _vars[VAR_CAMERA_THRESHOLD_X] || ay > _vars[VAR_CAMERA_THRESHOLD_Y] || ax > (_realWidth / 2) || ay > (_realHeight / 2)) { setCameraAt(a->x, a->y); } @@ -357,7 +357,7 @@ void Scumm::initBGBuffers(int height) byte *room; if (_features & GF_AFTER_V7) { - initVirtScreen(0, 0, virtscr[0].topline, 200, height, 1, 1); + initVirtScreen(0, 0, virtscr[0].topline, _realHeight, height, 1, 1); } room = getResourceAddress(rtRoom, _roomResource); @@ -598,7 +598,7 @@ void Scumm::drawFlashlight() if (flashBuffer) { - offset = 320 - flashW*8; + offset = _realWidth - flashW*8; i = flashH; do { j = flashW*2; @@ -641,7 +641,7 @@ void Scumm::drawFlashlight() } byte *bgbak; - offset = (flashY - topline) * 320 + virtscr[0].xstart + flashX*8; + offset = (flashY - topline) * _realWidth + virtscr[0].xstart + flashX * 8; flashBuffer = virtscr[0].screenPtr + offset; bgbak = getResourceAddress(rtBuffer, 5) + offset; @@ -652,9 +652,9 @@ void Scumm::drawFlashlight() int corner_data[] = { 8, 6, 4, 3, 2, 2, 1, 1 }; int minrow = 0; int maxcol = flashW * 8 - 1; - int maxrow = (flashH - 1) * 320; + int maxrow = (flashH - 1) * _realWidth; - for (i = 0; i < 8; i++, minrow += 320, maxrow -= 320) { + for (i = 0; i < 8; i++, minrow += _realWidth, maxrow -= _realWidth) { int d = corner_data[i]; for (j = 0; j < d; j++) { @@ -872,7 +872,7 @@ void Gdi::drawBitmap(byte *ptr, VirtScreen *vs, int x, int y, int h, twobufs = vs->alloctwobuffers; - _vertStripNextInc = h * 320 - 1; + _vertStripNextInc = h * _realWidth - 1; _numLinesToProcess = h; @@ -1138,8 +1138,8 @@ void Gdi::draw8ColWithMasking() ((uint32 *)dst)[0] = ((uint32 *)src)[0]; ((uint32 *)dst)[1] = ((uint32 *)src)[1]; } - src += 320; - dst += 320; + src += _realWidth; + dst += _realWidth; mask += NUM_STRIPS; } while (--height); } @@ -1187,7 +1187,7 @@ void Gdi::clear8Col() do { ((uint32 *)dst)[0] = 0; ((uint32 *)dst)[1] = 0; - dst += 320; + dst += _realWidth; } while (--height); } @@ -1508,7 +1508,7 @@ void Gdi::unkDecode6() _tempNumLines = _numLinesToProcess; do { FILL_BITS *dst = color + _palette_mod; - dst += 320; + dst += _realWidth; if (!READ_BIT) { } else if (!READ_BIT) { FILL_BITS color = bits & _decomp_mask; @@ -1532,7 +1532,7 @@ void Gdi::unkDecode6() bits = ((buffer & mask) != 0); #define NEXT_ROW \ - dst += 320; \ + dst += _realWidth; \ if (--h == 0) { \ if (!--_currentX) \ return; \ @@ -1565,7 +1565,7 @@ void Gdi::unkDecode7() ((uint32 *)dst)[0] = ((uint32 *)src)[0]; ((uint32 *)dst)[1] = ((uint32 *)src)[1]; #endif - dst += 320; + dst += _realWidth; src += 8; } while (--height); } @@ -1756,16 +1756,16 @@ void Scumm::restoreBG(int left, int top, int right, int bottom) left = 0; if (right < 0) right = 0; - if (left > 320) + if (left > _realWidth) return; - if (right > 320) - right = 320; + if (right > _realWidth) + right = _realWidth; if (bottom >= height) bottom = height; updateDirtyRect(vs->number, left, right, top - topline, bottom - topline, 0x40000000); - height = (top - topline) * 320 + vs->xstart + left; + height = (top - topline) * _realWidth + vs->xstart + left; backbuff = vs->screenPtr + height; bgbak = getResourceAddress(rtBuffer, vs->number + 5) + height; @@ -1820,8 +1820,8 @@ void Scumm::updateDirtyRect(int virt, int left, int right, int top, int bottom, lp = (left >> 3) + _screenStartStrip; if (lp < 0) lp = 0; - if (rp >= 200) - rp = 200; + if (rp >= _realHeight) + rp = _realHeight; if (lp <= rp) { num = rp - lp + 1; sp = &gfxUsageBits[lp]; @@ -2161,7 +2161,7 @@ void Scumm::moveCamera() camera._dest.y = a->y; } - assert(camera._cur.x >= 160 && camera._cur.y >= 100); + assert(camera._cur.x >= (_realWidth / 2) && camera._cur.y >= (_realHeight / 2)); clampCameraPos(&camera._dest); @@ -2311,14 +2311,14 @@ void Scumm::cameraMoved() _screenEndStrip = _screenStartStrip + NUM_STRIPS - 1; virtscr[0].xstart = _screenStartStrip << 3; - _screenLeft = camera._cur.x - 160; - _screenTop = camera._cur.y - 100; + _screenLeft = camera._cur.x - (_realWidth / 2); + _screenTop = camera._cur.y - (_realHeight / 2); } else { - if (camera._cur.x < 160) { - camera._cur.x = 160; - } else if (camera._cur.x + 160 >= _scrWidth) { - camera._cur.x = _scrWidth - 160; + if (camera._cur.x < (_realWidth / 2)) { + camera._cur.x = (_realWidth / 2); + } else if (camera._cur.x + (_realWidth / 2) >= _scrWidth) { + camera._cur.x = _scrWidth - (_realWidth / 2); } _screenStartStrip = (camera._cur.x >> 3) - 20; @@ -2832,7 +2832,7 @@ void Scumm::grabCursor(byte *ptr, int width, int height) for (; height; height--) { memcpy(dst, ptr, width); dst += width; - ptr += 320; + ptr += _realWidth; } updateCursor(); diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp index bd8c76fc65..22add4a88a 100644 --- a/scumm/saveload.cpp +++ b/scumm/saveload.cpp @@ -136,7 +136,7 @@ bool Scumm::loadState(int slot, bool compat) gdi._mask_left = -1; - initScreens(0, 0, 320, 200); + initScreens(0, 0, _realWidth, _realHeight); // Force a fade to black int old_screenEffectFlag = _screenEffectFlag; @@ -144,7 +144,7 @@ bool Scumm::loadState(int slot, bool compat) fadeOut(129); _screenEffectFlag = old_screenEffectFlag; - initScreens(0, sb, 320, sh); + initScreens(0, sb, _realWidth, sh); _completeScreenRedraw = true; setDirtyColors(0, 255); diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index ef3a3c45f1..d8058405fb 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -91,6 +91,10 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst) if (_gameId == GID_ZAK256) { // FmTowns is 320x240 _realWidth = 320; _realHeight = 240; + } else { + if (_gameId == GID_CMI) { + _realWidth = 640; + _realHeight = 480; } else { _realWidth = 320; _realHeight = 200; @@ -176,7 +180,7 @@ void Scumm::scummInit() if (!(_features & GF_SMALL_NAMES)) loadCharset(1); - initScreens(0, 16, 320, 144); + initScreens(0, 16, _realWidth, 144); setShake(0); setupCursor(); @@ -201,7 +205,7 @@ void Scumm::scummInit() for (i = 0; i < _maxVerbs; i++) { _verbs[i].verbid = 0; - _verbs[i].right = 319; + _verbs[i].right = _realWidth - 1; _verbs[i].oldleft = -1; _verbs[i].type = 0; _verbs[i].color = 2; @@ -272,7 +276,7 @@ void Scumm::scummInit() string[i].t_xpos = 2; string[i].t_ypos = 5; } - string[i].t_right = 319; + string[i].t_right = _realWidth - 1; string[i].t_color = 0xF; string[i].t_center = 0; string[i].t_charset = 0; @@ -566,8 +570,8 @@ void Scumm::startScene(int room, Actor * a, int objectNr) if (!(_features & GF_AFTER_V7)) { camera._mode = CM_NORMAL; - camera._cur.x = camera._dest.x = 160; - camera._cur.y = camera._dest.y = 100; + camera._cur.x = camera._dest.x = _realWidth / 2; + camera._cur.y = camera._dest.y = _realHeight / 2; } if (_features & GF_AFTER_V6) { @@ -576,14 +580,14 @@ void Scumm::startScene(int room, Actor * a, int objectNr) } if (_features & GF_AFTER_V7) { - _vars[VAR_CAMERA_MIN_X] = 160; - _vars[VAR_CAMERA_MAX_X] = _scrWidth - 160; - _vars[VAR_CAMERA_MIN_Y] = 100; - _vars[VAR_CAMERA_MAX_Y] = _scrHeight - 100; - setCameraAt(160, 100); + _vars[VAR_CAMERA_MIN_X] = _realWidth / 2; + _vars[VAR_CAMERA_MAX_X] = _scrWidth - (_realWidth / 2); + _vars[VAR_CAMERA_MIN_Y] = _realHeight / 2; + _vars[VAR_CAMERA_MAX_Y] = _scrHeight - (_realHeight / 2); + setCameraAt(_realWidth / 2, _realHeight / 2); } else { - _vars[VAR_CAMERA_MAX_X] = _scrWidth - 160; - _vars[VAR_CAMERA_MIN_X] = 160; + _vars[VAR_CAMERA_MAX_X] = _scrWidth - (_realWidth / 2); + _vars[VAR_CAMERA_MIN_X] = _realWidth / 2; } if (_roomResource == 0) @@ -1465,10 +1469,10 @@ void Scumm::launch() _minHeapThreshold = 400000; // Create a primary virtual screen - _videoBuffer = (byte *)calloc(328*200, 1); + _videoBuffer = (byte *)calloc((_realWidth + 8) * _realHeight, 1); allocResTypeData(rtBuffer, MKID('NONE'), 10, "buffer", 0); - initVirtScreen(0, 0, 0, 320, 200, false, false); + initVirtScreen(0, 0, 0, _realWidth, _realHeight, false, false); if (_features & GF_AFTER_V7) setupScummVarsNew(); diff --git a/scumm/string.cpp b/scumm/string.cpp index dad9406227..b2fea7fc4a 100644 --- a/scumm/string.cpp +++ b/scumm/string.cpp @@ -240,12 +240,12 @@ void Scumm::CHARSET_1() if (string[0].ypos < 1) string[0].ypos = 1; - if (string[0].ypos < camera._cur.y - 100) + if (string[0].ypos < camera._cur.y - (_realHeight / 2)) - string[0].ypos = camera._cur.y - 100; + string[0].ypos = camera._cur.y - (_realHeight / 2); s = a->scalex * a->new_2 / 0xFF; - string[0].xpos = ((a->new_2 - s) >> 1) + s + a->x - camera._cur.x + 160; + string[0].xpos = ((a->new_2 - s) >> 1) + s + a->x - camera._cur.x + (_realWidth / 2); if (string[0].xpos < 80) string[0].xpos = 80; if (string[0].xpos > 240) @@ -301,7 +301,7 @@ void Scumm::CHARSET_1() gdi._mask_left = string[0].xpos; gdi._mask_top = string[0].ypos; gdi._mask_bottom = string[0].ypos + 8; - gdi._mask_right = 320; + gdi._mask_right = _realWidth; if (string[0].ypos <= 16) // If we are cleaning the text line, clean 2 lines. gdi._mask_bottom = 16; } @@ -458,7 +458,7 @@ void Scumm::description() charset._top = string[0].ypos; charset._left = string[0].xpos; charset._left2 = string[0].xpos; - charset._right = 319; + charset._right = _realWidth - 1; charset._xpos2 = string[0].xpos; charset._ypos2 = string[0].ypos; charset._disableOffsX = charset._unk12 = 1; @@ -813,7 +813,7 @@ void CharsetRenderer::printCharOld(int chr) _unk12 = 0; } char_ptr = _vm->getResourceAddress(rtCharset, _curId) + 224 + (chr + 1) * 8; - dest_ptr = vs->screenPtr + vs->xstart + (_top - vs->topline) * 320 + _left; + dest_ptr = vs->screenPtr + vs->xstart + (_top - vs->topline) * _realWidth + _left; _vm->updateDirtyRect(vs->number, _left, _left + 8, _top - vs->topline, _top - vs->topline + 8, 0); for (y = 0; y < 8; y++) { @@ -824,7 +824,7 @@ void CharsetRenderer::printCharOld(int chr) } color = ((buffer & mask) != 0); if (color) - *(dest_ptr + y * 320 + x) = _color; + *(dest_ptr + y * _realWidth + x) = _color; } } @@ -937,7 +937,7 @@ void CharsetRenderer::printChar(int chr) _hasMask = true; #endif - _dest_ptr = _backbuff_ptr = vs->screenPtr + vs->xstart + _drawTop * 320 + _left; + _dest_ptr = _backbuff_ptr = vs->screenPtr + vs->xstart + _drawTop * _realWidth + _left; #if !defined(OLD) if (_blitAlso) { @@ -945,7 +945,7 @@ void CharsetRenderer::printChar(int chr) if (1) { #endif _dest_ptr = _bgbak_ptr = _vm->getResourceAddress(rtBuffer, vs->number + 5) - + vs->xstart + _drawTop * 320 + _left; + + vs->xstart + _drawTop * _realWidth + _left; } _mask_ptr = _vm->getResourceAddress(rtBuffer, 9) @@ -1012,7 +1012,7 @@ void CharsetRenderer::drawBits() maskpos++; } } - dst = (_dest_ptr += 320); + dst = (_dest_ptr += _realWidth); mask += 40; y++; } -- cgit v1.2.3