[Scummvm-cvs-logs] CVS: scummvm/scumm gfx.cpp,2.133,2.134 saveload.cpp,1.82,1.83 string.cpp,1.127,1.128
Max Horn
fingolfin at users.sourceforge.net
Sun Jun 1 10:30:09 CEST 2003
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm player_v2.cpp,2.8,2.9
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.119,1.120 actor.h,1.30,1.31 costume.cpp,1.55,1.56 script_v5.cpp,1.108,1.109 script_v6.cpp,1.147,1.148
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv8151
Modified Files:
gfx.cpp saveload.cpp string.cpp
Log Message:
charset masking fixes, mostly for The Dig (hey I think I finally almost understand that part of the code :-)
Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.133
retrieving revision 2.134
diff -u -d -r2.133 -r2.134
--- gfx.cpp 1 Jun 2003 14:30:26 -0000 2.133
+++ gfx.cpp 1 Jun 2003 17:29:45 -0000 2.134
@@ -447,6 +447,8 @@
void Gdi::clearCharsetMask() {
memset(_vm->getResourceAddress(rtBuffer, 9), 0, _imgBufOffs[1]);
+ _mask.top = _mask.left = 32767;
+ _mask.right = _mask.bottom = 0;
}
/**
@@ -763,10 +765,11 @@
}
void Scumm::restoreCharsetBg() {
- if (gdi._mask.left != -1) {
+ if (_charset->_hasMask) {
restoreBG(gdi._mask);
_charset->_hasMask = false;
- gdi._mask.left = -1;
+ gdi._mask.top = gdi._mask.left = 32767;
+ gdi._mask.right = gdi._mask.bottom = 0;
_charset->_str.left = -1;
_charset->_left = -1;
}
@@ -781,7 +784,7 @@
byte *backbuff, *bgbak;
bool lightsOn;
- if (rect.left == rect.right || rect.top == rect.bottom)
+ if (rect.left >= rect.right || rect.top >= rect.bottom)
return;
if (rect.top < 0)
rect.top = 0;
@@ -846,17 +849,9 @@
}
bool Scumm::hasCharsetMask(int left, int top, int right, int bottom) {
- // FIXME: I wonder if the <= / >= here shouldn't be replaced by < / >
- // After all, right/bottom are not actually part of the rects.
- // That is, the pixels part of the rect range from x = left .. right-1
- // and y = top .. bottom-1. The 'equal' / '=' cases in the check
- // would mean that the rects are touching on their borders, but not
- // actually overlapping.
- return _charset->_hasMask
- && top <= gdi._mask.bottom
- && left <= gdi._mask.right
- && bottom >= gdi._mask.top
- && right >= gdi._mask.left;
+ ScummVM::Rect rect(left, top, right, bottom);
+
+ return _charset->_hasMask && rect.intersects(gdi._mask);
}
byte *Scumm::getMaskBuffer(int x, int y, int z) {
Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.cpp,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -d -r1.82 -r1.83
--- saveload.cpp 31 May 2003 12:16:49 -0000 1.82
+++ saveload.cpp 1 Jun 2003 17:29:45 -0000 1.83
@@ -146,7 +146,9 @@
sb = _screenB;
sh = _screenH;
- gdi._mask.left = -1;
+ gdi._mask.top = gdi._mask.left = 32767;
+ gdi._mask.right = gdi._mask.bottom = 0;
+ _charset->_hasMask = false;
initScreens(0, 0, _screenWidth, _screenHeight);
Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.127
retrieving revision 1.128
diff -u -d -r1.127 -r1.128
--- string.cpp 31 May 2003 12:17:58 -0000 1.127
+++ string.cpp 1 Jun 2003 17:29:45 -0000 1.128
@@ -183,6 +183,7 @@
if (!_keepText) {
if ((_features & GF_AFTER_V2 || _features & GF_AFTER_V3) && _gameId != GID_LOOM) {
+ _charset->_hasMask = true;
gdi._mask.left = _string[0].xpos;
gdi._mask.top = _string[0].ypos;
gdi._mask.bottom = _string[0].ypos + 8;
@@ -331,7 +332,8 @@
_charsetBufPos = buffer - _charsetBuffer;
- gdi._mask = _charset->_str;
+ _charset->_hasMask = true;
+ gdi._mask.extend(_charset->_str);
}
void Scumm::drawDescString(const byte *msg) {
@@ -380,8 +382,9 @@
// hack: more 8 pixels at width and height while redraw
// for proper description redraw while scrolling room
- gdi._mask = _charset->_str;
- gdi._mask.grow(8);
+ ScummVM::Rect r(_charset->_str);
+ r.grow(8);
+ gdi._mask.extend(r);
}
void Scumm::drawString(int a) {
@@ -494,19 +497,8 @@
if (_features & GF_AFTER_V7) {
_charset->_hasMask = true;
- // FIXME - how is this supposed to ever work, since gdi._mask_left is by default set
- // to -1 to mark it as invalid. Hence this comparision will always leave it at -1,
- // which implies that if the mask was marked invalid, it will always stay so.
- // That seems odd and not at all to be the intended thing... or is it?
- if (_charset->_str.left < gdi._mask.left)
- gdi._mask.left = _charset->_str.left;
- if (_charset->_str.right > gdi._mask.right)
- gdi._mask.right = _charset->_str.right;
- if (_charset->_str.top < gdi._mask.top)
- gdi._mask.top = _charset->_str.top;
- if (_charset->_str.bottom > gdi._mask.bottom)
- gdi._mask.bottom = _charset->_str.bottom;
- }
+ gdi._mask.extend(_charset->_str);
+ }
}
const byte *Scumm::addMessageToStack(const byte *msg) {
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm player_v2.cpp,2.8,2.9
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.119,1.120 actor.h,1.30,1.31 costume.cpp,1.55,1.56 script_v5.cpp,1.108,1.109 script_v6.cpp,1.147,1.148
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list