[Scummvm-git-logs] scummvm-tools master -> 98f5f9a51fc627fa59e54f8bcc95d64a026ba0c1

sev- sev at scummvm.org
Thu Apr 12 18:41:29 CEST 2018


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm-tools' repo located at https://github.com/scummvm/scummvm-tools .

Summary:
98f5f9a51f TOOLS: Added support for English talktxt.txt to the converter


Commit: 98f5f9a51fc627fa59e54f8bcc95d64a026ba0c1
    https://github.com/scummvm/scummvm-tools/commit/98f5f9a51fc627fa59e54f8bcc95d64a026ba0c1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-04-12T18:32:09+02:00

Commit Message:
TOOLS: Added support for English talktxt.txt to the converter

Changed paths:
    engines/prince/convert-ru.pl


diff --git a/engines/prince/convert-ru.pl b/engines/prince/convert-ru.pl
index 5995be5..bf3c45f 100644
--- a/engines/prince/convert-ru.pl
+++ b/engines/prince/convert-ru.pl
@@ -7,18 +7,66 @@ use utf8;
 binmode STDOUT, ":utf8";
 
 my $skip = 0;
+my $line = 0;
+
+my $lang;
+
+my @english = (' a ', ' is ', ' i ', ' and ', ' be ', 'can', ' me', 'you', 'ack', 'that', 'then', 'yes', 'um', 'chi', 'year', 'mm', 'no', 'da', 'on',
+				'bla', 'lik', 'ha', 'but', 'ma', 'wa', 'yeah', 'taste', 'str', 'grr', 'pff', 'air', 'lord', ' he, ', 'get', 'yuck', 'oo', 'blur', 'see',
+				'puah', 'lo', 'go', 'cur', 'hop', 'super', 'doing', 'well', 'real', 'sure', 'final', 'all', 'illeg');
 
 while (<>) {
-	if (/^[#@]/ or $skip) {
+	$line++;
+	my $str = $_;
+	my $lstr = lc $str;
+
+	if (/^[#@\$]/ || $line == 1) {
 		print;
 		next;
 	}
 
-	if (/^nj b dsqltn.$/) {  # After this phrase we have German
-		$skip = 1;
+	if ($line == 4) {
+		if (/Bpdbyz/) {
+			$lang = 'ru';
+		} elsif (/Excuse/) {
+			$lang = 'en';
+		} elsif (/Verzeihung/) {
+			$lang = 'de';
+		} elsif (/Przeppp/) {
+			$lang = 'pl';
+		} else {
+			die "Unknown lanugage";
+		}
 	}
 
-	tr /qwertyuiopasdfghjklzxcvbnm\x85\xb3\xca\xa5\xea\xe6/йцукенгшщзфывапролдячсмитьхюэжбъ/;
-	tr /QWERTYUIOPASDFGHJKLZXCVBNM\x82\x7f\x83\x81\x84/ЙЦУКЕНГШЩЗФЫВАПРОЛДЯЧСМИТЬЭХБЖЮ/;
-	print;
+	if ($lang eq 'en') {
+		# Heuristics to detect Russian
+		my $eng = 0;
+
+		for my $k (@english) {
+			if (index($lstr, $k) != -1) {
+				print;
+				$eng = 1;
+				last;
+			}
+		}
+
+		next if ($eng);
+	}
+
+	if ($lang eq 'ru' or $lang eq 'en') { # We have English mixed with Russian
+		if ($skip) {
+			tr /\x9f\xa3/ÿś/;  # Pseude-hungarian speech symbol
+			print;
+			next;
+		}
+
+		if (/^nj b dsqltn.$/) {  # After this phrase we have German
+			$skip = 1;
+		}
+
+		tr /qwertyuiopasdfghjklzxcvbnm\x85\xb3\xca\xa5\xea\xe6/йцукенгшщзфывапролдячсмитьхюэжбъ/;
+		tr /QWERTYUIOPASDFGHJKLZXCVBNM\x82\x7f\x83\x81\x84/ЙЦУКЕНГШЩЗФЫВАПРОЛДЯЧСМИТЬЭХБЖЮ/;
+		print;
+	}
 }





More information about the Scummvm-git-logs mailing list