KYRA: replace const char * with Common::String around getTableString. (#2603)

Currently const char * points into some random buffer with unclear
lifetime.

Instead use Common::String which ensures lifetime as long as a reference is
held.

This also removes the need of copying into existing buffers in HoF and MR.

UnkBuf* are gone as well.

Co-authored-by: athrxx <athrxx@scummvm.org>
This commit is contained in:
Vladimir Serbinenko
2021-01-01 16:37:27 +01:00
committed by GitHub
co-authored by athrxx
parent 55cc780c7d
commit 280f83242e
32 changed files with 225 additions and 210 deletions
+1 -1
View File
@@ -117,7 +117,7 @@ bool KyraEngine_MR::dropItem(int unk1, Item item, int x, int y, int unk2) {
showMessageFromCCode(14, 0xB3, 0);
}
if (!_chatText)
if (_chatText.empty())
snd_playSoundEffect(13, 200);
return false;
}
+43 -59
View File
@@ -94,9 +94,7 @@ KyraEngine_HoF::KyraEngine_HoF(OSystem *system, const GameFlags &flags) : KyraEn
_dbgPass = 0;
_gamePlayBuffer = 0;
_unkBuf500Bytes = 0;
_inventorySaved = false;
_unkBuf200kByte = 0;
memset(&_sceneShapeTable, 0, sizeof(_sceneShapeTable));
_talkObjectList = 0;
@@ -287,7 +285,6 @@ void KyraEngine_HoF::startup() {
memset(_sceneShapeTable, 0, sizeof(_sceneShapeTable));
_gamePlayBuffer = new uint8[46080];
_unkBuf500Bytes = new uint8[500];
loadMouseShapes();
loadItemShapes();
@@ -295,7 +292,6 @@ void KyraEngine_HoF::startup() {
_screen->setMouseCursor(0, 0, getShapePtr(0));
_screenBuffer = new uint8[64000];
_unkBuf200kByte = new uint8[200000];
loadChapterBuffer(_newChapterFile);
@@ -313,7 +309,7 @@ void KyraEngine_HoF::startup() {
_optionsBuffer = _cCodeBuffer;
}
showMessage(0, 207);
clearMessage();
_screen->setShapePages(5, 3);
@@ -621,7 +617,7 @@ void KyraEngine_HoF::updateWithText() {
restorePage3();
drawAnimObjects();
if (_chatTextEnabled && _chatText) {
if (_chatTextEnabled && !_chatText.empty()) {
int pageBackUp = _screen->_curPage;
_screen->_curPage = 2;
objectChatPrintText(_chatText, _chatObject);
@@ -741,8 +737,6 @@ void KyraEngine_HoF::cleanup() {
delete[] _inventoryButtons; _inventoryButtons = 0;
delete[] _gamePlayBuffer; _gamePlayBuffer = 0;
delete[] _unkBuf500Bytes; _unkBuf500Bytes = 0;
delete[] _unkBuf200kByte; _unkBuf200kByte = 0;
freeSceneShapePtrs();
@@ -821,19 +815,17 @@ uint8 *KyraEngine_HoF::getTableEntry(uint8 *buffer, int id) {
return buffer + READ_LE_UINT16(buffer + (id<<1));
}
char *KyraEngine_HoF::getTableString(int id, uint8 *buffer, bool decode) {
char *string = (char *)getTableEntry(buffer, id);
Common::String KyraEngine_HoF::getTableString(int id, uint8 *buffer, bool decode) {
Common::String string((char *)getTableEntry(buffer, id));
if (decode && _flags.lang != Common::JA_JPN) {
Util::decodeString1(string, _internStringBuf);
Util::decodeString2(_internStringBuf, _internStringBuf);
string = _internStringBuf;
string = Util::decodeString2(Util::decodeString1(string));
}
return string;
}
const char *KyraEngine_HoF::getChapterString(int id) {
Common::String KyraEngine_HoF::getChapterString(int id) {
if (_currentChapter != _newChapterFile)
loadChapterBuffer(_newChapterFile);
@@ -843,15 +835,14 @@ const char *KyraEngine_HoF::getChapterString(int id) {
#pragma mark -
void KyraEngine_HoF::showMessageFromCCode(int id, int16 palIndex, int) {
const char *string = getTableString(id, _cCodeBuffer, true);
showMessage(string, palIndex);
showMessage(getTableString(id, _cCodeBuffer, true), palIndex);
}
void KyraEngine_HoF::showMessage(const char *string, int16 palIndex) {
void KyraEngine_HoF::showMessage(const Common::String &string, int16 palIndex) {
_shownMessage = string;
_screen->fillRect(0, 190, 319, 199, 0xCF);
if (string) {
if (!string.empty()) {
if (palIndex != -1 || _fadeMessagePalette) {
palIndex *= 3;
memcpy(_messagePal, _screen->getPalette(0).getData() + palIndex, 3);
@@ -868,32 +859,34 @@ void KyraEngine_HoF::showMessage(const char *string, int16 palIndex) {
_fadeMessagePalette = false;
}
void KyraEngine_HoF::clearMessage() {
_shownMessage = "";
_screen->fillRect(0, 190, 319, 199, 0xCF);
_fadeMessagePalette = false;
}
void KyraEngine_HoF::showChapterMessage(int id, int16 palIndex) {
showMessage(getChapterString(id), palIndex);
}
void KyraEngine_HoF::updateCommandLineEx(int str1, int str2, int16 palIndex) {
char buffer[0x51];
char *src = buffer;
strcpy(src, getTableString(str1, _cCodeBuffer, true));
if (_flags.lang != Common::JA_JPN) {
while (*src != 0x20)
++src;
++src;
*src = toupper(*src);
}
strcpy((char *)_unkBuf500Bytes, src);
if (str2 > 0) {
if (_flags.lang != Common::JA_JPN)
strcat((char *)_unkBuf500Bytes, " ");
strcat((char *)_unkBuf500Bytes, getTableString(str2, _cCodeBuffer, true));
}
showMessage((char *)_unkBuf500Bytes, palIndex);
Common::String str = getTableString(str1, _cCodeBuffer, true);
if (_flags.lang != Common::JA_JPN) {
uint i = 0;
while (str[i] != ' ')
++i;
++i;
str.setChar(toupper(str[i]), i);
}
if (str2 > 0) {
if (_flags.lang != Common::JA_JPN)
str += " ";
str += getTableString(str2, _cCodeBuffer, 1);
}
showMessage(str, palIndex);
}
void KyraEngine_HoF::fadeMessagePalette() {
@@ -1771,7 +1764,7 @@ bool KyraEngine_HoF::updateCauldron() {
}
if (cauldronState >= 0) {
showMessage(0, 0xCF);
clearMessage();
setCauldronState(cauldronState, true);
if (cauldronState == 7)
objectChat(getTableString(0xF2, _cCodeBuffer, true), 0, 0x83, 0xF2);
@@ -1784,7 +1777,7 @@ bool KyraEngine_HoF::updateCauldron() {
}
void KyraEngine_HoF::cauldronRndPaletteFade() {
showMessage(0, 0xCF);
clearMessage();
int index = _rnd.getRandomNumberRng(0x0F, 0x16);
Common::SeekableReadStream *file = _res->createReadStream("_POTIONS.PAL");
if (!file)
@@ -1831,30 +1824,21 @@ void KyraEngine_HoF::listItemsInCauldron() {
} else {
objectChat(getTableString(0xF7, _cCodeBuffer, true), 0, 0x83, 0xF7);
char buffer[80];
for (int i = 0; i < itemsInCauldron-1; ++i) {
char *str = buffer;
strcpy(str, getTableString(_cauldronTable[i]+54, _cCodeBuffer, true));
Common::String str = getTableString(_cauldronTable[i]+54, _cCodeBuffer, true);
if (_lang == 1) {
if (*str == 37)
str += 2;
if (str[0] == 37)
str = str.substr(2);
}
strcpy((char *)_unkBuf500Bytes, "...");
strcat((char *)_unkBuf500Bytes, str);
strcat((char *)_unkBuf500Bytes, "...");
objectChat((const char *)_unkBuf500Bytes, 0, 0x83, _cauldronTable[i]+54);
objectChat("..." + str + "...", 0, 0x83, _cauldronTable[i]+54);
}
char *str = buffer;
strcpy(str, getTableString(_cauldronTable[itemsInCauldron-1]+54, _cCodeBuffer, true));
Common::String str = getTableString(_cauldronTable[itemsInCauldron-1]+54, _cCodeBuffer, true);
if (_lang == 1) {
if (*str == 37)
str += 2;
if (str[0] == 37)
str = str.substr(2);
}
strcpy((char *)_unkBuf500Bytes, "...");
strcat((char *)_unkBuf500Bytes, str);
strcat((char *)_unkBuf500Bytes, ".");
objectChat((const char *)_unkBuf500Bytes, 0, 0x83, _cauldronTable[itemsInCauldron-1]+54);
objectChat("..." + str + ".", 0, 0x83, _cauldronTable[itemsInCauldron-1]+54);
}
}
@@ -1905,7 +1889,7 @@ void KyraEngine_HoF::playTim(const char *filename) {
_tim->resetFinishedFlag();
while (!shouldQuit() && !_tim->finished()) {
_tim->exec(tim, 0);
if (_chatText)
if (!_chatText.empty())
updateWithText();
else
update();
+10 -12
View File
@@ -333,8 +333,8 @@ protected:
int _newChapterFile;
uint8 *getTableEntry(uint8 *buffer, int id);
char *getTableString(int id, uint8 *buffer, bool decode);
const char *getChapterString(int id);
Common::String getTableString(int id, uint8 *buffer, bool decode);
Common::String getChapterString(int id);
void changeFileExtension(char *buffer);
@@ -367,12 +367,13 @@ protected:
// text
void showMessageFromCCode(int id, int16 palIndex, int);
void showMessage(const char *string, int16 palIndex);
void showMessage(const Common::String &string, int16 palIndex);
void clearMessage();
void showChapterMessage(int id, int16 palIndex);
void updateCommandLineEx(int str1, int str2, int16 palIndex);
const char *_shownMessage;
Common::String _shownMessage;
byte _messagePal[3];
bool _fadeMessagePalette;
@@ -382,11 +383,11 @@ protected:
bool _chatIsNote;
int chatGetType(const char *text);
int chatCalcDuration(const char *text);
int chatCalcDuration(const Common::String &text);
void objectChat(const char *text, int object, int vocHigh = -1, int vocLow = -1);
void objectChatInit(const char *text, int object, int vocHigh = -1, int vocLow = -1);
void objectChatPrintText(const char *text, int object);
void objectChat(const Common::String &text, int object, int vocHigh = -1, int vocLow = -1);
void objectChatInit(const Common::String &text, int object, int vocHigh = -1, int vocLow = -1);
void objectChatPrintText(const Common::String &text, int object);
void objectChatProcess(const char *script);
void objectChatWaitToFinish();
@@ -397,7 +398,7 @@ protected:
void updateDlgBuffer();
void loadDlgHeader(int &csEntry, int &vocH, int &scIndex1, int &scIndex2);
void processDialogue(int dlgOffset, int vocH = 0, int csEntry = 0);
void npcChatSequence(const char *str, int objectId, int vocHigh = -1, int vocLow = -1);
void npcChatSequence(const Common::String &str, int objectId, int vocHigh = -1, int vocLow = -1);
void setDlgIndex(int dlgIndex) override;
int _npcTalkChpIndex;
@@ -615,9 +616,6 @@ protected:
EMCData _npcScriptData;
// pathfinder
uint8 *_unkBuf500Bytes;
uint8 *_unkBuf200kByte;
bool _chatAltFlag;
// sequence player
+1 -1
View File
@@ -1065,7 +1065,7 @@ void KyraEngine_MR::updateWithText() {
restorePage3();
drawAnimObjects();
if (_chatTextEnabled && _chatText) {
if (_chatTextEnabled && !_chatText.empty()) {
int curPage = _screen->_curPage;
_screen->_curPage = 2;
objectChatPrintText(_chatText, _chatObject);
+1 -1
View File
@@ -419,7 +419,7 @@ private:
void objectChat(const char *text, int object, int vocHigh, int vocLow);
void objectChatInit(const char *text, int object, int vocHigh, int vocLow);
void objectChatPrintText(const char *text, int object);
void objectChatPrintText(const Common::String &text, int object);
void objectChatProcess(const char *script);
void objectChatWaitToFinish();
+2 -2
View File
@@ -61,7 +61,7 @@ KyraEngine_v2::KyraEngine_v2(OSystem *system, const GameFlags &flags, const Engi
_vocHigh = -1;
_chatVocHigh = -1;
_chatVocLow = -1;
_chatText = 0;
_chatText = "";
_chatObject = -1;
_chatTextEnabled = false;
@@ -150,7 +150,7 @@ void KyraEngine_v2::delay(uint32 amount, bool updateGame, bool isMainLoop) {
uint32 start = _system->getMillis();
do {
if (updateGame) {
if (_chatText)
if (!_chatText.empty())
updateWithText();
else
update();
+1 -1
View File
@@ -343,7 +343,7 @@ protected:
// chat
int _vocHigh;
const char *_chatText;
Common::String _chatText;
int _chatObject;
uint32 _chatEndTime;
int _chatVocHigh, _chatVocLow;
+1 -1
View File
@@ -37,7 +37,7 @@ void KyraEngine_HoF::setupTimers() {
}
void KyraEngine_HoF::timerFadeOutMessage(int arg) {
if (_shownMessage)
if (!_shownMessage.empty())
_fadeMessagePalette = 1;
}
+22
View File
@@ -113,6 +113,28 @@ void Util::convertISOToDOS(char &c) {
c = code;
}
Common::String Util::convertISOToDOS(const Common::String &str) {
char *tmp = new char[str.size() + 1];
memcpy(tmp, str.c_str(), str.size() + 1);
convertISOToDOS(tmp);
Common::String res = tmp;
delete[] tmp;
return res;
}
Common::String Util::decodeString1(const Common::String &src) {
char *tmp = new char[src.size() * 2 + 2];
Util::decodeString1(src.c_str(), tmp);
return tmp;
}
Common::String Util::decodeString2(const Common::String &src) {
char *tmp = new char[src.size() * 2 + 2];
Util::decodeString2(src.c_str(), tmp);
return tmp;
}
// CP850 to ISO-8859-1 (borrowed from engines/saga/font_map.cpp)
const uint8 Util::_charMapDOSToISO[128] = {
199, 252, 233, 226, 228, 224, 229, 231, 234, 235, 232,
+5
View File
@@ -24,6 +24,7 @@
#define KYRA_UTIL_H
#include "common/scummsys.h"
#include "common/str.h"
namespace Kyra {
@@ -31,12 +32,16 @@ class Util {
public:
static int decodeString1(const char *src, char *dst);
static void decodeString2(const char *src, char *dst);
static Common::String decodeString1(const Common::String &src);
static Common::String decodeString2(const Common::String &src);
// Since our current GUI font uses ISO-8859-1, this
// conversion functionallty uses that as a base.
static void convertDOSToISO(char *str);
static void convertISOToDOS(char *str);
static void convertISOToDOS(char &c);
static Common::String convertISOToDOS(const Common::String &str);
private:
static const uint8 _charMapDOSToISO[128];
+10 -7
View File
@@ -79,16 +79,19 @@ void KyraEngine_HoF::setupLangButtonShapes() {
GUI_HoF::GUI_HoF(KyraEngine_HoF *vm) : GUI_v2(vm), _vm(vm), _screen(_vm->_screen) {
}
const char *GUI_HoF::getMenuTitle(const Menu &menu) {
Common::String GUI_HoF::getMenuTitle(const Menu &menu) {
if (!menu.menuNameId)
return 0;
return Common::String();
return _vm->getTableString(menu.menuNameId, _vm->_optionsBuffer, true);
}
const char *GUI_HoF::getMenuItemTitle(const MenuItem &menuItem) {
Common::String GUI_HoF::getMenuItemTitle(const MenuItem &menuItem) {
if (menuItem.useItemString)
return menuItem.itemString;
if (!menuItem.itemId)
return 0;
return Common::String();
// Strings 41-45 are menu labels, those must be handled uncompressed!
if (menuItem.itemId >= 41 && menuItem.itemId <= 45)
@@ -97,14 +100,14 @@ const char *GUI_HoF::getMenuItemTitle(const MenuItem &menuItem) {
return _vm->getTableString(menuItem.itemId, _vm->_optionsBuffer, true);
}
const char *GUI_HoF::getMenuItemLabel(const MenuItem &menuItem) {
Common::String GUI_HoF::getMenuItemLabel(const MenuItem &menuItem) {
if (!menuItem.labelId)
return 0;
return Common::String();
return _vm->getTableString(menuItem.labelId, _vm->_optionsBuffer, 1);
}
char *GUI_HoF::getTableString(int id, bool decode) {
Common::String GUI_HoF::getTableString(int id, bool decode) {
return _vm->getTableString(id, _vm->_optionsBuffer, decode);
}
+4 -4
View File
@@ -41,9 +41,9 @@ public:
void createScreenThumbnail(Graphics::Surface &dst) override;
private:
const char *getMenuTitle(const Menu &menu) override;
const char *getMenuItemTitle(const MenuItem &menuItem) override;
const char *getMenuItemLabel(const MenuItem &menuItem) override;
Common::String getMenuTitle(const Menu &menu) override;
Common::String getMenuItemTitle(const MenuItem &menuItem) override;
Common::String getMenuItemLabel(const MenuItem &menuItem) override;
uint8 defaultColor1() const override { return 0xCF; }
uint8 defaultColor2() const override { return 0xF8; }
@@ -57,7 +57,7 @@ private:
void resetState(int item);
char *getTableString(int id, bool decode) override;
Common::String getTableString(int id, bool decode) override;
KyraEngine_HoF *_vm;
Screen_HoF *_screen;
+1 -1
View File
@@ -745,7 +745,7 @@ int GUI_LoK::saveGame(Button *button) {
} else {
for (int i = 0; i < 5; i++) {
if (_menu[2].item[i].saveSlot == _vm->_gameToLoad) {
Common::strlcpy(_savegameName, _menu[2].item[i].itemString, 31);
Common::strlcpy(_savegameName, _menu[2].item[i].itemString.c_str(), 31);
break;
}
}
+4 -4
View File
@@ -72,7 +72,7 @@ namespace Kyra {
#define GUI_V1_MENU_ITEM(item, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) \
do { \
item.enabled = a; \
item.itemString = d; \
item.itemString = ""; \
item.x = e; \
item.y = g; \
item.width = h; \
@@ -153,9 +153,9 @@ private:
uint8 defaultColor1() const override { return 12; }
uint8 defaultColor2() const override { return 248; }
const char *getMenuTitle(const Menu &menu) override { return menu.menuNameString; }
const char *getMenuItemTitle(const MenuItem &menuItem) override { return menuItem.itemString; }
const char *getMenuItemLabel(const MenuItem &menuItem) override { return menuItem.labelString; }
Common::String getMenuTitle(const Menu &menu) override { return menu.menuNameString; }
Common::String getMenuItemTitle(const MenuItem &menuItem) override { return menuItem.itemString; }
Common::String getMenuItemLabel(const MenuItem &menuItem) override { return menuItem.labelString; }
KyraEngine_LoK *_vm;
Screen_LoK *_screen;
+12 -10
View File
@@ -2542,15 +2542,15 @@ void GUI_LoL::sortSaveSlots() {
Common::sort(_saveSlots.begin(), _saveSlots.end(), Common::Greater<int>());
}
void GUI_LoL::printMenuText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 flags) {
_screen->fprintString("%s", x, y, c0, c1, _vm->gameFlags().use16ColorMode ? (flags & 3) : flags , str);
void GUI_LoL::printMenuText(const Common::String &str, int x, int y, uint8 c0, uint8 c1, uint8 flags) {
_screen->fprintString("%s", x, y, c0, c1, _vm->gameFlags().use16ColorMode ? (flags & 3) : flags , str.c_str());
}
int GUI_LoL::getMenuCenterStringX(const char *str, int x1, int x2) {
if (!str)
int GUI_LoL::getMenuCenterStringX(const Common::String &str, int x1, int x2) {
if (str.empty())
return 0;
int strWidth = _screen->getTextWidth(str);
int strWidth = _screen->getTextWidth(str.c_str());
int w = x2 - x1 + 1;
return x1 + (w - strWidth) / 2;
}
@@ -2672,7 +2672,7 @@ int GUI_LoL::clickedSaveMenu(Button *button) {
_saveDescription = (char *)_vm->_tempBuffer5120 + 1000;
_saveDescription[0] = 0;
if (_saveMenu.item[-s - 2].saveSlot != -3) {
strcpy(_saveDescription, _saveMenu.item[-s - 2].itemString);
strcpy(_saveDescription, _saveMenu.item[-s - 2].itemString.c_str());
} else if (_vm->_autoSaveNamesEnabled) {
TimeDate td;
g_system->getTimeAndDate(td);
@@ -2904,21 +2904,23 @@ int GUI_LoL::scrollDown(Button *button) {
return 1;
}
const char *GUI_LoL::getMenuTitle(const Menu &menu) {
Common::String GUI_LoL::getMenuTitle(const Menu &menu) {
if (!menu.menuNameId)
return 0;
return _vm->getLangString(menu.menuNameId);
}
const char *GUI_LoL::getMenuItemTitle(const MenuItem &menuItem) {
if (menuItem.itemId & 0x8000 && menuItem.itemString)
Common::String GUI_LoL::getMenuItemTitle(const MenuItem &menuItem) {
if (menuItem.useItemString)
return menuItem.itemString;
if (menuItem.itemId & 0x8000 && !menuItem.itemString.empty())
return menuItem.itemString;
else if (menuItem.itemId & 0x8000 || !menuItem.itemId)
return 0;
return _vm->getLangString(menuItem.itemId);
}
const char *GUI_LoL::getMenuItemLabel(const MenuItem &menuItem) {
Common::String GUI_LoL::getMenuItemLabel(const MenuItem &menuItem) {
if (menuItem.labelId & 0x8000 && menuItem.labelString)
return menuItem.labelString;
else if (menuItem.labelId & 0x8000 || !menuItem.labelId)
+6 -6
View File
@@ -60,7 +60,7 @@ namespace Kyra {
do { \
item.enabled = 1; \
item.itemId = a; \
item.itemString = 0; \
item.itemString = ""; \
item.x = b; \
item.y = c; \
item.width = d; \
@@ -113,8 +113,8 @@ private:
void setupSaveMenuSlots(Menu &menu, int num);
void printMenuText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 flags) override;
int getMenuCenterStringX(const char *str, int x1, int x2) override;
void printMenuText(const Common::String &str, int x, int y, uint8 c0, uint8 c1, uint8 flags) override;
int getMenuCenterStringX(const Common::String &str, int x1, int x2) override;
int getInput();
@@ -142,9 +142,9 @@ private:
uint8 defaultColor1() const override { return 0xFE; }
uint8 defaultColor2() const override { return 0x00; }
const char *getMenuTitle(const Menu &menu) override;
const char *getMenuItemTitle(const MenuItem &menuItem) override;
const char *getMenuItemLabel(const MenuItem &menuItem) override;
Common::String getMenuTitle(const Menu &menu) override;
Common::String getMenuItemTitle(const MenuItem &menuItem) override;
Common::String getMenuItemLabel(const MenuItem &menuItem) override;
Button _menuButtons[10];
Button _scrollUpButton;
+12 -9
View File
@@ -489,7 +489,7 @@ int KyraEngine_MR::buttonInventory(Button *button) {
_itemInHand = slotItem;
_mainCharacter.inventory[slot] = kItemNone;
} else if (_itemInHand == 27) {
if (_chatText)
if (!_chatText.empty())
return 0;
return buttonJesterStaff(&_mainButtonData[3]);
} else {
@@ -1062,29 +1062,32 @@ void GUI_MR::flagButtonDisable(Button *button) {
}
}
const char *GUI_MR::getMenuTitle(const Menu &menu) {
Common::String GUI_MR::getMenuTitle(const Menu &menu) {
if (!menu.menuNameId)
return 0;
return Common::String();
return (const char *)_vm->getTableEntry(_vm->_optionsFile, menu.menuNameId);
}
const char *GUI_MR::getMenuItemTitle(const MenuItem &menuItem) {
Common::String GUI_MR::getMenuItemTitle(const MenuItem &menuItem) {
if (menuItem.useItemString)
return menuItem.itemString;
if (!menuItem.itemId)
return 0;
return Common::String();
return (const char *)_vm->getTableEntry(_vm->_optionsFile, menuItem.itemId);
}
const char *GUI_MR::getMenuItemLabel(const MenuItem &menuItem) {
Common::String GUI_MR::getMenuItemLabel(const MenuItem &menuItem) {
if (!menuItem.labelId)
return 0;
return Common::String();
return (const char *)_vm->getTableEntry(_vm->_optionsFile, menuItem.labelId);
}
char *GUI_MR::getTableString(int id, bool) {
return (char *)_vm->getTableEntry(_vm->_optionsFile, id);
Common::String GUI_MR::getTableString(int id, bool) {
return Common::String((char *)_vm->getTableEntry(_vm->_optionsFile, id));
}
int GUI_MR::redrawButtonCallback(Button *button) {
+4 -4
View File
@@ -47,10 +47,10 @@ public:
void createScreenThumbnail(Graphics::Surface &dst) override;
private:
const char *getMenuTitle(const Menu &menu) override;
const char *getMenuItemTitle(const MenuItem &menuItem) override;
const char *getMenuItemLabel(const MenuItem &menuItem) override;
char *getTableString(int id, bool) override;
Common::String getMenuTitle(const Menu &menu) override;
Common::String getMenuItemTitle(const MenuItem &menuItem) override;
Common::String getMenuItemLabel(const MenuItem &menuItem) override;
Common::String getTableString(int id, bool) override;
uint8 textFieldColor1() const override { return 0xFF; }
uint8 textFieldColor2() const override { return 0xCF; }
+6 -6
View File
@@ -123,7 +123,7 @@ void GUI_v1::initMenu(Menu &menu) {
_screen->fillRect(x1, y1, x2, y2, menu.item[i].bkgdColor);
_screen->drawShadedBox(x1, y1, x2, y2, menu.item[i].color1, menu.item[i].color2);
if (getMenuItemTitle(menu.item[i])) {
if (!getMenuItemTitle(menu.item[i]).empty()) {
if (menu.item[i].titleX != -1)
textX = x1 + menu.item[i].titleX + 3;
else
@@ -155,7 +155,7 @@ void GUI_v1::initMenu(Menu &menu) {
}
for (int i = 0; i < menu.numberOfItems; ++i) {
if (getMenuItemLabel(menu.item[i])) {
if (!getMenuItemLabel(menu.item[i]).empty()) {
if (_vm->game() == GI_LOL) {
menu.item[i].labelX = menu.item[i].x - 1;
menu.item[i].labelY = menu.item[i].y + 3;
@@ -404,12 +404,12 @@ void GUI_v1::checkTextfieldInput() {
_vm->_system->delayMillis(3);
}
void GUI_v1::printMenuText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2) {
_text->printText(str, x, y, c0, c1, c2);
void GUI_v1::printMenuText(const Common::String &str, int x, int y, uint8 c0, uint8 c1, uint8 c2) {
_text->printText(str.c_str(), x, y, c0, c1, c2);
}
int GUI_v1::getMenuCenterStringX(const char *str, int x1, int x2) {
return _text->getCenterStringX(str, x1, x2);
int GUI_v1::getMenuCenterStringX(const Common::String &str, int x1, int x2) {
return _text->getCenterStringX(str.c_str(), x1, x2);
}
#pragma mark -
+7 -6
View File
@@ -30,8 +30,9 @@ namespace Kyra {
struct MenuItem {
bool enabled;
const char *itemString;
Common::String itemString;
uint16 itemId;
bool useItemString;
int16 x, y;
uint16 width, height;
@@ -110,8 +111,8 @@ protected:
bool _displaySubMenu;
bool _cancelSubMenu;
virtual void printMenuText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2);
virtual int getMenuCenterStringX(const char *str, int x1, int x2);
virtual void printMenuText(const Common::String &str, int x, int y, uint8 c0, uint8 c1, uint8 c2);
virtual int getMenuCenterStringX(const Common::String &str, int x1, int x2);
Button::Callback _redrawShadedButtonFunctor;
Button::Callback _redrawButtonFunctor;
@@ -126,9 +127,9 @@ protected:
virtual uint8 defaultColor1() const = 0;
virtual uint8 defaultColor2() const = 0;
virtual const char *getMenuTitle(const Menu &menu) = 0;
virtual const char *getMenuItemTitle(const MenuItem &menuItem) = 0;
virtual const char *getMenuItemLabel(const MenuItem &menuItem) = 0;
virtual Common::String getMenuTitle(const Menu &menu) = 0;
virtual Common::String getMenuItemTitle(const MenuItem &menuItem) = 0;
virtual Common::String getMenuItemLabel(const MenuItem &menuItem) = 0;
void updateAllMenuButtons();
void updateMenuButton(Button *button);
+15 -15
View File
@@ -430,7 +430,8 @@ void GUI_v2::restorePage1(const uint8 *buffer) {
void GUI_v2::setupSavegameNames(Menu &menu, int num) {
for (int i = 0; i < num; ++i) {
strcpy(getTableString(menu.item[i].itemId), "");
menu.item[i].useItemString = true;
menu.item[i].itemString = "";
menu.item[i].saveSlot = -1;
menu.item[i].enabled = false;
}
@@ -443,36 +444,35 @@ void GUI_v2::setupSavegameNames(Menu &menu, int num) {
Common::InSaveFile *in;
for (int i = startSlot; i < num && uint(_savegameOffset + i) < _saveSlots.size(); ++i) {
if ((in = _vm->openSaveForReading(_vm->getSavegameFilename(_saveSlots[i + _savegameOffset]), header)) != 0) {
char *s = getTableString(menu.item[i].itemId);
Common::strlcpy(s, header.description.c_str(), 80);
Util::convertISOToDOS(s);
Common::String s = header.description;
s = Util::convertISOToDOS(s);
// Trim long GMM save descriptions to fit our save slots
_screen->_charSpacing = -2;
int fC = _screen->getTextWidth(s);
while (s[0] && fC > 240) {
s[strlen(s) - 1] = 0;
fC = _screen->getTextWidth(s);
int fC = _screen->getTextWidth(s.c_str());
while (!s.empty() && fC > 240) {
s.deleteLastChar();
fC = _screen->getTextWidth(s.c_str());
}
_screen->_charSpacing = 0;
menu.item[i].saveSlot = _saveSlots[i + _savegameOffset];
menu.item[i].enabled = true;
menu.item[i].useItemString = true;
menu.item[i].itemString = s;
delete in;
}
}
if (_savegameOffset == 0) {
if (_isSaveMenu) {
char *dst = getTableString(menu.item[0].itemId);
const char *src = getTableString(_vm->gameFlags().isTalkie ? 10 : 18);
strcpy(dst, src);
menu.item[0].saveSlot = -2;
menu.item[0].enabled = true;
menu.item[0].useItemString = true;
menu.item[0].itemString = getTableString(_vm->gameFlags().isTalkie ? 10 : 18);
} else {
char *dst = getTableString(menu.item[0].itemId);
const char *src = getTableString(_vm->gameFlags().isTalkie ? 34 : 42, _vm->gameFlags().lang == Common::RU_RUS);
strcpy(dst, src);
menu.item[0].useItemString = true;
menu.item[0].itemString = getTableString(_vm->gameFlags().isTalkie ? 34 : 42, _vm->gameFlags().lang == Common::RU_RUS);
}
}
}
@@ -644,7 +644,7 @@ int GUI_v2::clickSaveSlot(Button *caller) {
return 0;
} else {
_saveSlot = item.saveSlot;
strcpy(_saveDescription, getTableString(item.itemId));
strcpy(_saveDescription, getTableString(item.itemId).c_str());
}
} else if (item.saveSlot == -2) {
_saveSlot = getNextSavegameSlot();
+2 -1
View File
@@ -79,6 +79,7 @@ namespace Kyra {
do { \
item.enabled = a; \
item.itemId = b; \
item.useItemString = false; \
item.x = c; \
item.y = d; \
item.width = e; \
@@ -125,7 +126,7 @@ protected:
virtual void setupPalette() {}
virtual void restorePalette() {}
virtual char *getTableString(int id, bool decode = false) = 0;
virtual Common::String getTableString(int id, bool decode = false) = 0;
virtual uint8 textFieldColor1() const = 0;
virtual uint8 textFieldColor2() const = 0;
+4 -5
View File
@@ -1155,8 +1155,7 @@ int KyraEngine_HoF::o2_mushroomEffect(EMCState *script) {
int KyraEngine_HoF::o2_customChat(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_customChat(%p) ('%s', %d, %d)", (const void *)script, stackPosString(0), stackPos(1), stackPos(2));
strcpy((char *)_unkBuf500Bytes, stackPosString(0));
_chatText = (char *)_unkBuf500Bytes;
_chatText = stackPosString(0);
_chatObject = stackPos(1);
_chatVocHigh = _chatVocLow = -1;
@@ -1168,7 +1167,7 @@ int KyraEngine_HoF::o2_customChat(EMCState *script) {
int KyraEngine_HoF::o2_customChatFinish(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_customChatFinish(%p) ()", (const void *)script);
_text->restoreScreen();
_chatText = 0;
_chatText = "";
_chatObject = -1;
return 0;
}
@@ -1452,7 +1451,7 @@ int KyraEngine_HoF::t2_initChat(const TIM *tim, const uint16 *param) {
if (_flags.lang == Common::JA_JPN) {
for (int i = 0; i < _ingameTimJpStrSize; i += 2) {
if (!scumm_stricmp(_chatText, _ingameTimJpStr[i]))
if (!scumm_stricmp(_chatText.c_str(), _ingameTimJpStr[i]))
_chatText = _ingameTimJpStr[i + 1];
}
}
@@ -1470,7 +1469,7 @@ int KyraEngine_HoF::t2_updateSceneAnim(const TIM *tim, const uint16 *param) {
int KyraEngine_HoF::t2_resetChat(const TIM *tim, const uint16 *param) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::t2_resetChat(%p, %p) ()", (const void *)tim, (const void *)param);
_text->restoreScreen();
_chatText = 0;
_chatText = "";
_chatObject = -1;
return 0;
}
+1 -1
View File
@@ -1055,7 +1055,7 @@ int KyraEngine_MR::o3_customChat(EMCState *script) {
int KyraEngine_MR::o3_customChatFinish(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_customChatFinish(%p) ()", (const void *)script);
_text->restoreScreen();
_chatText = 0;
_chatText = "";
_chatObject = -1;
return 0;
}
+2 -2
View File
@@ -125,7 +125,7 @@ int KyraEngine_v2::o2_delay(EMCState *script) {
if (inputFlag == 198 || inputFlag == 199)
return 1;
if (_chatText)
if (!_chatText.empty())
updateWithText();
else
update();
@@ -140,7 +140,7 @@ int KyraEngine_v2::o2_delay(EMCState *script) {
int KyraEngine_v2::o2_update(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_update(%p) (%d)", (const void *)script, stackPos(0));
for (int times = stackPos(0); times != 0; --times) {
if (_chatText)
if (!_chatText.empty())
updateWithText();
else
update();
+1 -1
View File
@@ -178,7 +178,7 @@ void KyraEngine_MR::hideGoodConscience() {
}
void KyraEngine_MR::eelScript() {
if (_chatText)
if (!_chatText.empty())
return;
_screen->hideMouse();
+2 -2
View File
@@ -92,7 +92,7 @@ void KyraEngine_v2::processAnimationScript(int allowSkip, int resetChar) {
_mainCharacter.animFrame = _animNewFrame + _desc.animScriptFrameAdd;
updateCharacterAnim(0);
if (_chatText)
if (!_chatText.empty())
updateWithText();
else
update();
@@ -114,7 +114,7 @@ void KyraEngine_v2::processAnimationScript(int allowSkip, int resetChar) {
if (_animResetFrame >= 0) {
_mainCharacter.animFrame = _animResetFrame + _desc.animScriptFrameAdd;
updateCharacterAnim(0);
if (_chatText)
if (!_chatText.empty())
updateWithText();
else
update();
+9 -11
View File
@@ -43,9 +43,9 @@ void TextDisplayer::setTalkCoords(uint16 y) {
_talkCoords.y = y;
}
int TextDisplayer::getCenterStringX(const char *str, int x1, int x2) {
int TextDisplayer::getCenterStringX(const Common::String &str, int x1, int x2) {
_screen->_charSpacing = -2;
int strWidth = _screen->getTextWidth(str);
int strWidth = _screen->getTextWidth(str.c_str());
_screen->_charSpacing = 0;
int w = x2 - x1 + 1;
return x1 + (w - strWidth) / 2;
@@ -203,21 +203,19 @@ void TextDisplayer::printTalkTextMessage(const char *text, int x, int y, uint8 c
_talkMessagePrinted = true;
}
void TextDisplayer::printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2) {
char revBuffer[384];
memset(revBuffer, 0, sizeof(revBuffer));
void TextDisplayer::printText(const Common::String &str, int x, int y, uint8 c0, uint8 c1, uint8 c2) {
Common::String revBuffer;
const char *tmp = str.c_str();
if (_vm->gameFlags().lang == Common::HE_ISR) {
int len = strlen(str);
for (int i = 0; i < len; i++) {
revBuffer[i] = str[len - i - 1];
}
str = revBuffer;
for (int i = str.size() - 1; i >= 0; --i)
revBuffer += str[i];
tmp = revBuffer.c_str();
}
uint8 colorMap[] = { 0, 15, 12, 12 };
colorMap[3] = c1;
_screen->setTextColor(colorMap, 0, 3);
_screen->_charSpacing = -2;
_screen->printText(str, x, y, c0, c2);
_screen->printText(tmp, x, y, c0, c2);
_screen->_charSpacing = 0;
}
+2 -2
View File
@@ -38,7 +38,7 @@ public:
int maxSubstringLen() const { return TALK_SUBSTRING_LEN; }
void setTalkCoords(uint16 y);
int getCenterStringX(const char *str, int x1, int x2);
int getCenterStringX(const Common::String &str, int x1, int x2);
int getCharLength(const char *str, int len);
int dropCRIntoString(char *str, int offs);
virtual char *preprocessString(const char *str);
@@ -47,7 +47,7 @@ public:
virtual void calcWidestLineBounds(int &x1, int &x2, int w, int cx);
virtual void restoreTalkTextMessageBkgd(int srcPage, int dstPage);
void printTalkTextMessage(const char *text, int x, int y, uint8 color, int srcPage, int dstPage);
virtual void printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2);
virtual void printText(const Common::String &str, int x, int y, uint8 c0, uint8 c1, uint8 c2);
void printCharacterText(const char *text, int8 charNum, int charX);
uint16 _talkMessageY;
+22 -23
View File
@@ -150,15 +150,15 @@ int KyraEngine_HoF::chatGetType(const char *str) {
}
}
int KyraEngine_HoF::chatCalcDuration(const char *str) {
int KyraEngine_HoF::chatCalcDuration(const Common::String &str) {
static const uint8 durationMultiplicator[] = { 16, 14, 12, 10, 8, 8, 7, 6, 5, 4 };
int duration = strlen(str);
int duration = str.size();
duration *= _flags.isTalkie ? 8 : durationMultiplicator[(_configTextspeed / 10)];
return MAX<int>(duration, 120);
}
void KyraEngine_HoF::objectChat(const char *str, int object, int vocHigh, int vocLow) {
void KyraEngine_HoF::objectChat(const Common::String &str, int object, int vocHigh, int vocLow) {
setNextIdleAnimTimer();
_chatVocHigh = _chatVocLow = -1;
@@ -166,7 +166,7 @@ void KyraEngine_HoF::objectChat(const char *str, int object, int vocHigh, int vo
objectChatInit(str, object, vocHigh, vocLow);
_chatText = str;
_chatObject = object;
int chatType = chatGetType(str);
int chatType = chatGetType(str.c_str());
if (chatType == -1) {
_chatIsNote = true;
chatType = 0;
@@ -209,15 +209,15 @@ void KyraEngine_HoF::objectChat(const char *str, int object, int vocHigh, int vo
_mainCharacter.animFrame = _characterFrameTable[_mainCharacter.facing];
updateCharacterAnim(0);
_chatText = 0;
_chatText = "";
_chatObject = -1;
setNextIdleAnimTimer();
}
void KyraEngine_HoF::objectChatInit(const char *str, int object, int vocHigh, int vocLow) {
str = _text->preprocessString(str);
int lineNum = _text->buildMessageSubstrings(str);
void KyraEngine_HoF::objectChatInit(const Common::String &str0, int object, int vocHigh, int vocLow) {
Common::String str = _text->preprocessString(str0.c_str());
int lineNum = _text->buildMessageSubstrings(str.c_str());
int yPos = 0, xPos = 0;
@@ -259,17 +259,17 @@ void KyraEngine_HoF::objectChatInit(const char *str, int object, int vocHigh, in
}
}
void KyraEngine_HoF::objectChatPrintText(const char *str, int object) {
void KyraEngine_HoF::objectChatPrintText(const Common::String &str0, int object) {
int c1 = _talkObjectList[object].color;
str = _text->preprocessString(str);
int lineNum = _text->buildMessageSubstrings(str);
Common::String str = _text->preprocessString(str0.c_str());
int lineNum = _text->buildMessageSubstrings(str.c_str());
int maxWidth = _text->getWidestLineWidth(lineNum);
int x = (object == 0) ? _mainCharacter.x1 : _talkObjectList[object].x;
int cX1 = 0, cX2 = 0;
_text->calcWidestLineBounds(cX1, cX2, maxWidth, x);
for (int i = 0; i < lineNum; ++i) {
str = &_text->_talkSubstrings[i*_text->maxSubstringLen()];
str = Common::String(&_text->_talkSubstrings[i*_text->maxSubstringLen()]);
int y = _text->_talkMessageY + i * 10;
x = _text->getCenterStringX(str, cX1, cX2);
@@ -498,6 +498,7 @@ void KyraEngine_HoF::processDialogue(int dlgOffset, int vocH, int csEntry) {
offs += 2;
} else {
Common::String str;
if (!_flags.isTalkie || cmd == 11) {
int len = READ_LE_UINT16(_dlgBuffer + offs);
offs += 2;
@@ -505,8 +506,7 @@ void KyraEngine_HoF::processDialogue(int dlgOffset, int vocH, int csEntry) {
vocLo = READ_LE_UINT16(_dlgBuffer + offs);
offs += 2;
}
memcpy(_unkBuf500Bytes, _dlgBuffer + offs, len);
_unkBuf500Bytes[len] = 0;
str = Common::String((const char *) _dlgBuffer + offs, len);
offs += len;
if (_flags.isTalkie)
continue;
@@ -518,18 +518,17 @@ void KyraEngine_HoF::processDialogue(int dlgOffset, int vocH, int csEntry) {
vocHi = irnv[vocH - 1] + csEntry;
vocLo = READ_LE_UINT16(_dlgBuffer + offs);
offs += 2;
memcpy(_unkBuf500Bytes, _dlgBuffer + offs, len);
_unkBuf500Bytes[len] = 0;
str = Common::String((const char *) _dlgBuffer + offs, len);
offs += len;
}
if (_unkBuf500Bytes[0]) {
if (!str.empty()) {
if ((!_flags.isTalkie && cmd == 11) || (_flags.isTalkie && cmd == 12)) {
if (activeTimSequence > -1) {
deinitTalkObject(activeTimSequence);
activeTimSequence = -1;
}
objectChat((const char *)_unkBuf500Bytes, 0, vocHi, vocLo);
objectChat(str, 0, vocHi, vocLo);
} else {
if (activeTimSequence != nextTimSequence) {
if (activeTimSequence > -1) {
@@ -539,7 +538,7 @@ void KyraEngine_HoF::processDialogue(int dlgOffset, int vocH, int csEntry) {
initTalkObject(nextTimSequence);
activeTimSequence = nextTimSequence;
}
npcChatSequence((const char *)_unkBuf500Bytes, nextTimSequence, vocHi, vocLo);
npcChatSequence(str, nextTimSequence, vocHi, vocLo);
}
}
}
@@ -578,7 +577,7 @@ void KyraEngine_HoF::initTalkObject(int index) {
_tim->resetFinishedFlag();
while (!shouldQuit() && !_tim->finished()) {
_tim->exec(_currentTalkSections.STATim, false);
if (_chatText)
if (!_chatText.empty())
updateWithText();
else
update();
@@ -594,7 +593,7 @@ void KyraEngine_HoF::deinitTalkObject(int index) {
_tim->resetFinishedFlag();
while (!shouldQuit() && !_tim->finished()) {
_tim->exec(_currentTalkSections.ENDTim, false);
if (_chatText)
if (!_chatText.empty())
updateWithText();
else
update();
@@ -610,7 +609,7 @@ void KyraEngine_HoF::deinitTalkObject(int index) {
_tim->unload(_currentTalkSections.ENDTim);
}
void KyraEngine_HoF::npcChatSequence(const char *str, int objectId, int vocHigh, int vocLow) {
void KyraEngine_HoF::npcChatSequence(const Common::String &str, int objectId, int vocHigh, int vocLow) {
_chatText = str;
_chatObject = objectId;
objectChatInit(str, objectId, vocHigh, vocLow);
@@ -654,7 +653,7 @@ void KyraEngine_HoF::npcChatSequence(const char *str, int objectId, int vocHigh,
_tim->unload(_currentTalkSections.TLKTim);
_text->restoreScreen();
_chatText = 0;
_chatText = "";
_chatObject = -1;
setNextIdleAnimTimer();
}
+11 -11
View File
@@ -127,7 +127,7 @@ int TextDisplayer_MR::dropCRIntoString(char *str, int minOffs, int maxOffs) {
return 0;
}
void TextDisplayer_MR::printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2) {
void TextDisplayer_MR::printText(const Common::String &str, int x, int y, uint8 c0, uint8 c1, uint8 c2) {
if (_vm->_albumChatActive) {
c0 = 0xEE;
c1 = 0xE3;
@@ -138,7 +138,7 @@ void TextDisplayer_MR::printText(const char *str, int x, int y, uint8 c0, uint8
colorMap[3] = c1;
_screen->setTextColor(colorMap, 0, 3);
_screen->_charSpacing = -2;
_screen->printText(str, x, y, c0, c2);
_screen->printText(str.c_str(), x, y, c0, c2);
_screen->_charSpacing = 0;
}
@@ -228,7 +228,7 @@ void KyraEngine_MR::objectChat(const char *str, int object, int vocHigh, int voc
// _mainCharacter.facing can not be 0xFF here, so this is safe.
_mainCharacter.animFrame = _characterFrameTable[_mainCharacter.facing];
updateCharacterAnim(0);
_chatText = 0;
_chatText = "";
_chatObject = -1;
setNextIdleAnimTimer();
}
@@ -276,17 +276,17 @@ void KyraEngine_MR::objectChatInit(const char *str, int object, int vocHigh, int
}
}
void KyraEngine_MR::objectChatPrintText(const char *str, int object) {
void KyraEngine_MR::objectChatPrintText(const Common::String &str0, int object) {
int c1 = _talkObjectList[object].color;
str = _text->preprocessString(str);
int lineNum = _text->buildMessageSubstrings(str);
Common::String str = _text->preprocessString(str0.c_str());
int lineNum = _text->buildMessageSubstrings(str.c_str());
int maxWidth = _text->getWidestLineWidth(lineNum);
int x = (object == 0) ? _mainCharacter.x1 : _talkObjectList[object].x;
int cX1 = 0, cX2 = 0;
_text->calcWidestLineBounds(cX1, cX2, maxWidth, x);
for (int i = 0; i < lineNum; ++i) {
str = &_text->_talkSubstrings[i*_text->maxSubstringLen()];
str = Common::String(&_text->_talkSubstrings[i*_text->maxSubstringLen()]);
int y = _text->_talkMessageY + i * 10;
x = _text->getCenterStringX(str, cX1, cX2);
@@ -377,7 +377,7 @@ void KyraEngine_MR::badConscienceChat(const char *str, int vocHigh, int vocLow)
updateSceneAnim(0x0E, _badConscienceFrameTable[_badConscienceAnim+16]);
_text->restoreScreen();
update();
_chatText = 0;
_chatText = "";
_chatObject = -1;
}
@@ -433,7 +433,7 @@ void KyraEngine_MR::goodConscienceChat(const char *str, int vocHigh, int vocLow)
updateSceneAnim(0x0F, _goodConscienceFrameTable[_goodConscienceAnim+10]);
_text->restoreScreen();
update();
_chatText = 0;
_chatText = "";
_chatObject = -1;
}
@@ -491,7 +491,7 @@ void KyraEngine_MR::albumChat(const char *str, int vocHigh, int vocLow) {
albumChatWaitToFinish();
_screen->showMouse();
_chatText = 0;
_chatText = "";
_chatObject = -1;
}
@@ -824,7 +824,7 @@ void KyraEngine_MR::npcChatSequence(const char *str, int object, int vocHigh, in
}
}
_text->restoreScreen();
_chatText = 0;
_chatText = "";
_chatObject= - 1;
}
+1 -1
View File
@@ -37,7 +37,7 @@ public:
char *preprocessString(const char *str) override;
int dropCRIntoString(char *str, int minOffs, int maxOffs);
void printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2) override;
void printText(const Common::String &str, int x, int y, uint8 c0, uint8 c1, uint8 c2) override;
void restoreScreen();