Skip to content

Commit

Permalink
KYRA: (HOF) - turn string decode parameter into bool
Browse files Browse the repository at this point in the history
  • Loading branch information
athrxx committed Nov 5, 2020
1 parent 7f2c31b commit 3109f2f
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 35 deletions.
4 changes: 2 additions & 2 deletions engines/kyra/engine/items_hof.cpp
Expand Up @@ -207,7 +207,7 @@ void KyraEngine_HoF::itemDropDown(int startX, int startY, int dstX, int dstY, in
updateCharFacing();
snd_playSoundEffect(0x2D);
removeHandItem();
objectChat(getTableString(0xFF, _cCodeBuffer, 1), 0, 0x83, 0xFF);
objectChat(getTableString(0xFF, _cCodeBuffer, true), 0, 0x83, 0xFF);
} else {
_itemList[itemSlot].x = dstX;
_itemList[itemSlot].y = dstY;
Expand Down Expand Up @@ -286,7 +286,7 @@ void KyraEngine_HoF::itemDropDown(int startX, int startY, int dstX, int dstY, in
snd_playSoundEffect(0x2D);
removeHandItem();
_screen->showMouse();
objectChat(getTableString(0xFF, _cCodeBuffer, 1), 0, 0x83, 0xFF);
objectChat(getTableString(0xFF, _cCodeBuffer, true), 0, 0x83, 0xFF);
} else {
_itemList[itemSlot].x = dstX;
_itemList[itemSlot].y = dstY;
Expand Down
32 changes: 16 additions & 16 deletions engines/kyra/engine/kyra_hof.cpp
Expand Up @@ -431,12 +431,12 @@ void KyraEngine_HoF::runLoop() {
if (_mainCharacter.sceneId == 34) {
if (queryGameFlag(0xD1)) {
initTalkObject(28);
npcChatSequence(getTableString(0xFA, _cCodeBuffer, 1), 28, 0x83, 0xFA);
npcChatSequence(getTableString(0xFA, _cCodeBuffer, true), 28, 0x83, 0xFA);
deinitTalkObject(28);
enterNewScene(35, 4, 0, 0, 0);
} else if (queryGameFlag(0xD0)) {
initTalkObject(29);
npcChatSequence(getTableString(0xFB, _cCodeBuffer, 1), 29, 0x83, 0xFB);
npcChatSequence(getTableString(0xFB, _cCodeBuffer, true), 29, 0x83, 0xFB);
deinitTalkObject(29);
enterNewScene(33, 6, 0, 0, 0);
}
Expand Down Expand Up @@ -570,7 +570,7 @@ bool KyraEngine_HoF::handleInputUnkSub(int x, int y) {

if (_mouseState <= -3 && findItem(_mainCharacter.sceneId, 13) >= 0) {
updateCharFacing();
objectChat(getTableString(0xFC, _cCodeBuffer, 1), 0, 0x83, 0xFC);
objectChat(getTableString(0xFC, _cCodeBuffer, true), 0, 0x83, 0xFC);
return true;
} else {
_emc->init(&_sceneScriptState, &_sceneScriptData);
Expand Down Expand Up @@ -821,7 +821,7 @@ uint8 *KyraEngine_HoF::getTableEntry(uint8 *buffer, int id) {
return buffer + READ_LE_UINT16(buffer + (id<<1));
}

char *KyraEngine_HoF::getTableString(int id, uint8 *buffer, int decode) {
char *KyraEngine_HoF::getTableString(int id, uint8 *buffer, bool decode) {
char *string = (char *)getTableEntry(buffer, id);

if (decode && _flags.lang != Common::JA_JPN) {
Expand All @@ -843,7 +843,7 @@ const char *KyraEngine_HoF::getChapterString(int id) {
#pragma mark -

void KyraEngine_HoF::showMessageFromCCode(int id, int16 palIndex, int) {
const char *string = getTableString(id, _cCodeBuffer, 1);
const char *string = getTableString(id, _cCodeBuffer, true);
showMessage(string, palIndex);
}

Expand Down Expand Up @@ -876,7 +876,7 @@ void KyraEngine_HoF::updateCommandLineEx(int str1, int str2, int16 palIndex) {
char buffer[0x51];
char *src = buffer;

strcpy(src, getTableString(str1, _cCodeBuffer, 1));
strcpy(src, getTableString(str1, _cCodeBuffer, true));

if (_flags.lang != Common::JA_JPN) {
while (*src != 0x20)
Expand All @@ -890,7 +890,7 @@ void KyraEngine_HoF::updateCommandLineEx(int str1, int str2, int16 palIndex) {
if (str2 > 0) {
if (_flags.lang != Common::JA_JPN)
strcat((char *)_unkBuf500Bytes, " ");
strcat((char *)_unkBuf500Bytes, getTableString(str2, _cCodeBuffer, 1));
strcat((char *)_unkBuf500Bytes, getTableString(str2, _cCodeBuffer, true));
}

showMessage((char *)_unkBuf500Bytes, palIndex);
Expand Down Expand Up @@ -1144,7 +1144,7 @@ int KyraEngine_HoF::inputSceneChange(int x, int y, int unk1, int unk2) {

if (strId) {
updateCharFacing();
objectChat(getTableString(strId, _cCodeBuffer, 1), 0, vocH, strId);
objectChat(getTableString(strId, _cCodeBuffer, true), 0, vocH, strId);
_pathfinderFlag = 0;
return 0;
}
Expand Down Expand Up @@ -1175,13 +1175,13 @@ int KyraEngine_HoF::inputSceneChange(int x, int y, int unk1, int unk2) {
_deathHandler = 7;
snd_playWanderScoreViaMap(0x53, 1);
} else {
objectChat(getTableString(0xFD, _cCodeBuffer, 1), 0, 0x83, 0xFD);
objectChat(getTableString(0xFD, _cCodeBuffer, true), 0, 0x83, 0xFD);
setGameFlag(0x164);
_timer->enable(5);
_timer->setCountdown(5, 120);
}
} else if (queryGameFlag(0x164)) {
objectChat(getTableString(0xFE, _cCodeBuffer, 1), 0, 0x83, 0xFE);
objectChat(getTableString(0xFE, _cCodeBuffer, true), 0, 0x83, 0xFE);
resetGameFlag(0x164);
_timer->disable(5);
}
Expand Down Expand Up @@ -1774,7 +1774,7 @@ bool KyraEngine_HoF::updateCauldron() {
showMessage(0, 0xCF);
setCauldronState(cauldronState, true);
if (cauldronState == 7)
objectChat(getTableString(0xF2, _cCodeBuffer, 1), 0, 0x83, 0xF2);
objectChat(getTableString(0xF2, _cCodeBuffer, true), 0, 0x83, 0xF2);
clearCauldronTable();
return true;
}
Expand Down Expand Up @@ -1825,16 +1825,16 @@ void KyraEngine_HoF::listItemsInCauldron() {

if (!itemsInCauldron) {
if (!_cauldronState)
objectChat(getTableString(0xF4, _cCodeBuffer, 1), 0, 0x83, 0xF4);
objectChat(getTableString(0xF4, _cCodeBuffer, true), 0, 0x83, 0xF4);
else
objectChat(getTableString(0xF3, _cCodeBuffer, 1), 0, 0x83, 0xF3);
objectChat(getTableString(0xF3, _cCodeBuffer, true), 0, 0x83, 0xF3);
} else {
objectChat(getTableString(0xF7, _cCodeBuffer, 1), 0, 0x83, 0xF7);
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, 1));
strcpy(str, getTableString(_cauldronTable[i]+54, _cCodeBuffer, true));
if (_lang == 1) {
if (*str == 37)
str += 2;
Expand All @@ -1846,7 +1846,7 @@ void KyraEngine_HoF::listItemsInCauldron() {
}

char *str = buffer;
strcpy(str, getTableString(_cauldronTable[itemsInCauldron-1]+54, _cCodeBuffer, 1));
strcpy(str, getTableString(_cauldronTable[itemsInCauldron-1]+54, _cCodeBuffer, true));
if (_lang == 1) {
if (*str == 37)
str += 2;
Expand Down
2 changes: 1 addition & 1 deletion engines/kyra/engine/kyra_hof.h
Expand Up @@ -333,7 +333,7 @@ friend class GUI_HoF;
int _newChapterFile;

uint8 *getTableEntry(uint8 *buffer, int id);
char *getTableString(int id, uint8 *buffer, int decode);
char *getTableString(int id, uint8 *buffer, bool decode);
const char *getChapterString(int id);

void changeFileExtension(char *buffer);
Expand Down
22 changes: 11 additions & 11 deletions engines/kyra/gui/gui_hof.cpp
Expand Up @@ -83,7 +83,7 @@ const char *GUI_HoF::getMenuTitle(const Menu &menu) {
if (!menu.menuNameId)
return 0;

return _vm->getTableString(menu.menuNameId, _vm->_optionsBuffer, 1);
return _vm->getTableString(menu.menuNameId, _vm->_optionsBuffer, true);
}

const char *GUI_HoF::getMenuItemTitle(const MenuItem &menuItem) {
Expand All @@ -92,9 +92,9 @@ const char *GUI_HoF::getMenuItemTitle(const MenuItem &menuItem) {

// Strings 41-45 are menu labels, those must be handled uncompressed!
if (menuItem.itemId >= 41 && menuItem.itemId <= 45)
return _vm->getTableString(menuItem.itemId, _vm->_optionsBuffer, 0);
return _vm->getTableString(menuItem.itemId, _vm->_optionsBuffer, false);
else
return _vm->getTableString(menuItem.itemId, _vm->_optionsBuffer, 1);
return _vm->getTableString(menuItem.itemId, _vm->_optionsBuffer, true);
}

const char *GUI_HoF::getMenuItemLabel(const MenuItem &menuItem) {
Expand All @@ -104,7 +104,7 @@ const char *GUI_HoF::getMenuItemLabel(const MenuItem &menuItem) {
return _vm->getTableString(menuItem.labelId, _vm->_optionsBuffer, 1);
}

char *GUI_HoF::getTableString(int id, int decode) {
char *GUI_HoF::getTableString(int id, bool decode) {
return _vm->getTableString(id, _vm->_optionsBuffer, decode);
}

Expand Down Expand Up @@ -293,7 +293,7 @@ void KyraEngine_HoF::scrollInventoryWheel() {

int KyraEngine_HoF::bookButton(Button *button) {
if (!queryGameFlag(1)) {
objectChat(getTableString(0xEB, _cCodeBuffer, 1), 0, 0x83, 0xEB);
objectChat(getTableString(0xEB, _cCodeBuffer, true), 0, 0x83, 0xEB);
return 0;
}

Expand Down Expand Up @@ -368,10 +368,10 @@ int KyraEngine_HoF::bookButton(Button *button) {
_screen->showMouse();

if (!queryGameFlag(4) && !queryGameFlag(0xB8)) {
objectChat(getTableString(0xEC, _cCodeBuffer, 1), 0, 0x83, 0xEC);
objectChat(getTableString(0xED, _cCodeBuffer, 1), 0, 0x83, 0xED);
objectChat(getTableString(0xEE, _cCodeBuffer, 1), 0, 0x83, 0xEE);
objectChat(getTableString(0xEF, _cCodeBuffer, 1), 0, 0x83, 0xEF);
objectChat(getTableString(0xEC, _cCodeBuffer, true), 0, 0x83, 0xEC);
objectChat(getTableString(0xED, _cCodeBuffer, true), 0, 0x83, 0xED);
objectChat(getTableString(0xEE, _cCodeBuffer, true), 0, 0x83, 0xEE);
objectChat(getTableString(0xEF, _cCodeBuffer, true), 0, 0x83, 0xEF);
setGameFlag(4);
}

Expand Down Expand Up @@ -548,7 +548,7 @@ int KyraEngine_HoF::bookClose(Button *button) {
int KyraEngine_HoF::cauldronClearButton(Button *button) {
if (!queryGameFlag(2)) {
updateCharFacing();
objectChat(getTableString(0xF0, _cCodeBuffer, 1), 0, 0x83, 0xF0);
objectChat(getTableString(0xF0, _cCodeBuffer, true), 0, 0x83, 0xF0);
return 0;
}

Expand All @@ -573,7 +573,7 @@ int KyraEngine_HoF::cauldronClearButton(Button *button) {

int KyraEngine_HoF::cauldronButton(Button *button) {
if (!queryGameFlag(2)) {
objectChat(getTableString(0xF0, _cCodeBuffer, 1), 0, 0x83, 0xF0);
objectChat(getTableString(0xF0, _cCodeBuffer, true), 0, 0x83, 0xF0);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion engines/kyra/gui/gui_hof.h
Expand Up @@ -57,7 +57,7 @@ friend class KyraEngine_HoF;

void resetState(int item);

char *getTableString(int id, int decode) override;
char *getTableString(int id, bool decode) override;

KyraEngine_HoF *_vm;
Screen_HoF *_screen;
Expand Down
2 changes: 1 addition & 1 deletion engines/kyra/gui/gui_mr.cpp
Expand Up @@ -1083,7 +1083,7 @@ const char *GUI_MR::getMenuItemLabel(const MenuItem &menuItem) {
return (const char *)_vm->getTableEntry(_vm->_optionsFile, menuItem.labelId);
}

char *GUI_MR::getTableString(int id, int) {
char *GUI_MR::getTableString(int id, bool) {
return (char *)_vm->getTableEntry(_vm->_optionsFile, id);
}

Expand Down
2 changes: 1 addition & 1 deletion engines/kyra/gui/gui_mr.h
Expand Up @@ -50,7 +50,7 @@ friend class KyraEngine_MR;
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, int) override;
char *getTableString(int id, bool) override;

uint8 textFieldColor1() const override { return 0xFF; }
uint8 textFieldColor2() const override { return 0xCF; }
Expand Down
2 changes: 1 addition & 1 deletion engines/kyra/gui/gui_v2.cpp
Expand Up @@ -471,7 +471,7 @@ void GUI_v2::setupSavegameNames(Menu &menu, int num) {
menu.item[0].enabled = true;
} else {
char *dst = getTableString(menu.item[0].itemId);
const char *src = getTableString(_vm->gameFlags().isTalkie ? 34 : 42, _vm->gameFlags().lang == Common::RU_RUS ? 1 : 0);
const char *src = getTableString(_vm->gameFlags().isTalkie ? 34 : 42, _vm->gameFlags().lang == Common::RU_RUS);
strcpy(dst, src);
}
}
Expand Down
2 changes: 1 addition & 1 deletion engines/kyra/gui/gui_v2.h
Expand Up @@ -125,7 +125,7 @@ class GUI_v2 : public GUI_v1 {
virtual void setupPalette() {}
virtual void restorePalette() {}

virtual char *getTableString(int id, int decode = 0) = 0;
virtual char *getTableString(int id, bool decode = false) = 0;

virtual uint8 textFieldColor1() const = 0;
virtual uint8 textFieldColor2() const = 0;
Expand Down

0 comments on commit 3109f2f

Please sign in to comment.