Renamed StringTab::backup to StringTab::_default, as that describes better what it does

svn-id: r13476
This commit is contained in:
Max Horn 2004-04-05 23:54:58 +00:00
parent fbd9340768
commit 17fe0497f5
9 changed files with 47 additions and 44 deletions

View File

@ -571,23 +571,23 @@ void ScummEngine::saveOrLoad(Serializer *s, uint32 savegameVersion) {
}; };
const SaveLoadEntry stringTabEntries[] = { const SaveLoadEntry stringTabEntries[] = {
// Then backup/restore of a StringTab entry becomes a one liner. // Then _default/restore of a StringTab entry becomes a one liner.
MKLINE(StringTab, xpos, sleInt16, VER(8)), MKLINE(StringTab, xpos, sleInt16, VER(8)),
MKLINE(StringTab, backup.xpos, sleInt16, VER(8)), MKLINE(StringTab, _default.xpos, sleInt16, VER(8)),
MKLINE(StringTab, ypos, sleInt16, VER(8)), MKLINE(StringTab, ypos, sleInt16, VER(8)),
MKLINE(StringTab, backup.ypos, sleInt16, VER(8)), MKLINE(StringTab, _default.ypos, sleInt16, VER(8)),
MKLINE(StringTab, right, sleInt16, VER(8)), MKLINE(StringTab, right, sleInt16, VER(8)),
MKLINE(StringTab, backup.right, sleInt16, VER(8)), MKLINE(StringTab, _default.right, sleInt16, VER(8)),
MKLINE(StringTab, color, sleInt8, VER(8)), MKLINE(StringTab, color, sleInt8, VER(8)),
MKLINE(StringTab, backup.color, sleInt8, VER(8)), MKLINE(StringTab, _default.color, sleInt8, VER(8)),
MKLINE(StringTab, charset, sleInt8, VER(8)), MKLINE(StringTab, charset, sleInt8, VER(8)),
MKLINE(StringTab, backup.charset, sleInt8, VER(8)), MKLINE(StringTab, _default.charset, sleInt8, VER(8)),
MKLINE(StringTab, center, sleByte, VER(8)), MKLINE(StringTab, center, sleByte, VER(8)),
MKLINE(StringTab, backup.center, sleByte, VER(8)), MKLINE(StringTab, _default.center, sleByte, VER(8)),
MKLINE(StringTab, overhead, sleByte, VER(8)), MKLINE(StringTab, overhead, sleByte, VER(8)),
MKLINE(StringTab, backup.overhead, sleByte, VER(8)), MKLINE(StringTab, _default.overhead, sleByte, VER(8)),
MKLINE(StringTab, no_talk_anim, sleByte, VER(8)), MKLINE(StringTab, no_talk_anim, sleByte, VER(8)),
MKLINE(StringTab, backup.no_talk_anim, sleByte, VER(8)), MKLINE(StringTab, _default.no_talk_anim, sleByte, VER(8)),
MKEND() MKEND()
}; };

View File

@ -847,7 +847,7 @@ void ScummEngine_v2::o2_verbOps() {
vs->dimcolor = 8; vs->dimcolor = 8;
} }
vs->type = kTextVerbType; vs->type = kTextVerbType;
vs->charset_nr = _string[0].backup.charset; vs->charset_nr = _string[0]._default.charset;
vs->curmode = 1; vs->curmode = 1;
vs->saveid = 0; vs->saveid = 0;
vs->key = 0; vs->key = 0;

View File

