diff options
Diffstat (limited to 'queen')
-rw-r--r-- | queen/command.cpp | 60 | ||||
-rw-r--r-- | queen/command.h | 1 | ||||
-rw-r--r-- | queen/graphics.cpp | 36 |
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. |