aboutsummaryrefslogtreecommitdiff
path: root/queen
diff options
context:
space:
mode:
authorJoost Peters2004-02-13 22:33:21 +0000
committerJoost Peters2004-02-13 22:33:21 +0000
commitbf0d58fe8942bfc4fd38b751c922e88af5e3124d (patch)
tree339b2cdadc23e61d14a1a4e837148f1116465509 /queen
parenta4df55fbc1e474f9dad0ff3fa3fb8f89123a8d51 (diff)
downloadscummvm-rg350-bf0d58fe8942bfc4fd38b751c922e88af5e3124d.tar.gz
scummvm-rg350-bf0d58fe8942bfc4fd38b751c922e88af5e3124d.tar.bz2
scummvm-rg350-bf0d58fe8942bfc4fd38b751c922e88af5e3124d.zip
Applied patch #896726 (reversed hebrew text) and reduced overhead a little by introducing an _isReversed boolean
svn-id: r12860
Diffstat (limited to 'queen')
-rw-r--r--queen/command.cpp60
-rw-r--r--queen/command.h1
-rw-r--r--queen/graphics.cpp36
3 files changed, 71 insertions, 26 deletions
diff --git a/queen/command.cpp b/queen/command.cpp
index 9673ba999b..c6b7ca4da5 100644
--- a/queen/command.cpp
+++ b/queen/command.cpp
@@ -45,15 +45,27 @@ void CmdText::display(uint8 color) {
}
void CmdText::displayTemp(uint8 color, bool locked, Verb v, const char *name) {
- char temp[MAX_COMMAND_LEN];
- if (locked) {
- sprintf(temp, "%s%s", _vm->logic()->joeResponse(39), _vm->logic()->verbName(v));
+ char temp[MAX_COMMAND_LEN] = "";
+ if (_isReversed) {
+ if (name != NULL)
+ sprintf(temp, "%s ", name);
+
+ if (locked) {
+ strcat(temp, _vm->logic()->verbName(v));
+ strcat(temp, " ");
+ strcat(temp, _vm->logic()->joeResponse(39));
+ } else
+ strcat(temp, _vm->logic()->verbName(v));
} else {
- strcpy(temp, _vm->logic()->verbName(v));
- }
- if (name != NULL) {
- strcat(temp, " ");
- strcat(temp, name);
+ if (locked)
+ sprintf(temp, "%s %s", _vm->logic()->joeResponse(39), _vm->logic()->verbName(v));
+ else
+ strcpy(temp, _vm->logic()->verbName(v));
+
+ if (name != NULL) {
+ strcat(temp, " ");
+ strcat(temp, name);
+ }
}
_vm->display()->textCurrentColor(color);
_vm->display()->setTextCentered(COMMAND_Y_POS, temp, false);
@@ -61,7 +73,10 @@ void CmdText::displayTemp(uint8 color, bool locked, Verb v, const char *name) {
void CmdText::displayTemp(uint8 color, const char *name) {
char temp[MAX_COMMAND_LEN];
- sprintf(temp, "%s %s", _command, name);
+ 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);
}
@@ -71,13 +86,31 @@ void CmdText::setVerb(Verb v) {
}
void CmdText::addLinkWord(Verb v) {
- strcat(_command, " ");
- strcat(_command, _vm->logic()->verbName(v));
+ if (_isReversed) {
+ char temp[MAX_COMMAND_LEN];
+
+ strcpy(temp, _command);
+ strcpy(_command, _vm->logic()->verbName(v));
+ strcat(_command, " ");
+ strcat(_command, temp);
+ } else {
+ strcat(_command, " ");
+ strcat(_command, _vm->logic()->verbName(v));
+ }
}
void CmdText::addObject(const char *objName) {
- strcat(_command, " ");
- strcat(_command, objName);
+ if (_isReversed) {
+ char temp[MAX_COMMAND_LEN];
+
+ strcpy(temp, _command);
+ strcpy(_command, objName);
+ strcat(_command, " ");
+ strcat(_command, temp);
+ } else {
+ strcat(_command, " ");
+ strcat(_command, objName);
+ }
}
bool CmdText::isEmpty() const {
@@ -95,6 +128,7 @@ void CmdState::init() {
Command::Command(QueenEngine *vm)
: _vm(vm) {
+ _cmdText._isReversed = (vm->resource()->getLanguage() == HEBREW);
_cmdText._vm = vm;
}
diff --git a/queen/command.h b/queen/command.h
index 686ee470ee..ad27d83c6f 100644
--- a/queen/command.h
+++ b/queen/command.h
@@ -46,6 +46,7 @@ struct CmdText {
COMMAND_Y_POS = 151
};
+ bool _isReversed;
char _command[MAX_COMMAND_LEN];
QueenEngine *_vm;
};
diff --git a/queen/graphics.cpp b/queen/graphics.cpp
index aac0872abd..b12cdd2280 100644
--- a/queen/graphics.cpp
+++ b/queen/graphics.cpp
@@ -432,25 +432,35 @@ void Graphics::setBobText(
char lines[8][MAX_STRING_SIZE];
int lineCount = 0;
- int wordCount = 0;
int lineLength = 0;
int i;
- for (i = 0; i < length; i++) {
- if (textCopy[i] == ' ')
- wordCount++;
-
- lineLength++;
-
- if ((lineLength > 20 && textCopy[i] == ' ') || i == (length-1)) {
- memcpy(lines[lineCount], textCopy + i + 1 - lineLength, lineLength);
- lines[lineCount][lineLength] = '\0';
- lineCount++;
- lineLength = 0;
+ // Hebrew strings are written from right to left and should be cut
+ // to lines in reverse
+ if (_vm->resource()->getLanguage() == HEBREW) {
+ for (i = length - 1; i >= 0; i--) {
+ lineLength++;
+
+ if ((lineLength > 20 && textCopy[i] == ' ') || i == 0) {
+ memcpy(lines[lineCount], textCopy + i, lineLength);
+ lines[lineCount][lineLength] = '\0';
+ lineCount++;
+ lineLength = 0;
+ }
+ }
+ } else {
+ for (i = 0; i < length; i++) {
+ lineLength++;
+
+ if ((lineLength > 20 && textCopy[i] == ' ') || i == (length-1)) {
+ memcpy(lines[lineCount], textCopy + i + 1 - lineLength, lineLength);
+ lines[lineCount][lineLength] = '\0';
+ lineCount++;
+ lineLength = 0;
+ }
}
}
-
// Plan: write each line to Screen 2, put black outline around lines and
// pick them up as a BOB.