Cleanup HE changes.

Fix 0xFE check in drawString() too.

svn-id: r19399
This commit is contained in:
Travis Howell 2005-11-03 02:24:53 +00:00
parent c84d1ada32
commit f8e4ce2134

View file

@ -138,7 +138,7 @@ void ScummEngine_v7::clearSubtitleQueue() {
bool ScummEngine::handleNextCharsetCode(Actor *a, int *code) { bool ScummEngine::handleNextCharsetCode(Actor *a, int *code) {
uint32 talk_sound_a = 0; uint32 talk_sound_a = 0;
uint32 talk_sound_b = 0; uint32 talk_sound_b = 0;
int i, color, frme, c, oldy; int color, frme, c, oldy;
bool endLoop = false; bool endLoop = false;
byte *buffer = _charsetBuffer + _charsetBufPos; byte *buffer = _charsetBuffer + _charsetBufPos;
while (!endLoop) { while (!endLoop) {
@ -203,8 +203,7 @@ bool ScummEngine::handleNextCharsetCode(Actor *a, int *code) {
oldy = _charset->getFontHeight(); oldy = _charset->getFontHeight();
_charset->setCurID(*buffer++); _charset->setCurID(*buffer++);
buffer += 2; buffer += 2;
for (i = 0; i < 4; i++) memcpy(_charsetColorMap, _charsetData[_charset->getCurID()], 4);
_charsetColorMap[i] = _charsetData[_charset->getCurID()][i];
_charset->_nextTop -= _charset->getFontHeight() - oldy; _charset->_nextTop -= _charset->getFontHeight() - oldy;
break; break;
default: default:
@ -223,8 +222,9 @@ bool ScummEngine_v72he::handleNextCharsetCode(Actor *a, int *code) {
uint32 talk_sound_b = 0; uint32 talk_sound_b = 0;
int i, c; int i, c;
char value[32]; char value[32];
bool endLoop = false;
byte *buffer = _charsetBuffer + _charsetBufPos; byte *buffer = _charsetBuffer + _charsetBufPos;
do { while (!endLoop) {
c = *buffer++; c = *buffer++;
if (c != charsetCode) { if (c != charsetCode) {
break; break;
@ -233,7 +233,7 @@ bool ScummEngine_v72he::handleNextCharsetCode(Actor *a, int *code) {
switch (c) { switch (c) {
case 84: case 84:
i = 0; i = 0;
memset(value, 0, 32); memset(value, 0, sizeof(value));
c = *buffer++; c = *buffer++;
while (c != 44) { while (c != 44) {
value[i] = c; value[i] = c;
@ -243,7 +243,7 @@ bool ScummEngine_v72he::handleNextCharsetCode(Actor *a, int *code) {
value[i] = 0; value[i] = 0;
talk_sound_a = atoi(value); talk_sound_a = atoi(value);
i = 0; i = 0;
memset(value, 0, 32); memset(value, 0, sizeof(value));
c = *buffer++; c = *buffer++;
while (c != charsetCode) { while (c != charsetCode) {
value[i] = c; value[i] = c;
@ -257,13 +257,15 @@ bool ScummEngine_v72he::handleNextCharsetCode(Actor *a, int *code) {
case 104: case 104:
_haveMsg = 0; _haveMsg = 0;
_keepText = true; _keepText = true;
endLoop = true;
break; break;
case 110: case 110:
c = 13; // new line c = 13; // new line
endLoop = true;
break; break;
case 116: case 116:
i = 0; i = 0;
memset(value, 0, 32); memset(value, 0, sizeof(value));
c = *buffer++; c = *buffer++;
while (c != charsetCode) { while (c != charsetCode) {
value[i] = c; value[i] = c;
@ -278,14 +280,15 @@ bool ScummEngine_v72he::handleNextCharsetCode(Actor *a, int *code) {
case 119: case 119:
_haveMsg = 0xFF; _haveMsg = 0xFF;
_keepText = false; _keepText = false;
endLoop = true;
break; break;
default: default:
error("handleNextCharsetCode: invalid code %d", c); error("handleNextCharsetCode: invalid code %d", c);
} }
} while (c != 13); }
_charsetBufPos = buffer - _charsetBuffer; _charsetBufPos = buffer - _charsetBuffer;
*code = c; *code = c;
return true; return (c != 104 && c != 119);
} }
#endif #endif
@ -526,10 +529,8 @@ void ScummEngine::drawString(int a, const byte *msg) {
_charset->_disableOffsX = _charset->_firstChar = true; _charset->_disableOffsX = _charset->_firstChar = true;
_charset->setCurID(_string[a].charset); _charset->setCurID(_string[a].charset);
if (_version >= 5) { if (_version >= 5)
for (i = 0; i < 4; i++) memcpy(_charsetColorMap, _charsetData[_charset->getCurID()], 4);
_charsetColorMap[i] = _charsetData[_charset->getCurID()][i];
}
fontHeight = _charset->getFontHeight(); fontHeight = _charset->getFontHeight();
@ -573,7 +574,7 @@ void ScummEngine::drawString(int a, const byte *msg) {
_charset->_top += fontHeight; _charset->_top += fontHeight;
break; break;
} }
} else if (c == 0xFE || c == 0xFF) { } else if (c == 0xFF || (_version <= 6 && c == 0xFE)) {
c = buf[i++]; c = buf[i++];
switch (c) { switch (c) {
case 9: case 9: