aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorPaweł Kołodziejski2002-09-17 15:33:31 +0000
committerPaweł Kołodziejski2002-09-17 15:33:31 +0000
commitc61b8249428216dacfdc5805f51f96caeb9711bd (patch)
tree194afc05295286e50546bd691a994e7267da5776 /scumm
parent978e879009e205f32b4579f8a77061a9619bc2ea (diff)
downloadscummvm-rg350-c61b8249428216dacfdc5805f51f96caeb9711bd.tar.gz
scummvm-rg350-c61b8249428216dacfdc5805f51f96caeb9711bd.tar.bz2
scummvm-rg350-c61b8249428216dacfdc5805f51f96caeb9711bd.zip
added support for nonenglish the dig(dialogs, descriptions, warnings), not gui yet
svn-id: r4959
Diffstat (limited to 'scumm')
-rw-r--r--scumm/script_v2.cpp116
-rw-r--r--scumm/scumm.h1
-rw-r--r--scumm/scummvm.cpp2
-rw-r--r--scumm/string.cpp17
4 files changed, 80 insertions, 56 deletions
diff --git a/scumm/script_v2.cpp b/scumm/script_v2.cpp
index edc0bb42f8..3d7f46d420 100644
--- a/scumm/script_v2.cpp
+++ b/scumm/script_v2.cpp
@@ -2534,17 +2534,19 @@ void Scumm::o6_talkActor()
_actorToPrintStrFor = pop();
_messagePtr = _scriptPointer;
- if (_scriptPointer[0] == '/') {
- char *pointer = strtok((char *)_scriptPointer, "/");
- int bunsize = strlen(pointer) + 2;
+ if ((_gameId == GID_DIG) && (_messagePtr[0] == '/')) {
+ _scriptPointer += strlen((char*)_scriptPointer) + 1;
+ translateText((char*)_messagePtr, (char*)&transText);
+ char *pointer = strtok((char *)_messagePtr, "/");
_sound->playBundleSound(pointer);
- _scriptPointer += bunsize;
- _messagePtr = _scriptPointer;
+ _messagePtr = (byte*)&transText;
+ setStringVars(0);
+ actorTalk();
+ } else {
+ setStringVars(0);
+ actorTalk();
+ _scriptPointer = _messagePtr;
}
-
- setStringVars(0);
- actorTalk();
- _scriptPointer = _messagePtr;
}
void Scumm::o6_talkEgo()
@@ -2552,17 +2554,19 @@ void Scumm::o6_talkEgo()
_actorToPrintStrFor = (unsigned char)_vars[VAR_EGO];
_messagePtr = _scriptPointer;
- if (_scriptPointer[0] == '/') {
- char *pointer = strtok((char *)_scriptPointer, "/");
- int bunsize = strlen(pointer) + 2;
+ if ((_gameId == GID_DIG) && (_messagePtr[0] == '/')) {
+ _scriptPointer += strlen((char*)_scriptPointer) + 1;
+ translateText((char*)_messagePtr, (char*)&transText);
+ char *pointer = strtok((char *)_messagePtr, "/");
_sound->playBundleSound(pointer);
- _scriptPointer += bunsize;
- _messagePtr = _scriptPointer;
+ _messagePtr = (byte*)&transText;
+ setStringVars(0);
+ actorTalk();
+ } else {
+ setStringVars(0);
+ actorTalk();
+ _scriptPointer = _messagePtr;
}
-
- setStringVars(0);
- actorTalk();
- _scriptPointer = _messagePtr;
}
void Scumm::o6_dim()
@@ -2743,16 +2747,17 @@ void Scumm::o6_miscOps()
break;
case 16:
if (_gameId == GID_DIG) {
- _msgPtrToAdd = charset._buffer;
+ byte buf[200];
+ _msgPtrToAdd = buf;
+ setStringVars(0);
addMessageToStack(getStringAddressVar(VAR_STRING2DRAW));
- i = 0;
- while (charset._buffer[i] != 0) {
- if (charset._buffer[i] == '/') {
- charset._bufPos = i + 1;
- }
- i++;
+ if (strncmp("/SYSTEM.007/ /", (char*)&buf, 14) == 0) {
+ translateText((char*)&buf + 13, (char*)&charset._buffer);
+ description();
+ } else if (strncmp("/SYSTEM.007/ ", (char*)&buf, 13) == 0) {
+ strcpy((char*)&charset._buffer, (char*)&buf + 13);
+ description();
}
- description();
}
break;
case 17:
@@ -3076,30 +3081,43 @@ void Scumm::decodeParseString2(int m, int n)
case 75:{
_messagePtr = _scriptPointer;
- if (_scriptPointer[0] == '/') {
- char *pointer = strtok((char *)_scriptPointer, "/");
- int bunsize = strlen(pointer) + 2;
- _sound->playBundleSound(pointer);
- _scriptPointer += bunsize;
- _messagePtr = _scriptPointer;
- }
-
- switch (m) {
- case 0:
- actorTalk();
- break;
- case 1:
- drawString(1);
- break;
- case 2:
- unkMessage1();
- break;
- case 3:
- unkMessage2();
- break;
+ if ((_messagePtr[0] == '/') && (_gameId == GID_DIG)) {
+ translateText((char*)_messagePtr, (char*)&transText);
+ _messagePtr = (byte*)&transText;
+ _scriptPointer += strlen((char*)_scriptPointer) + 1;
+ switch (m) {
+ case 0:
+ actorTalk();
+ break;
+ case 1:
+ drawString(1);
+ break;
+ case 2:
+ unkMessage1();
+ break;
+ case 3:
+ unkMessage2();
+ break;
+ }
+ return;
+ } else {
+ switch (m) {
+ case 0:
+ actorTalk();
+ break;
+ case 1:
+ drawString(1);
+ break;
+ case 2:
+ unkMessage1();
+ break;
+ case 3:
+ unkMessage2();
+ break;
+ }
+ _scriptPointer = _messagePtr;
+ return;
}
- _scriptPointer = _messagePtr;
- return;
}
case 0xFE:
setStringVars(m);
diff --git a/scumm/scumm.h b/scumm/scumm.h
index 4d26ad63fb..be68bcc7ba 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -933,6 +933,7 @@ public:
char *_languageBuffer;
void loadLanguageBundle();
void translateText(char * text, char * trans_buff);
+ char transText[200];
bool checkFixedDisk();
int _cdrom;
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index df9dddf824..b04b0999ba 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -150,6 +150,7 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst)
_saveLoadFlag = 2;
_saveLoadCompatible = false;
}
+ loadLanguageBundle();
}
Scumm::~Scumm ()
@@ -300,7 +301,6 @@ void Scumm::scummInit()
#endif
_timer->installProcedure(&autosave, 5 * 60 * 1000);
- loadLanguageBundle();
}
diff --git a/scumm/string.cpp b/scumm/string.cpp
index f630626ed9..c80a216e2e 100644
--- a/scumm/string.cpp
+++ b/scumm/string.cpp
@@ -474,7 +474,8 @@ void Scumm::description()
int c;
byte *buffer;
- buffer = charset._buffer + charset._bufPos;
+ buffer = charset._buffer;
+ charset._bufPos = 0;
string[0].ypos = camera._cur.y + 88;
string[0].xpos = (_realWidth / 2) - (charset.getStringWidth(0, buffer, 0) >> 1);
if (string[0].xpos < 0)
@@ -1096,7 +1097,7 @@ void Scumm::loadLanguageBundle() {
}
void Scumm::translateText(char * text, char * trans_buff) {
- if ((_existLanguageFile == true) && (text[0] == '/')) {
+ if ((_existLanguageFile == true) && (text[0] == '/') && (text[1] != ' ')) {
char name[20], tmp[20], tmp2[20], num_s[20];
int32 num, l, j, k, r, pos;
char enc;
@@ -1176,10 +1177,14 @@ void Scumm::translateText(char * text, char * trans_buff) {
}
if (text[0] == '/') {
- char *pointer = strtok((char*)text, "/");
- int offset = strlen(pointer) + 2;
- strcpy (trans_buff, text + offset);
+ char *pointer = strchr((char*)text + 1, '/');
+ if (pointer != NULL)
+ strcpy(trans_buff, pointer + 1);
+ else
+ strcpy(trans_buff, "");
+
+ return;
}
- strcpy (trans_buff, text);
+ strcpy(trans_buff, text);
}