aboutsummaryrefslogtreecommitdiff
path: root/queen
diff options
context:
space:
mode:
authorGregory Montoir2004-04-03 17:58:58 +0000
committerGregory Montoir2004-04-03 17:58:58 +0000
commit8f6ae7973e895e40ecbf84afa95a0aa81508113b (patch)
treea29329c8cddf2c6daf3f07845033fb4266b4137e /queen
parent330cf4338327a7246f693192aa5c687d3eb5be79 (diff)
downloadscummvm-rg350-8f6ae7973e895e40ecbf84afa95a0aa81508113b.tar.gz
scummvm-rg350-8f6ae7973e895e40ecbf84afa95a0aa81508113b.tar.bz2
scummvm-rg350-8f6ae7973e895e40ecbf84afa95a0aa81508113b.zip
patch #910779 (with minor tweaks), fotaq hebrew support :
- reversed button captions in journal - reversed command text in pinnacle room - reverse order of lines in dialogue chooser thanks Ori Avtalion ! svn-id: r13447
Diffstat (limited to 'queen')
-rw-r--r--queen/command.cpp19
-rw-r--r--queen/command.h7
-rw-r--r--queen/journal.cpp9
-rw-r--r--queen/logic.cpp7
-rw-r--r--queen/talk.cpp62
-rw-r--r--queen/talk.h3
6 files changed, 87 insertions, 20 deletions
diff --git a/queen/command.cpp b/queen/command.cpp
index 084cc83026..fb3d8a4590 100644
--- a/queen/command.cpp
+++ b/queen/command.cpp
@@ -35,16 +35,21 @@
namespace Queen {
+CmdText::CmdText(bool reversed, uint8 y, QueenEngine *vm)
+ : _isReversed(reversed), _y(y), _vm(vm) {
+ clear();
+}
+
void CmdText::clear() {
memset(_command, 0, sizeof(_command));
}
void CmdText::display(uint8 color) {
_vm->display()->textCurrentColor(color);
- _vm->display()->setTextCentered(COMMAND_Y_POS, _command, false);
+ _vm->display()->setTextCentered(_y, _command, false);
}
-void CmdText::displayTemp(uint8 color, Verb v, const char *name) {
+void CmdText::displayTemp(uint8 color, Verb v, const char *name, bool outlined) {
char temp[MAX_COMMAND_LEN] = "";
if (_isReversed) {
if (name != NULL)
@@ -58,17 +63,17 @@ void CmdText::displayTemp(uint8 color, Verb v, const char *name) {
}
}
_vm->display()->textCurrentColor(color);
- _vm->display()->setTextCentered(COMMAND_Y_POS, temp, false);
+ _vm->display()->setTextCentered(_y, temp, outlined);
}
-void CmdText::displayTemp(uint8 color, const char *name) {
+void CmdText::displayTemp(uint8 color, const char *name, bool outlined) {
char temp[MAX_COMMAND_LEN];
if (_isReversed)
sprintf(temp, "%s %s", name, _command);
else
sprintf(temp, "%s %s", _command, name);
_vm->display()->textCurrentColor(color);
- _vm->display()->setTextCentered(COMMAND_Y_POS, temp, false);
+ _vm->display()->setTextCentered(_y, temp, outlined);
}
void CmdText::setVerb(Verb v) {
@@ -117,9 +122,7 @@ void CmdState::init() {
}
Command::Command(QueenEngine *vm)
- : _vm(vm) {
- _cmdText._isReversed = (vm->resource()->getLanguage() == HEBREW);
- _cmdText._vm = vm;
+ : _cmdText((vm->resource()->getLanguage() == HEBREW), CmdText::COMMAND_Y_POS, vm), _vm(vm) {
}
void Command::clear(bool clearTexts) {
diff --git a/queen/command.h b/queen/command.h
index 1b0cdc4cd9..2d7aff98dc 100644
--- a/queen/command.h
+++ b/queen/command.h
@@ -32,10 +32,12 @@ class QueenEngine;
struct CmdText {
+ CmdText(bool reversed, uint8 y, QueenEngine *vm);
+
void clear();
void display(uint8 color);
- void displayTemp(uint8 color, Verb v, const char *name = NULL);
- void displayTemp(uint8 color, const char *name);
+ void displayTemp(uint8 color, Verb v, const char *name = NULL, bool outlined = false);
+ void displayTemp(uint8 color, const char *name, bool outlined = false);
void setVerb(Verb v);
void addLinkWord(Verb v);
void addObject(const char *objName);
@@ -46,6 +48,7 @@ struct CmdText {
COMMAND_Y_POS = 151
};
+ uint8 _y;
bool _isReversed;
char _command[MAX_COMMAND_LEN];
QueenEngine *_vm;
diff --git a/queen/journal.cpp b/queen/journal.cpp
index f1a4fb93b6..206481a363 100644
--- a/queen/journal.cpp
+++ b/queen/journal.cpp
@@ -353,8 +353,13 @@ void Journal::drawPanelText(int y, const char *text) {
_panelTextY[_panelTextCount++] = y;
} else {
*p++ = '\0';
- drawPanelText(y - 5, s);
- drawPanelText(y + 5, p);
+ if (_vm->resource()->getLanguage() == HEBREW) {
+ drawPanelText(y - 5, p);
+ drawPanelText(y + 5, s);
+ } else {
+ drawPanelText(y - 5, s);
+ drawPanelText(y + 5, p);
+ }
}
}
diff --git a/queen/logic.cpp b/queen/logic.cpp
index ff5dd7a875..ecb05f7530 100644
--- a/queen/logic.cpp
+++ b/queen/logic.cpp
@@ -1196,10 +1196,11 @@ void Logic::handlePinnacleRoom() {
_vm->update();
_vm->display()->palFadeIn(0, 223, ROOM_JUNGLE_PINNACLE, joe->active, joe->x, joe->y);
- _vm->display()->textCurrentColor(INK_PINNACLE_ROOM);
_entryObj = 0;
uint16 prevObj = 0;
+ CmdText cmdText((_vm->resource()->getLanguage() == HEBREW), 5, _vm);
+ cmdText.setVerb(VERB_WALK_TO);
while (_vm->input()->mouseButton() == 0 || _entryObj == 0) {
_vm->update();
@@ -1222,9 +1223,7 @@ void Logic::handlePinnacleRoom() {
ObjectData *objData = objectData(curObj);
if (objData->name > 0) {
_entryObj = objData->entryObj;
- char textCmd[CmdText::MAX_COMMAND_LEN];
- sprintf(textCmd, "%s %s", verbName(VERB_WALK_TO), objectName(objData->name));
- _vm->display()->setTextCentered(5, textCmd);
+ cmdText.displayTemp(INK_PINNACLE_ROOM, objectName(objData->name), true);
}
prevObj = curObj;
}
diff --git a/queen/talk.cpp b/queen/talk.cpp
index 8bc748ef25..17421e4e2d 100644
--- a/queen/talk.cpp
+++ b/queen/talk.cpp
@@ -1185,15 +1185,69 @@ TalkSelected *Talk::talkSelected() {
int Talk::splitOption(const char *str, char optionText[5][MAX_STRING_SIZE]) {
debug(6, "Talk::splitOption(%s)", str);
- // Check to see if option fits on one line, and exit early
+ int lines;
+ memset(optionText, 0, 5 * MAX_STRING_SIZE);
if (_vm->resource()->getLanguage() == ENGLISH ||
_vm->display()->textWidth(str) <= MAX_TEXT_WIDTH) {
strcpy(optionText[0], str);
- return 1;
+ lines = 1;
+ } else if (_vm->resource()->getLanguage() == HEBREW) {
+ lines = splitOptionHebrew(str, optionText);
+ } else {
+ lines = splitOptionDefault(str, optionText);
}
+ return lines;
+}
+int Talk::splitOptionHebrew(const char *str, char optionText[5][MAX_STRING_SIZE]) {
+ char tmpString[MAX_STRING_SIZE] = "";
+ uint16 len = 0;
+ uint16 spaceCharWidth = _vm->display()->textWidth(" ");
+ uint16 width = 0;
+ uint16 optionLines = 0;
+ uint16 maxTextLen = MAX_TEXT_WIDTH;
+ char *p = strchr(str, '\0');
+ while (p != str - 1) {
+ while (*p != ' ' && p != str - 1) {
+ --p;
+ ++len;
+ }
+ if (p != str - 1) {
+ uint16 wordWidth = _vm->display()->textWidth(p, len);
+ width += wordWidth;
+ if (width > maxTextLen) {
+ ++optionLines;
+ strncpy(optionText[optionLines], p, len);
+ optionText[optionLines][len] = '\0';
+ width = wordWidth;
+ maxTextLen = MAX_TEXT_WIDTH - OPTION_TEXT_MARGIN;
+ } else {
+ strcpy(tmpString, optionText[optionLines]);
+ strncpy(optionText[optionLines], p, len);
+ optionText[optionLines][len] = '\0';
+ strcat(optionText[optionLines], tmpString);
+ }
+ --p;
+ len = 1;
+ width += spaceCharWidth;
+ } else {
+ if (len > 1) {
+ if (width + _vm->display()->textWidth(p + 1, len) > maxTextLen) {
+ ++optionLines;
+ }
+ strcpy(tmpString, optionText[optionLines]);
+ strncpy(optionText[optionLines], p + 1, len);
+ optionText[optionLines][len] = '\0';
+ strcat(optionText[optionLines], tmpString);
+ }
+ ++optionLines;
+ }
+ }
+ return optionLines;
+}
+
+int Talk::splitOptionDefault(const char *str, char optionText[5][MAX_STRING_SIZE]) {
// Split up multiple line option at closest space character
- memset(optionText, 0, 5 * MAX_STRING_SIZE);
uint16 spaceCharWidth = _vm->display()->textWidth(" ");
uint16 width = 0;
uint16 optionLines = 0;
@@ -1205,7 +1259,7 @@ int Talk::splitOption(const char *str, char optionText[5][MAX_STRING_SIZE]) {
uint16 len = p - str;
uint16 wordWidth = _vm->display()->textWidth(str, len);
width += wordWidth;
- if (width> maxTextLen) {
+ if (width > maxTextLen) {
++optionLines;
strncpy(optionText[optionLines], str, len + 1);
width = wordWidth;
diff --git a/queen/talk.h b/queen/talk.h
index 03b92c9598..d7f84a1de8 100644
--- a/queen/talk.h
+++ b/queen/talk.h
@@ -238,7 +238,10 @@ private:
int faceDirection);
int splitOption(const char *str, char optionText[5][MAX_STRING_SIZE]);
+
+ int splitOptionHebrew(const char *str, char optionText[5][MAX_STRING_SIZE]);
+ int splitOptionDefault(const char *str, char optionText[5][MAX_STRING_SIZE]);
};