RCS file: /cvsroot/scummvm/scummvm/queen/talk.cpp,v
retrieving revision 1.92
diff -u -r1.92 talk.cpp
|
|
|
|
| 1233 | 1233 | uint16 optionLines = 0; |
| 1234 | 1234 | uint16 maxTextLen = MAX_TEXT_WIDTH; |
| 1235 | 1235 | const char *p = str; |
| 1236 | | while (p) { |
| 1237 | | p = strchr(str, ' '); |
| 1238 | | if (p) { |
| 1239 | | uint16 len = p - str; |
| 1240 | | uint16 wordWidth = _vm->display()->textWidth(str, len); |
| 1241 | | width += wordWidth; |
| 1242 | | if (width> maxTextLen) { |
| 1243 | | ++optionLines; |
| 1244 | | strncpy(optionText[optionLines], str, len + 1); |
| 1245 | | width = wordWidth; |
| 1246 | | maxTextLen = MAX_TEXT_WIDTH - OPTION_TEXT_MARGIN; |
| | 1236 | char tmpString[MAX_STRING_SIZE] = ""; |
| | 1237 | |
| | 1238 | // Split up hebrew lines in reverse |
| | 1239 | if (_vm->resource()->getLanguage() == HEBREW) { |
| | 1240 | uint16 len = 0; |
| | 1241 | |
| | 1242 | p = strchr(str, '\0'); |
| | 1243 | |
| | 1244 | while (p != str - 1) { |
| | 1245 | while (*p != ' ' && p != str - 1) { |
| | 1246 | --p; |
| | 1247 | ++len; |
| | 1248 | } |
| | 1249 | if (p != str - 1) { |
| | 1250 | uint16 wordWidth = _vm->display()->textWidth(p, len); |
| | 1251 | width += wordWidth; |
| | 1252 | if (width > maxTextLen) { |
| | 1253 | ++optionLines; |
| | 1254 | strncpy(optionText[optionLines], p, len); |
| | 1255 | optionText[optionLines][len] = '\0'; |
| | 1256 | width = wordWidth; |
| | 1257 | maxTextLen = MAX_TEXT_WIDTH - OPTION_TEXT_MARGIN; |
| | 1258 | } else { |
| | 1259 | strcpy(tmpString, optionText[optionLines]); |
| | 1260 | strncpy(optionText[optionLines], p, len); |
| | 1261 | optionText[optionLines][len] = '\0'; |
| | 1262 | strcat(optionText[optionLines], tmpString); |
| | 1263 | } |
| | 1264 | --p; |
| | 1265 | len = 1; |
| | 1266 | width += spaceCharWidth; |
| 1247 | 1267 | } else { |
| 1248 | | strncat(optionText[optionLines], str, len + 1); |
| | 1268 | if (len > 1) { |
| | 1269 | if (width + _vm->display()->textWidth(p + 1, len) > maxTextLen) { |
| | 1270 | ++optionLines; |
| | 1271 | } |
| | 1272 | |
| | 1273 | strcpy(tmpString, optionText[optionLines]); |
| | 1274 | strncpy(optionText[optionLines], p + 1, len); |
| | 1275 | optionText[optionLines][len] = '\0'; |
| | 1276 | strcat(optionText[optionLines], tmpString); |
| | 1277 | } |
| | 1278 | ++optionLines; |
| 1249 | 1279 | } |
| 1250 | | width += spaceCharWidth; |
| 1251 | | str = p + 1; |
| 1252 | | } else { |
| 1253 | | if (str[0]) { |
| 1254 | | if (width + _vm->display()->textWidth(str) > maxTextLen) { |
| | 1280 | } |
| | 1281 | } else { |
| | 1282 | while (p) { |
| | 1283 | p = strchr(str, ' '); |
| | 1284 | if (p) { |
| | 1285 | uint16 len = p - str; |
| | 1286 | uint16 wordWidth = _vm->display()->textWidth(str, len); |
| | 1287 | width += wordWidth; |
| | 1288 | if (width> maxTextLen) { |
| 1255 | 1289 | ++optionLines; |
| | 1290 | strncpy(optionText[optionLines], str, len + 1); |
| | 1291 | width = wordWidth; |
| | 1292 | maxTextLen = MAX_TEXT_WIDTH - OPTION_TEXT_MARGIN; |
| | 1293 | } else { |
| | 1294 | strncat(optionText[optionLines], str, len + 1); |
| 1256 | 1295 | } |
| 1257 | | strcat(optionText[optionLines], str); |
| | 1296 | width += spaceCharWidth; |
| | 1297 | str = p + 1; |
| | 1298 | } else { |
| | 1299 | if (str[0]) { |
| | 1300 | if (width + _vm->display()->textWidth(str) > maxTextLen) { |
| | 1301 | ++optionLines; |
| | 1302 | } |
| | 1303 | strcat(optionText[optionLines], str); |
| | 1304 | } |
| | 1305 | ++optionLines; |
| 1258 | 1306 | } |
| 1259 | | ++optionLines; |
| 1260 | 1307 | } |
| | 1308 | |
| 1261 | 1309 | } |
| 1262 | 1310 | return optionLines; |
| 1263 | 1311 | } |
RCS file: /cvsroot/scummvm/scummvm/queen/journal.cpp,v
retrieving revision 1.32
diff -u -r1.32 journal.cpp
|
|
|
|
| 368 | 368 | char s[80]; |
| 369 | 369 | strcpy(s, text); |
| 370 | 370 | char *p = strchr(s, ' '); |
| | 371 | |
| 371 | 372 | if (p == NULL) { |
| 372 | 373 | int x = (128 - _vm->display()->textWidth(s)) / 2; |
| 373 | 374 | _vm->display()->setText(x, y, s, false); |
| 374 | 375 | _panelTextY[_panelTextCount++] = y; |
| 375 | 376 | } else { |
| 376 | 377 | *p++ = '\0'; |
| 377 | | drawPanelText(y - 5, s); |
| 378 | | drawPanelText(y + 5, p); |
| | 378 | if (_vm->resource()->getLanguage() == HEBREW) { |
| | 379 | drawPanelText(y - 5, p); |
| | 380 | drawPanelText(y + 5, s); |
| | 381 | } else { |
| | 382 | drawPanelText(y - 5, s); |
| | 383 | drawPanelText(y + 5, p); |
| | 384 | } |
| 379 | 385 | } |
| 380 | 386 | } |
| 381 | 387 | |