[Scummvm-cvs-logs] CVS: scummvm gfx.cpp,1.34,1.35 scummvm.cpp,1.40,1.41 string.cpp,1.23,1.24
Vincent Hamm
yazoo at users.sourceforge.net
Tue Feb 19 14:37:01 CET 2002
Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv30540
Modified Files:
gfx.cpp scummvm.cpp string.cpp
Log Message:
Fixed getStringWidth. Fixed various text misspositions. Reworked the the redraw text background to make it more acqurate. Added support for colored strings.
Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gfx.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** gfx.cpp 19 Feb 2002 21:20:26 -0000 1.34
--- gfx.cpp 19 Feb 2002 22:36:09 -0000 1.35
***************
*** 1392,1399 ****
void Scumm::restoreCharsetBg() {
_bkColor = 0;
! if (_features & GF_OLD256) {
! restoreBG(0,0,320,16);
! restoreBG(0,144,320,200);
! }
if (gdi._mask_left != -1) {
restoreBG(gdi._mask_left, gdi._mask_top, gdi._mask_right, gdi._mask_bottom);
--- 1392,1396 ----
void Scumm::restoreCharsetBg() {
_bkColor = 0;
!
if (gdi._mask_left != -1) {
restoreBG(gdi._mask_left, gdi._mask_top, gdi._mask_right, gdi._mask_bottom);
Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -d -r1.40 -r1.41
*** scummvm.cpp 15 Feb 2002 13:11:51 -0000 1.40
--- scummvm.cpp 19 Feb 2002 22:36:09 -0000 1.41
***************
*** 134,139 ****
for (i=0; i<6; i++) {
! string[i].t_xpos = 2;
! string[i].t_ypos = 5;
string[i].t_right = 319;
string[i].t_color = 0xF;
--- 134,145 ----
for (i=0; i<6; i++) {
! if(_features & GF_OLD256)
! {
! string[i].t_xpos = 0;
! string[i].t_ypos = 0;
! } else {
! string[i].t_xpos = 2;
! string[i].t_ypos = 5;
! }
string[i].t_right = 319;
string[i].t_color = 0xF;
Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/string.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** string.cpp 17 Feb 2002 18:56:06 -0000 1.23
--- string.cpp 19 Feb 2002 22:36:09 -0000 1.24
***************
*** 28,34 ****
byte chr;
- if (_vm->_features & GF_OLD256)
- return strlen((char *)text) * 8;
-
width = 1;
ptr = _vm->getResourceAddress(rtCharset, _curId) + 29;
--- 28,31 ----
***************
*** 68,80 ****
}
}
!
! offs = READ_LE_UINT32(ptr + chr*4 + 4);
! if (offs) {
! if (ptr[offs+2]>=0x80) {
! w = ptr[offs+2] - 0x100;
! } else {
! w = ptr[offs+2];
}
- width += ptr[offs] + w;
}
}
--- 65,80 ----
}
}
! if(_vm->_features & GF_OLD256) {
! width += 8;
! } else {
! offs = READ_LE_UINT32(ptr + chr*4 + 4);
! if (offs) {
! if (ptr[offs+2]>=0x80) {
! w = ptr[offs+2] - 0x100;
! } else {
! w = ptr[offs+2];
! }
! width += ptr[offs] + w;
}
}
}
***************
*** 88,92 ****
byte *ptr;
byte chr;
- if (_vm->_features & GF_OLD256) return;
ptr = _vm->getResourceAddress(rtCharset, _curId) + 29;
--- 88,91 ----
***************
*** 133,145 ****
if (chr==' ')
lastspace = pos - 1;
!
! offs = READ_LE_UINT32(ptr + chr*4 + 4);
! if (offs) {
! if (ptr[offs+2]>=0x80) {
! w = ptr[offs+2] - 0x100;
! } else {
! w = ptr[offs+2];
}
- curw += w + ptr[offs];
}
if (lastspace==-1)
--- 132,147 ----
if (chr==' ')
lastspace = pos - 1;
! if(_vm->_features & GF_OLD256) {
! curw += 8;
! } else {
! offs = READ_LE_UINT32(ptr + chr*4 + 4);
! if (offs) {
! if (ptr[offs+2]>=0x80) {
! w = ptr[offs+2] - 0x100;
! } else {
! w = ptr[offs+2];
! }
! curw += w + ptr[offs];
}
}
if (lastspace==-1)
***************
*** 278,281 ****
--- 280,293 ----
if (!_keepText) {
+ if(_features & GF_OLD256) {
+ int lenght;
+
+ gdi._mask_left = string[0].xpos;
+ gdi._mask_top = string[0].ypos;
+ gdi._mask_bottom = string[0].ypos+8;
+ gdi._mask_right = 320;
+ if(string[0].ypos <= 16) // If we are cleaning the text line, clean 2 lines.
+ gdi._mask_bottom = 16;
+ }
restoreCharsetBg();
charset._xpos2 = string[0].xpos;
***************
*** 311,324 ****
if (c == 13) {
newLine:;
! charset._xpos2 = string[0].xpos;
! if (charset._center) {
! charset._xpos2 -= charset.getStringWidth(0, buffer, 0)>>1;
}
- if(_features & GF_SMALL_HEADER)
- charset._ypos2 += getResourceAddress(rtCharset,charset._curId)[18];
- else
- charset._ypos2 += getResourceAddress(rtCharset,charset._curId)[30];
- charset._disableOffsX = 1;
- continue;
}
--- 323,343 ----
if (c == 13) {
newLine:;
! if(_features & GF_OLD256)
! {
! charset._ypos2 = 8;
! charset._xpos2 = 0;
! continue;
! } else {
! charset._xpos2 = string[0].xpos;
! if (charset._center) {
! charset._xpos2 -= charset.getStringWidth(0, buffer, 0)>>1;
! }
! if(_features & GF_SMALL_HEADER)
! charset._ypos2 += getResourceAddress(rtCharset,charset._curId)[18];
! else
! charset._ypos2 += getResourceAddress(rtCharset,charset._curId)[30];
! charset._disableOffsX = 1;
! continue;
}
}
***************
*** 697,701 ****
color = ((buffer & mask) != 0);
if (color)
! *(dest_ptr + y*320 + x) = color;
}
}
--- 716,720 ----
color = ((buffer & mask) != 0);
if (color)
! *(dest_ptr + y*320 + x) = _color;
}
}
More information about the Scummvm-git-logs
mailing list