[Scummvm-cvs-logs] CVS: scummvm resource.cpp,1.35,1.36 scumm.h,1.47,1.48 string.cpp,1.21,1.22
James Brown
ender at users.sourceforge.net
Sat Feb 16 11:04:02 CET 2002
Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv31465
Modified Files:
resource.cpp scumm.h string.cpp
Log Message:
Zak256 charset support... Ego text doesn't work, someone else want to take a look? Verb console draws.
Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/resource.cpp,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** resource.cpp 15 Feb 2002 00:46:51 -0000 1.35
--- resource.cpp 16 Feb 2002 19:03:14 -0000 1.36
***************
*** 525,529 ****
else
openRoom(900+no);
! size = fileReadDword();
fileRead(_fileHandle, createResource(6, no, size), size);
openRoom(-1);
--- 525,533 ----
else
openRoom(900+no);
!
! if (_features & GF_OLD256)
! size = fileReadWordLE();
! else
! size = fileReadDword();
fileRead(_fileHandle, createResource(6, no, size), size);
openRoom(-1);
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -d -r1.47 -r1.48
*** scumm.h 15 Feb 2002 13:11:51 -0000 1.47
--- scumm.h 16 Feb 2002 19:03:14 -0000 1.48
***************
*** 592,595 ****
--- 592,596 ----
void drawBits();
void printChar(int chr);
+ void printCharOld(int chr);
int getStringWidth(int a, byte *str, int pos);
void addLinebreaks(int a, byte *str, int pos, int maxwidth);
Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/string.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** string.cpp 16 Feb 2002 03:59:18 -0000 1.21
--- string.cpp 16 Feb 2002 19:03:14 -0000 1.22
***************
*** 28,31 ****
--- 28,34 ----
byte chr;
+ if (_vm->_features & GF_OLD256)
+ return strlen((char *)text) * 8;
+
width = 1;
ptr = _vm->getResourceAddress(rtCharset, _curId) + 29;
***************
*** 33,37 ****
ptr-=12;
! while ( (chr = text[pos++]) != 0) {
if (chr==0xD)
break;
--- 36,40 ----
ptr-=12;
! while ((chr = text[pos++]) != 0) {
if (chr==0xD)
break;
***************
*** 85,88 ****
--- 88,92 ----
byte *ptr;
byte chr;
+ if (_vm->_features & GF_OLD256) return;
ptr = _vm->getResourceAddress(rtCharset, _curId) + 29;
***************
*** 289,293 ****
if(_features & GF_OLD256) {
debug(1, "CHARSET_1: %s", buffer);
! return;
}
charset.addLinebreaks(0, buffer,0, t);
--- 293,297 ----
if(_features & GF_OLD256) {
debug(1, "CHARSET_1: %s", buffer);
! //return;
}
charset.addLinebreaks(0, buffer,0, t);
***************
*** 328,333 ****
charset._left = charset._xpos2;
charset._top = charset._ypos2;
!
! if (!(_features&GF_AFTER_V6)) {
// if (!_vars[VAR_V5_CHARFLAG]) { /* FIXME */
charset.printChar(c);
--- 332,338 ----
charset._left = charset._xpos2;
charset._top = charset._ypos2;
! if (_features & GF_OLD256)
! charset.printCharOld(c);
! else if (!(_features&GF_AFTER_V6)) {
// if (!_vars[VAR_V5_CHARFLAG]) { /* FIXME */
charset.printChar(c);
***************
*** 420,431 ****
charset._unk12 = 1;
charset._disableOffsX = 1;
if(!(_features & GF_OLD256)) {
! charsetptr = getResourceAddress(rtCharset, charset._curId);
! assert(charsetptr);
! charsetptr += 29;
if(_features & GF_SMALL_HEADER)
charsetptr-=12;
! for(i=0; i<4; i++)
if(_features & GF_SMALL_HEADER)
charset._colorMap[i] = _charsetData[charset._curId][i-12];
--- 425,437 ----
charset._unk12 = 1;
charset._disableOffsX = 1;
+
if(!(_features & GF_OLD256)) {
! charsetptr = getResourceAddress(rtCharset, charset._curId);
! assert(charsetptr);
! charsetptr += 29;
if(_features & GF_SMALL_HEADER)
charsetptr-=12;
! for(i=0; i<4; i++)
if(_features & GF_SMALL_HEADER)
charset._colorMap[i] = _charsetData[charset._curId][i-12];
***************
*** 433,438 ****
charset._colorMap[i] = _charsetData[charset._curId][i];
! byte1 = charsetptr[1];
}
_msgPtrToAdd = buf;
--- 439,445 ----
charset._colorMap[i] = _charsetData[charset._curId][i];
! byte1 = charsetptr[1];
}
+
_msgPtrToAdd = buf;
***************
*** 448,455 ****
}
if(space) *space='\0';
- if(_features & GF_OLD256) {
- debug(1, "DRAWSTRING: %s", buf);
- return;
- }
if (charset._center) {
charset._left -= charset.getStringWidth(a, buf, 0) >> 1;
--- 455,458 ----
***************
*** 492,496 ****
if (a==1 && (_features&GF_AFTER_V6))
charset._blitAlso = true;
! charset.printChar(chr);
charset._blitAlso = false;
}
--- 495,502 ----
if (a==1 && (_features&GF_AFTER_V6))
charset._blitAlso = true;
! if (_features & GF_OLD256)
! charset.printCharOld(chr);
! else
! charset.printChar(chr);
charset._blitAlso = false;
}
***************
*** 655,665 ****
void Scumm::initCharset(int charsetno) {
int i;
! if(_features & GF_OLD256) return; // FIXME
!
! if (_features & GF_SMALL_HEADER)
! loadCharset(charsetno);
! else
! if (!getResourceAddress(rtCharset, charsetno))
! loadCharset(charsetno);
string[0].t_charset = charsetno;
--- 661,670 ----
void Scumm::initCharset(int charsetno) {
int i;
!
! if (_features & GF_SMALL_HEADER)
! loadCharset(charsetno);
! else
! if (!getResourceAddress(rtCharset, charsetno))
! loadCharset(charsetno);
string[0].t_charset = charsetno;
***************
*** 672,675 ****
--- 677,711 ----
charset._colorMap[i] = _charsetData[charset._curId][i];
}
+
+ void CharsetRenderer::printCharOld(int chr) { // Loom3 / Zak256
+ VirtScreen *vs;
+ byte *char_ptr, *dest_ptr;
+ unsigned int buffer, mask=0, x, y;
+ unsigned char color;
+
+ _vm->checkRange(_vm->_maxCharsets-1, 0, _curId, "Printing with bad charset %d");
+
+ if ((vs=_vm->findVirtScreen(_top)) == NULL)
+ return;
+
+ if (chr=='@')
+ return;
+
+ char_ptr = _vm->getResourceAddress(rtCharset, _curId) + 224 + (chr + 1)*8;
+ dest_ptr = _vm->getResourceAddress(rtBuffer, vs->number+1) + vs->xstart + (_top - vs->topline) * 320 + _left;
+ _vm->updateDirtyRect(vs->number, _left, _left + 8, _top - vs->topline, _top - vs->topline + 8, 0);
+
+ for(y=0;y<8;y++) {
+ for(x=0;x<8;x++) {
+ if ((mask >>= 1) == 0) {buffer = *char_ptr++; mask = 0x80;}
+ color = ((buffer & mask) != 0);
+ if (color)
+ *(dest_ptr + y*320 + x) = color;
+ }
+ }
+
+ _left+=8;
+ }
+
void CharsetRenderer::printChar(int chr) {
More information about the Scummvm-git-logs
mailing list