@ -707,7 +707,7 @@ void ScummEngine_v5::o5_cursorCommand() {
} else { } else {
getWordVararg(table); getWordVararg(table);
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
_charsetColorMap[i] = _charsetData[_string[1].backup.charset][i] = (unsigned char)table[i]; _charsetColorMap[i] = _charsetData[_string[1]._default.charset][i] = (unsigned char)table[i];
} }
break; break;
} }
@ -2405,7 +2405,7 @@ void ScummEngine_v5::o5_verbOps() {
vs->hicolor = (_version == 3) ? 14 : 0; vs->hicolor = (_version == 3) ? 14 : 0;
vs->dimcolor = 8; vs->dimcolor = 8;
vs->type = kTextVerbType; vs->type = kTextVerbType;
vs->charset_nr = _string[0].backup.charset; vs->charset_nr = _string[0]._default.charset;
vs->curmode = 0; vs->curmode = 0;
vs->saveid = 0; vs->saveid = 0;
vs->key = 0; vs->key = 0;
@ -2616,7 +2616,7 @@ void ScummEngine_v5::decodeParseString() {
textSlot = 0; textSlot = 0;
} }
_string[textSlot].restoreString(); _string[textSlot].loadDefault();
while ((_opcode = fetchScriptByte()) != 0xFF) { while ((_opcode = fetchScriptByte()) != 0xFF) {
switch (_opcode & 0xF) { switch (_opcode & 0xF) {
@ -2709,9 +2709,9 @@ void ScummEngine_v5::decodeParseString() {
// speaks during the intro are put at position 0,0. // speaks during the intro are put at position 0,0.
// In addition, Loom needs to remember the text colour. // In addition, Loom needs to remember the text colour.
if (_gameId == GID_LOOM || _gameId == GID_INDY3) { if (_gameId == GID_LOOM || _gameId == GID_INDY3) {
_string[textSlot].backup.xpos = _string[textSlot].xpos; _string[textSlot]._default.xpos = _string[textSlot].xpos;
_string[textSlot].backup.ypos = _string[textSlot].ypos; _string[textSlot]._default.ypos = _string[textSlot].ypos;
_string[textSlot].backup.color = _string[textSlot].color; _string[textSlot]._default.color = _string[textSlot].color;
} }
return; return;
default: default:
@ -2720,7 +2720,7 @@ void ScummEngine_v5::decodeParseString() {
} }
} }
_string[textSlot].backupString(); _string[textSlot].saveDefault();
} }
void ScummEngine_v5::o5_oldRoomEffect() { void ScummEngine_v5::o5_oldRoomEffect() {

View File

@ -949,7 +949,7 @@ void ScummEngine_v6::o6_cursorCommand() {
case 0x9D: // SO_CHARSET_COLOR case 0x9D: // SO_CHARSET_COLOR
getStackList(args, ARRAYSIZE(args)); getStackList(args, ARRAYSIZE(args));
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
_charsetColorMap[i] = _charsetData[_string[1].backup.charset][i] = (unsigned char)args[i]; _charsetColorMap[i] = _charsetData[_string[1]._default.charset][i] = (unsigned char)args[i];
break; break;
case 0xD6: // SO_CURSOR_TRANSPARENT Set cursor transparent color case 0xD6: // SO_CURSOR_TRANSPARENT Set cursor transparent color
makeCursorColorTransparent(pop()); makeCursorColorTransparent(pop());
@ -1925,7 +1925,7 @@ void ScummEngine_v6::o6_verbOps() {
vs->hicolor = 0; vs->hicolor = 0;
vs->dimcolor = 8; vs->dimcolor = 8;
vs->type = kTextVerbType; vs->type = kTextVerbType;
vs->charset_nr = _string[0].backup.charset; vs->charset_nr = _string[0]._default.charset;
vs->curmode = 0; vs->curmode = 0;
vs->saveid = 0; vs->saveid = 0;
vs->key = 0; vs->key = 0;
@ -2294,7 +2294,7 @@ void ScummEngine_v6::o6_printEgo() {
void ScummEngine_v6::o6_talkActor() { void ScummEngine_v6::o6_talkActor() {
_actorToPrintStrFor = pop(); _actorToPrintStrFor = pop();
_string[0].restoreString(); _string[0].loadDefault();
actorTalk(_scriptPointer); actorTalk(_scriptPointer);
_scriptPointer += resStrLen(_scriptPointer) + 1; _scriptPointer += resStrLen(_scriptPointer) + 1;
@ -3119,12 +3119,12 @@ void ScummEngine_v6::decodeParseString(int m, int n) {
break; break;
case 0xFE: case 0xFE:
_string[m].restoreString(); _string[m].loadDefault();
if (n) if (n)
_actorToPrintStrFor = pop(); _actorToPrintStrFor = pop();
break; break;
case 0xFF: case 0xFF:
_string[m].backupString(); _string[m].saveDefault();
break; break;
default: default:
error("decodeParseString: default case 0x%x", b); error("decodeParseString: default case 0x%x", b);

View File

@ -754,7 +754,7 @@ void ScummEngine_v6he::o6_verbOps() {
vs->hicolor = 0; vs->hicolor = 0;
vs->dimcolor = 8; vs->dimcolor = 8;
vs->type = kTextVerbType; vs->type = kTextVerbType;
vs->charset_nr = _string[0].backup.charset; vs->charset_nr = _string[0]._default.charset;
vs->curmode = 0; vs->curmode = 0;
vs->saveid = 0; vs->saveid = 0;
vs->key = 0; vs->key = 0;
@ -1463,12 +1463,12 @@ void ScummEngine_v6he::decodeParseString(int m, int n) {
warning("decodeParseString case 0xF9 stub"); warning("decodeParseString case 0xF9 stub");
break; break;
case 0xFE: case 0xFE:
_string[m].restoreString(); _string[m].loadDefault();
if (n) if (n)
_actorToPrintStrFor = pop(); _actorToPrintStrFor = pop();
break; break;
case 0xFF: case 0xFF:
_string[m].backupString(); _string[m].saveDefault();
break; break;
default: default:
error("decodeParseString: default case 0x%x", b); error("decodeParseString: default case 0x%x", b);

View File

@ -472,12 +472,12 @@ void ScummEngine_v8::decodeParseString(int m, int n) {
switch (b) { switch (b) {
case 0xC8: // SO_PRINT_BASEOP case 0xC8: // SO_PRINT_BASEOP
_string[m].restoreString(); _string[m].loadDefault();
if (n) if (n)
_actorToPrintStrFor = pop(); _actorToPrintStrFor = pop();
break; break;
case 0xC9: // SO_PRINT_END case 0xC9: // SO_PRINT_END
_string[m].backupString(); _string[m].saveDefault();
break; break;
case 0xCA: // SO_PRINT_AT case 0xCA: // SO_PRINT_AT
_string[m].ypos = pop(); _string[m].ypos = pop();
@ -762,7 +762,7 @@ void ScummEngine_v8::o8_cursorCommand() {
case 0xE8: // SO_CHARSET_COLOR case 0xE8: // SO_CHARSET_COLOR
getStackList(args, ARRAYSIZE(args)); getStackList(args, ARRAYSIZE(args));
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
_charsetColorMap[i] = _charsetData[_string[1].backup.charset][i] = (unsigned char)args[i]; _charsetColorMap[i] = _charsetData[_string[1]._default.charset][i] = (unsigned char)args[i];
break; break;
case 0xE9: // SO_CURSOR_PUT case 0xE9: // SO_CURSOR_PUT
{ {
@ -1144,7 +1144,7 @@ void ScummEngine_v8::o8_verbOps() {
vs->hicolor = 0; vs->hicolor = 0;
vs->dimcolor = 8; vs->dimcolor = 8;
vs->type = kTextVerbType; vs->type = kTextVerbType;
vs->charset_nr = _string[0].backup.charset; vs->charset_nr = _string[0]._default.charset;
vs->curmode = 0; vs->curmode = 0;
vs->saveid = 0; vs->saveid = 0;
vs->key = 0; vs->key = 0;

View File

@ -1132,16 +1132,16 @@ void ScummEngine::scummInit() {
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
if (_version == 3) { // FIXME - what is this? if (_version == 3) { // FIXME - what is this?
_string[i].backup.xpos = 0; _string[i]._default.xpos = 0;
_string[i].backup.ypos = 0; _string[i]._default.ypos = 0;
} else { } else {
_string[i].backup.xpos = 2; _string[i]._default.xpos = 2;
_string[i].backup.ypos = 5; _string[i]._default.ypos = 5;
} }
_string[i].backup.right = _screenWidth - 1; _string[i]._default.right = _screenWidth - 1;
_string[i].backup.color = 0xF; _string[i]._default.color = 0xF;
_string[i].backup.center = 0; _string[i]._default.center = 0;
_string[i].backup.charset = 0; _string[i]._default.charset = 0;
} }
// all keys are released // all keys are released

View File

@ -264,16 +264,19 @@ struct StringSlot {
}; };
struct StringTab : StringSlot { struct StringTab : StringSlot {
StringSlot backup; // The 'default' values for this string slot. This is used so that the
// string slot can temporarily be set to different values, and then be
// easily reset to a previously set default.
StringSlot _default;
void backupString() { void saveDefault() {
StringSlot &s = *this; StringSlot &s = *this;
backup = s; _default = s;
} }
void restoreString() { void loadDefault() {
StringSlot &s = *this; StringSlot &s = *this;
s = backup; s = _default;
} }
}; };

View File

@ -598,8 +598,8 @@ void ScummEngine::initCharset(int charsetno) {
if (!getResourceAddress(rtCharset, charsetno)) if (!getResourceAddress(rtCharset, charsetno))
loadCharset(charsetno); loadCharset(charsetno);
_string[0].backup.charset = charsetno; _string[0]._default.charset = charsetno;
_string[1].backup.charset = charsetno; _string[1]._default.charset = charsetno;
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
_charsetColorMap[i] = _charsetData[charsetno][i]; _charsetColorMap[i] = _charsetData[charsetno][i];