Skip to content

Commit

Permalink
PRINCE: German texts drawing - update
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaslw committed Aug 2, 2014
1 parent b761953 commit 161f213
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 31 deletions.
70 changes: 39 additions & 31 deletions engines/prince/prince.cpp
Expand Up @@ -1032,40 +1032,10 @@ int PrinceEngine::checkMob(Graphics::Surface *screen, Common::Array<Mob> &mobLis
}

void PrinceEngine::printAt(uint32 slot, uint8 color, char *s, uint16 x, uint16 y) {

debugC(1, DebugChannel::kEngine, "PrinceEngine::printAt slot %d, color %d, x %02d, y %02d, str %s", slot, color, x, y, s);

char *strPointer = s;

if (getLanguage() == Common::DE_DEU) {
while (*strPointer) {
switch (*strPointer) {
case '\xc4':
*strPointer = '\x83';
break;
case '\xd6':
*strPointer = '\x84';
break;
case '\xdc':
*strPointer = '\x85';
break;
case '\xdf':
*strPointer = '\x7f';
break;
case '\xe4':
*strPointer = '\x80';
break;
case '\xf6':
*strPointer = '\x81';
break;
case '\xfc':
*strPointer = '\x82';
break;
}
strPointer++;
}
correctStringDEU(s);
}

Text &text = _textSlots[slot];
text._str = s;
text._x = x;
Expand All @@ -1090,6 +1060,35 @@ int PrinceEngine::calcTextTime(int numberOfLines) {
return numberOfLines * 30;
}

void PrinceEngine::correctStringDEU(char *s) {
while (*s) {
switch (*s) {
case '\xc4':
*s = '\x83';
break;
case '\xd6':
*s = '\x84';
break;
case '\xdc':
*s = '\x85';
break;
case '\xdf':
*s = '\x7f';
break;
case '\xe4':
*s = '\x80';
break;
case '\xf6':
*s = '\x81';
break;
case '\xfc':
*s = '\x82';
break;
}
s++;
}
}

uint32 PrinceEngine::getTextWidth(const char *s) {
uint16 textW = 0;
while (*s) {
Expand Down Expand Up @@ -2681,6 +2680,9 @@ void PrinceEngine::runDialog() {
int actualColor = _dialogColor1;

if (!(dialogDataValue & (1 << sentenceNumber))) {
if (getLanguage() == Common::DE_DEU) {
correctStringDEU((char *)dialogText);
}
Common::Array<Common::String> lines;
_font->wordWrapText((const char *)dialogText, _graph->_frontScreen->w, lines);

Expand Down Expand Up @@ -2776,6 +2778,9 @@ void PrinceEngine::talkHero(int slot) {
text._y = _secondHero->_middleY - _secondHero->_scaledFrameYSize;
}
text._time = time;
if (getLanguage() == Common::DE_DEU) {
correctStringDEU((char *)_interpreter->getString());
}
text._str = (const char *)_interpreter->getString();
_interpreter->increaseString();
}
Expand Down Expand Up @@ -2813,6 +2818,9 @@ void PrinceEngine::doTalkAnim(int animNumber, int slot, AnimType animType) {
error("doTalkAnim() - wrong animType: %d", animType);
}
text._time = time;
if (getLanguage() == Common::DE_DEU) {
correctStringDEU((char *)_interpreter->getString());
}
text._str = (const char *)_interpreter->getString();
_interpreter->increaseString();
}
Expand Down
1 change: 1 addition & 0 deletions engines/prince/prince.h
Expand Up @@ -302,6 +302,7 @@ class PrinceEngine : public Engine {
void printAt(uint32 slot, uint8 color, char *s, uint16 x, uint16 y);
int calcTextLines(const char *s);
int calcTextTime(int numberOfLines);
void correctStringDEU(char *s);

static const uint8 kMaxTexts = 32;
Text _textSlots[kMaxTexts];
Expand Down

0 comments on commit 161f213

Please sign in to comment.