Fix drawDescString - still needs centering corrections
svn-id: r5094
This commit is contained in:
parent
9b93506bcb
commit
d19260af2c
3 changed files with 33 additions and 55 deletions
|
@ -2827,9 +2827,7 @@ void Scumm::o6_miscOps()
|
||||||
_string[0].color = (byte)args[2];
|
_string[0].color = (byte)args[2];
|
||||||
_string[0].xpos = args[3];
|
_string[0].xpos = args[3];
|
||||||
_string[0].ypos = args[4];
|
_string[0].ypos = args[4];
|
||||||
|
drawDescString(getStringAddressVar(VAR_STRING2DRAW));
|
||||||
addMessageToStack(getStringAddressVar(VAR_STRING2DRAW));
|
|
||||||
drawDescString();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 17:
|
case 17:
|
||||||
|
|
|
@ -939,7 +939,7 @@ public:
|
||||||
int hasCharsetMask(int x, int y, int x2, int y2);
|
int hasCharsetMask(int x, int y, int x2, int y2);
|
||||||
void CHARSET_1();
|
void CHARSET_1();
|
||||||
void description();
|
void description();
|
||||||
void drawDescString();
|
void drawDescString(byte *msg);
|
||||||
byte *_msgPtrToAdd;
|
byte *_msgPtrToAdd;
|
||||||
byte *addMessageToStack(byte *msg);
|
byte *addMessageToStack(byte *msg);
|
||||||
void addIntToStack(int var);
|
void addIntToStack(int var);
|
||||||
|
|
|
@ -504,70 +504,50 @@ void Scumm::description()
|
||||||
gdi._mask_bottom = charset._strBottom;
|
gdi._mask_bottom = charset._strBottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scumm::drawDescString()
|
void Scumm::drawDescString(byte *msg)
|
||||||
{
|
{
|
||||||
byte byte1=0, chr, *buf, *charsetptr;
|
byte c, *buf, buffer[256];
|
||||||
uint color, i;
|
|
||||||
|
buf = _msgPtrToAdd = buffer;
|
||||||
|
addMessageToStack(msg);
|
||||||
|
|
||||||
buf = charset._buffer;
|
|
||||||
charset._bufPos = 0;
|
charset._bufPos = 0;
|
||||||
|
|
||||||
charset._left2 = charset._left = _string[0].xpos;
|
|
||||||
charset._top = _string[0].ypos;
|
charset._top = _string[0].ypos;
|
||||||
charset._curId = _string[0].charset;
|
charset._left = _string[0].xpos;
|
||||||
charset._center = _string[0].center;
|
charset._left2 = _string[0].xpos;
|
||||||
charset._right = _string[0].right;
|
charset._right = _realWidth - 1;
|
||||||
charset._color = _string[0].color;
|
|
||||||
|
|
||||||
charset._xpos2 = _string[0].xpos;
|
charset._xpos2 = _string[0].xpos;
|
||||||
charset._ypos2 = _string[0].ypos;
|
charset._ypos2 = _string[0].ypos;
|
||||||
|
charset._curId = _string[0].charset;
|
||||||
|
charset._center = _string[0].center;
|
||||||
|
charset._color = _string[0].color;
|
||||||
|
|
||||||
|
// Center text
|
||||||
|
charset._xpos2 -= charset.getStringWidth(0, buffer, 0) >> 1;
|
||||||
|
if (charset._xpos2 < 0)
|
||||||
|
charset._xpos2 = 0;
|
||||||
|
|
||||||
charset._disableOffsX = charset._unk12 = 1;
|
charset._disableOffsX = charset._unk12 = 1;
|
||||||
_bkColor = 0;
|
_bkColor = 0;
|
||||||
_talkDelay = 1;
|
_talkDelay = 1;
|
||||||
|
|
||||||
charset._left -= charset.getStringWidth(0, buf, 0) >> 1;
|
|
||||||
|
|
||||||
restoreCharsetBg();
|
restoreCharsetBg();
|
||||||
|
|
||||||
// Read color mapping and height information
|
do {
|
||||||
charsetptr = getResourceAddress(rtCharset, charset._curId);
|
c = *buf++;
|
||||||
assert(charsetptr);
|
if (c == 0) {
|
||||||
charsetptr += 29;
|
_haveMsg = 1;
|
||||||
for (i = 0; i < 4; i++)
|
|
||||||
charset._colorMap[i] = _charsetData[charset._curId][i];
|
|
||||||
|
|
||||||
byte1 = charsetptr[1]; // Character height
|
|
||||||
|
|
||||||
for (i = 0; (chr = buf[i++]) != 0;) {
|
|
||||||
if (chr == 254)
|
|
||||||
chr = 255;
|
|
||||||
if (chr == 255) {
|
|
||||||
chr = buf[i++];
|
|
||||||
switch (chr) {
|
|
||||||
case 9:
|
|
||||||
case 10:
|
|
||||||
case 13:
|
|
||||||
case 14:
|
|
||||||
i += 2;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
case 8:
|
|
||||||
charset._left = charset._left2 - charset.getStringWidth(0, buf, i);
|
|
||||||
charset._top += byte1;
|
|
||||||
break;
|
|
||||||
case 12:
|
|
||||||
color = buf[i] + (buf[i + 1] << 8);
|
|
||||||
i += 2;
|
|
||||||
if (color == 0xFF)
|
|
||||||
charset._color = _string[0].color;
|
|
||||||
else
|
|
||||||
charset._color = color;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
if (c != 0xFF) {
|
||||||
charset.printChar(chr);
|
charset._left = charset._xpos2;
|
||||||
}
|
charset._top = charset._ypos2;
|
||||||
|
charset.printChar(c);
|
||||||
|
charset._xpos2 = charset._left;
|
||||||
|
charset._ypos2 = charset._top;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
} while (1);
|
||||||
|
|
||||||
gdi._mask_left = charset._strLeft;
|
gdi._mask_left = charset._strLeft;
|
||||||
gdi._mask_right = charset._strRight;
|
gdi._mask_right = charset._strRight;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue