renamed updateDirtyRect to markRectAsDirty (because that's what it really does); used virtual screen id constants in more places
svn-id: r12122
This commit is contained in:
parent
105895da46
commit
bceb48f5e0
10 changed files with 50 additions and 47 deletions
|
@ -673,7 +673,7 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) {
|
|||
if (_actorHitX < x_left || _actorHitX >= x_right || _actorHitY < y_top || _actorHitY >= y_bottom)
|
||||
return 0;
|
||||
} else
|
||||
_vm->updateDirtyRect(0, x_left, x_right, y_top, y_bottom, _dirty_id);
|
||||
_vm->markRectAsDirty(kMainVirtScreen, x_left, x_right, y_top, y_bottom, _dirty_id);
|
||||
|
||||
if (y_top >= (int)_outheight || y_bottom <= 0)
|
||||
return 0;
|
||||
|
@ -763,7 +763,7 @@ byte AkosRenderer::codec5(int xmoveCur, int ymoveCur) {
|
|||
maxw = _outwidth - 1;
|
||||
maxh = _outheight - 1;
|
||||
|
||||
_vm->updateDirtyRect(0, clip_left, clip_right + 1, clip_top, clip_bottom + 1, _dirty_id);
|
||||
_vm->markRectAsDirty(kMainVirtScreen, clip_left, clip_right + 1, clip_top, clip_bottom + 1, _dirty_id);
|
||||
|
||||
if (clip_top < 0) {
|
||||
clip_top = 0;
|
||||
|
@ -980,7 +980,7 @@ byte AkosRenderer::codec16(int xmoveCur, int ymoveCur) {
|
|||
cur_x = _width - 1;
|
||||
cur_y = _height - 1;
|
||||
|
||||
_vm->updateDirtyRect(0, clip_left, clip_right + 1, clip_top, clip_bottom + 1, _dirty_id);
|
||||
_vm->markRectAsDirty(kMainVirtScreen, clip_left, clip_right + 1, clip_top, clip_bottom + 1, _dirty_id);
|
||||
|
||||
if (clip_left < 0) {
|
||||
skip_x = -clip_left;
|
||||
|
|
|
@ -977,7 +977,7 @@ void CharsetRendererV3::printChar(int chr) {
|
|||
mask_ptr = _vm->getMaskBuffer(_left, drawTop, 0);
|
||||
useMask = (vs->number == 0 && !_ignoreCharsetMask);
|
||||
|
||||
_vm->updateDirtyRect(vs->number, _left, _left + w, drawTop, drawTop + h, 0);
|
||||
_vm->markRectAsDirty(vs->number, _left, _left + w, drawTop, drawTop + h, 0);
|
||||
if (vs->number == 0)
|
||||
_hasMask = true;
|
||||
|
||||
|
@ -1082,7 +1082,7 @@ void CharsetRendererClassic::printChar(int chr) {
|
|||
|
||||
int drawTop = _top - vs->topline;
|
||||
|
||||
_vm->updateDirtyRect(vs->number, _left, _left + width, drawTop, drawTop + height + offsY, 0);
|
||||
_vm->markRectAsDirty(vs->number, _left, _left + width, drawTop, drawTop + height + offsY, 0);
|
||||
|
||||
if (vs->number != 0)
|
||||
_blitAlso = false;
|
||||
|
@ -1296,7 +1296,7 @@ void CharsetRendererNut::printChar(int chr) {
|
|||
|
||||
_hasMask = true;
|
||||
_current->drawShadowChar(chr, _left, _top - _vm->_screenTop, _color, !_ignoreCharsetMask);
|
||||
_vm->updateDirtyRect(0, shadow_left, shadow_right, shadow_top, shadow_bottom, 0);
|
||||
_vm->markRectAsDirty(kMainVirtScreen, shadow_left, shadow_right, shadow_top, shadow_bottom, 0);
|
||||
|
||||
_left += width;
|
||||
|
||||
|
|
|
@ -202,9 +202,9 @@ byte CostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) {
|
|||
|
||||
if (_vm->_version == 1)
|
||||
//HACK: it fix gfx glitches leaved by actor costume in V1 games, when actor moving to left
|
||||
_vm->updateDirtyRect(0, x_left, x_right + 8, y_top, y_bottom, _dirty_id);
|
||||
_vm->markRectAsDirty(kMainVirtScreen, x_left, x_right + 8, y_top, y_bottom, _dirty_id);
|
||||
else
|
||||
_vm->updateDirtyRect(0, x_left, x_right + 1, y_top, y_bottom, _dirty_id);
|
||||
_vm->markRectAsDirty(kMainVirtScreen, x_left, x_right + 1, y_top, y_bottom, _dirty_id);
|
||||
|
||||
if (y_top >= (int)_outheight || y_bottom <= 0)
|
||||
return 0;
|
||||
|
|
|
@ -709,7 +709,7 @@ void ScummDebugger::drawBox(int box) {
|
|||
|
||||
VirtScreen *vs = _vm->findVirtScreen(coords.ul.y);
|
||||
if (vs != NULL)
|
||||
_vm->updateDirtyRect(vs->number, 0, _vm->_screenWidth, 0, _vm->_screenHeight, 0);
|
||||
_vm->markRectAsDirty(vs->number, 0, _vm->_screenWidth, 0, _vm->_screenHeight, 0);
|
||||
_vm->drawDirtyScreenParts();
|
||||
_vm->_system->update_screen();
|
||||
}
|
||||
|
|
|
@ -31,6 +31,14 @@
|
|||
|
||||
namespace Scumm {
|
||||
|
||||
struct StripTable {
|
||||
int offsets[160];
|
||||
int run[160];
|
||||
int color[160];
|
||||
int zoffsets[120]; // FIXME: Why only 120 here?
|
||||
int zrun[120]; // FIXME: Why only 120 here?
|
||||
};
|
||||
|
||||
enum {
|
||||
kScrolltime = 500, // ms scrolling is supposed to take
|
||||
kPictureDelay = 20
|
||||
|
@ -223,9 +231,9 @@ void ScummEngine::initScreens(int b, int w, int h) {
|
|||
// Since the size of screen 3 is fixed, there is no need to reallocate it
|
||||
// if its size changed.
|
||||
if (_version >= 7) {
|
||||
initVirtScreen(3, 0, (_screenHeight / 2) - 10, _screenWidth, 13, false, false);
|
||||
initVirtScreen(kUnkVirtScreen, 0, (_screenHeight / 2) - 10, _screenWidth, 13, false, false);
|
||||
} else {
|
||||
initVirtScreen(3, 0, 80, _screenWidth, 13, false, false);
|
||||
initVirtScreen(kUnkVirtScreen, 0, 80, _screenWidth, 13, false, false);
|
||||
}
|
||||
}
|
||||
initVirtScreen(kMainVirtScreen, 0, b, _screenWidth, h - b, true, true);
|
||||
|
@ -236,7 +244,7 @@ void ScummEngine::initScreens(int b, int w, int h) {
|
|||
_screenH = h;
|
||||
}
|
||||
|
||||
void ScummEngine::initVirtScreen(int slot, int number, int top, int width, int height, bool twobufs,
|
||||
void ScummEngine::initVirtScreen(VirtScreenNumber slot, int number, int top, int width, int height, bool twobufs,
|
||||
bool scrollable) {
|
||||
VirtScreen *vs = &virtscr[slot];
|
||||
int size;
|
||||
|
@ -292,7 +300,7 @@ VirtScreen *ScummEngine::findVirtScreen(int y) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void ScummEngine::updateDirtyRect(int virt, int left, int right, int top, int bottom, int dirtybit) {
|
||||
void ScummEngine::markRectAsDirty(VirtScreenNumber virt, int left, int right, int top, int bottom, int dirtybit) {
|
||||
VirtScreen *vs = &virtscr[virt];
|
||||
int lp, rp;
|
||||
|
||||
|
@ -306,7 +314,7 @@ void ScummEngine::updateDirtyRect(int virt, int left, int right, int top, int bo
|
|||
if (bottom > vs->height)
|
||||
bottom = vs->height;
|
||||
|
||||
if (virt == 0 && dirtybit) {
|
||||
if (virt == kMainVirtScreen && dirtybit) {
|
||||
lp = left / 8 + _screenStartStrip;
|
||||
if (lp < 0)
|
||||
lp = 0;
|
||||
|
@ -382,7 +390,7 @@ void ScummEngine::drawDirtyScreenParts() {
|
|||
}
|
||||
}
|
||||
|
||||
void ScummEngine::updateDirtyScreen(int slot) {
|
||||
void ScummEngine::updateDirtyScreen(VirtScreenNumber slot) {
|
||||
gdi.updateDirtyScreen(&virtscr[slot]);
|
||||
}
|
||||
|
||||
|
@ -451,12 +459,6 @@ void Gdi::drawStripToScreen(VirtScreen *vs, int x, int w, int t, int b) {
|
|||
_vm->_system->copy_rect(ptr, _vm->_screenWidth, x, vs->topline + t, w, height);
|
||||
}
|
||||
|
||||
void Gdi::clearCharsetMask() {
|
||||
memset(_vm->getResourceAddress(rtBuffer, 9), 0, _imgBufOffs[1]);
|
||||
_mask.top = _mask.left = 32767;
|
||||
_mask.right = _mask.bottom = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the background behind an actor or blast object.
|
||||
*/
|
||||
|
@ -550,14 +552,14 @@ void ScummEngine::drawBox(int x, int y, int x2, int y2, int color) {
|
|||
else if (y2 > vs->height)
|
||||
y2 = vs->height;
|
||||
|
||||
updateDirtyRect(vs->number, x, x2, y, y2, 0);
|
||||
markRectAsDirty(vs->number, x, x2, y, y2, 0);
|
||||
|
||||
backbuff = vs->screenPtr + vs->xstart + y * _screenWidth + x;
|
||||
|
||||
width = x2 - x;
|
||||
height = y2 - y;
|
||||
if (color == -1) {
|
||||
if (vs->number != 0)
|
||||
if (vs->number != kMainVirtScreen)
|
||||
error("can only copy bg to main window");
|
||||
bgbuff = getResourceAddress(rtBuffer, vs->number + 5) + vs->xstart + y * _screenWidth + x;
|
||||
blit(backbuff, bgbuff, width, height);
|
||||
|
@ -630,7 +632,7 @@ void ScummEngine::drawFlashlight() {
|
|||
|
||||
// Remove the flash light first if it was previously drawn
|
||||
if (_flashlight.isDrawn) {
|
||||
updateDirtyRect(0, _flashlight.x, _flashlight.x + _flashlight.w,
|
||||
markRectAsDirty(kMainVirtScreen, _flashlight.x, _flashlight.x + _flashlight.w,
|
||||
_flashlight.y, _flashlight.y + _flashlight.h, USAGE_BIT_DIRTY);
|
||||
|
||||
if (_flashlight.buffer) {
|
||||
|
@ -820,7 +822,7 @@ void ScummEngine::restoreBG(Common::Rect rect, byte backColor) {
|
|||
if (rect.bottom >= height)
|
||||
rect.bottom = height;
|
||||
|
||||
updateDirtyRect(vs->number, rect.left, rect.right, rect.top - topline, rect.bottom - topline, USAGE_BIT_RESTORED);
|
||||
markRectAsDirty(vs->number, rect.left, rect.right, rect.top - topline, rect.bottom - topline, USAGE_BIT_RESTORED);
|
||||
|
||||
int offset = (rect.top - topline) * _screenWidth + vs->xstart + rect.left;
|
||||
backbuff = vs->screenPtr + offset;
|
||||
|
@ -830,11 +832,11 @@ void ScummEngine::restoreBG(Common::Rect rect, byte backColor) {
|
|||
width = rect.width();
|
||||
|
||||
// Check whether lights are turned on or not
|
||||
lightsOn = (_features & GF_NEW_OPCODES) || (vs->number != 0) || (VAR(VAR_CURRENT_LIGHTS) & LIGHTMODE_screen);
|
||||
lightsOn = (_features & GF_NEW_OPCODES) || (vs->number != kMainVirtScreen) || (VAR(VAR_CURRENT_LIGHTS) & LIGHTMODE_screen);
|
||||
|
||||
if (vs->alloctwobuffers && _currentRoom != 0 && lightsOn ) {
|
||||
blit(backbuff, bgbak, width, height);
|
||||
if (vs->number == 0 && _charset->_hasMask && height) {
|
||||
if (vs->number == kMainVirtScreen && _charset->_hasMask && height) {
|
||||
byte *mask;
|
||||
// Note: At first sight it may look as if this could
|
||||
// be optimized to (rect.right - rect.left) / 8 and
|
||||
|
@ -846,7 +848,7 @@ void ScummEngine::restoreBG(Common::Rect rect, byte backColor) {
|
|||
mask_width++;
|
||||
|
||||
mask = getMaskBuffer(rect.left, rect.top, 0);
|
||||
if (vs->number == 0)
|
||||
if (vs->number == kMainVirtScreen)
|
||||
mask += vs->topline * gdi._numStrips;
|
||||
|
||||
do {
|
||||
|
@ -862,6 +864,12 @@ void ScummEngine::restoreBG(Common::Rect rect, byte backColor) {
|
|||
}
|
||||
}
|
||||
|
||||
void Gdi::clearCharsetMask() {
|
||||
memset(_vm->getResourceAddress(rtBuffer, 9), 0, _imgBufOffs[1]);
|
||||
_mask.top = _mask.left = 32767;
|
||||
_mask.right = _mask.bottom = 0;
|
||||
}
|
||||
|
||||
bool ScummEngine::hasCharsetMask(int left, int top, int right, int bottom) {
|
||||
Common::Rect rect(left, top, right, bottom);
|
||||
|
||||
|
@ -901,7 +909,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi
|
|||
bool useOrDecompress = false;
|
||||
|
||||
// Check whether lights are turned on or not
|
||||
lightsOn = (_vm->_features & GF_NEW_OPCODES) || (vs->number != 0) || (_vm->VAR(_vm->VAR_CURRENT_LIGHTS) & LIGHTMODE_screen);
|
||||
lightsOn = (_vm->_features & GF_NEW_OPCODES) || (vs->number != kMainVirtScreen) || (_vm->VAR(_vm->VAR_CURRENT_LIGHTS) & LIGHTMODE_screen);
|
||||
|
||||
CHECK_HEAP;
|
||||
if (_vm->_features & GF_SMALL_HEADER)
|
||||
|
|
15
scumm/gfx.h
15
scumm/gfx.h
|
@ -48,15 +48,16 @@ struct CameraData {
|
|||
};
|
||||
|
||||
/** Virtual screen identifiers */
|
||||
enum {
|
||||
enum VirtScreenNumber {
|
||||
kMainVirtScreen = 0, // The 'stage'
|
||||
kTextVirtScreen = 1, // In V1-V3 games: the area where text is printed
|
||||
kVerbVirtScreen = 2 // The verb area
|
||||
kVerbVirtScreen = 2, // The verb area
|
||||
kUnkVirtScreen = 3 // ?? Not sure what this one is good for...
|
||||
};
|
||||
|
||||
/** Virtual screen areas */
|
||||
struct VirtScreen {
|
||||
int number;
|
||||
VirtScreenNumber number;
|
||||
uint16 topline;
|
||||
uint16 width, height;
|
||||
byte alloctwobuffers;
|
||||
|
@ -111,13 +112,7 @@ struct BompDrawData {
|
|||
BompDrawData() { memset(this, 0, sizeof(*this)); }
|
||||
};
|
||||
|
||||
struct StripTable {
|
||||
int offsets[160];
|
||||
int run[160];
|
||||
int color[160];
|
||||
int zoffsets[120]; // FIXME: Why only 120 here?
|
||||
int zrun[120]; // FIXME: Why only 120 here?
|
||||
};
|
||||
struct StripTable;
|
||||
|
||||
class Gdi {
|
||||
friend class ScummEngine; // Mostly for the code in saveload.cpp ...
|
||||
|
|
|
@ -1515,7 +1515,7 @@ void ScummEngine::drawBlastObject(BlastObject *eo) {
|
|||
drawBomp(bdd, false);
|
||||
}
|
||||
|
||||
updateDirtyRect(vs->number, bdd.x, bdd.x + bdd.srcwidth, bdd.y, bdd.y + bdd.srcheight, 0);
|
||||
markRectAsDirty(vs->number, bdd.x, bdd.x + bdd.srcwidth, bdd.y, bdd.y + bdd.srcheight, 0);
|
||||
}
|
||||
|
||||
void ScummEngine::removeBlastObjects() {
|
||||
|
@ -1569,7 +1569,7 @@ void ScummEngine::removeBlastObject(BlastObject *eo) {
|
|||
for (i = left_strip; i <= right_strip; i++)
|
||||
gdi.resetBackground(top, bottom, i);
|
||||
|
||||
updateDirtyRect(0, left, right, top, bottom, USAGE_BIT_RESTORED);
|
||||
markRectAsDirty(kMainVirtScreen, left, right, top, bottom, USAGE_BIT_RESTORED);
|
||||
}
|
||||
|
||||
int ScummEngine::findLocalObjectSlot() {
|
||||
|
|
|
@ -2854,7 +2854,7 @@ void ScummEngine_v5::o5_oldRoomEffect() {
|
|||
VirtScreen *vs = &virtscr[0];
|
||||
restoreBG(Common::Rect(0,vs->topline, vs->width, vs->topline + vs->height));
|
||||
virtscr[0].setDirtyRange(0, virtscr[0].height);
|
||||
updateDirtyScreen(0);
|
||||
updateDirtyScreen(kMainVirtScreen);
|
||||
|
||||
if (byte_2FCCF) {
|
||||
// Here now "sub_1C44" is called, which sets byte_2FCCF to 0 then
|
||||
|
|
|
@ -792,7 +792,7 @@ protected:
|
|||
StripTable *_roomStrips;
|
||||
|
||||
void initScreens(int b, int w, int h);
|
||||
void initVirtScreen(int slot, int number, int top, int width, int height, bool twobufs, bool scrollable);
|
||||
void initVirtScreen(VirtScreenNumber slot, int number, int top, int width, int height, bool twobufs, bool scrollable);
|
||||
void initBGBuffers(int height);
|
||||
void initCycl(const byte *ptr); // Color cycle
|
||||
|
||||
|
@ -855,10 +855,10 @@ protected:
|
|||
|
||||
|
||||
public:
|
||||
void updateDirtyRect(int virt, int left, int right, int top, int bottom, int dirtybit);
|
||||
void markRectAsDirty(VirtScreenNumber virt, int left, int right, int top, int bottom, int dirtybit);
|
||||
protected:
|
||||
void drawDirtyScreenParts();
|
||||
void updateDirtyScreen(int slot);
|
||||
void updateDirtyScreen(VirtScreenNumber slot);
|
||||
|
||||
public:
|
||||
VirtScreen *findVirtScreen(int y);
|
||||
|
|
|
@ -137,7 +137,7 @@ void ScummEngine::checkV2MouseOver(Common::Point pos) {
|
|||
dst += _screenWidth;
|
||||
}
|
||||
|
||||
updateDirtyRect(2, rect.left, rect.right, rect.top, rect.bottom, 0);
|
||||
markRectAsDirty(kVerbVirtScreen, rect.left, rect.right, rect.top, rect.bottom, 0);
|
||||
}
|
||||
|
||||
if (new_box != -1) {
|
||||
|
@ -154,7 +154,7 @@ void ScummEngine::checkV2MouseOver(Common::Point pos) {
|
|||
dst += _screenWidth;
|
||||
}
|
||||
|
||||
updateDirtyRect(2, rect.left, rect.right, rect.top, rect.bottom, 0);
|
||||
markRectAsDirty(kVerbVirtScreen, rect.left, rect.right, rect.top, rect.bottom, 0);
|
||||
}
|
||||
|
||||
v2_mouseover_box = new_box;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue