Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
  • 10 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Showing with 367 additions and 9 deletions.
  1. +6 −4 engines/prince/convert-ru.pl
  2. +203 −5 engines/prince/gen-po.pl
  3. +158 −0 engines/prince/po-parse.pl
@@ -13,7 +13,7 @@

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', 'done', 'empt');
'puah', 'lo', 'go', 'cur', 'hop', 'super', 'doing', 'well', 'real', 'sure', 'final', 'all', 'illeg', 'done', 'empt', 'galador');

while (<STDIN>) {
$line++;
@@ -43,6 +43,8 @@
}
}

s/"/\\"/g; # Escape quotes

if ($lang eq 'en') {
# Heuristics to detect Russian
my $eng = 0;
@@ -62,12 +64,12 @@

if ($lang eq 'ru' or $lang eq 'en') { # We have English mixed with Russian
if ($skip) {
tr /\x9f\xa3/źá/; # Pseude-hungarian speech symbol
tr /\x9f\xa3/źá/; # Pseudo-hungarian speech symbol
print;
next;
}

if (/^nj b dsqltn.$/) { # After this phrase we have German
if (/^nj b dsqltn.$/ && $lang eq 'ru') { # After this phrase we have German
$skip = 1;
}

@@ -85,7 +87,7 @@
if ($lang eq 'de') {
tr /\xc4\xdf\xfc\xf6/Äßüö/;

tr /\x9f\xa3/źá/; # Pseude-hungarian speech symbol
tr /\x9f\xa3/źá/; # Pseudo-hungarian speech symbol

print;
}
@@ -8,6 +8,10 @@
sub process_varia($);
sub process_mob($);
sub process_credits($);
sub process_talk($);

sub process_talkWithDialog($$);
sub process_talkNoDialog($$);

use open qw/:std :utf8/;

@@ -45,10 +49,11 @@
process_varia "variatxt.txt.out";
process_mob "mob.txt.out";
process_credits "credits.txt.out";
process_talk "talktxt.txt.out";

exit;

sub process_inv {
sub process_inv($) {
my $file = shift;

open(*IN, $file) or die "Cannot open file $file: $!";
@@ -73,7 +78,7 @@ sub process_inv {
close IN;
}

sub process_varia {
sub process_varia($) {
my $file = shift;

open(*IN, $file) or die "Cannot open file $file: $!";
@@ -98,7 +103,7 @@ sub process_varia {
close IN;
}

sub process_mob {
sub process_mob($) {
my $file = shift;

open(*IN, $file) or die "Cannot open file $file: $!";
@@ -134,7 +139,7 @@ sub process_mob {
close IN;
}

sub process_credits {
sub process_credits($) {
my $file = shift;

open(*IN, $file) or die "Cannot open file $file: $!";
@@ -146,7 +151,7 @@ sub process_credits {
while (<IN>) {
chomp;

next if $_ eq 'credits.txt';
next if $_ eq 'credits.dat';

$line++;
$str .= "\"$_\\n\"\n";
@@ -180,3 +185,196 @@ sub process_credits {

close IN;
}

sub process_talk($) {
my $file = shift;

open(*IN, $file) or die "Cannot open file $file: $!";

my $n = 0;
my $dialog = 1;
my $str = "";

while (<IN>) {
chomp;

next if $_ eq 'talktxt.dat';

if ($_ eq "\@DIALOGBOX_LINES:") {
process_talkWithDialog($dialog, IN);
} elsif ($_ eq "\@NORMAL_LINES:") {
process_talkNoDialog($dialog, IN);
}

$dialog++;
}

close IN;
}


sub process_talkWithDialog($$) {
my $dialog = shift;
my $in = shift;

my $s;
my $line = 0;

while (<$in>) {
chomp;

if (/^#HERO$/) {
$s .= "HERO: ";
} elsif (/^#OTHER$/) {
$s .= "OTHER: ";
} elsif (/^#OTHER2$/) {
$s .= "OTHER2: ";
} elsif (/^#PAUSE$/) {
$s .= "P#";
} elsif (/^#BOX 0$/) {
$_ = <$in>; # skip #END
last; # Break
} else {
$line++;
$data{'talktxt.txt'}{$dialog}{$line} = "$s$_";
print <<EOF;
#: dialog$dialog.txt:$line
msgid "$s$_"
msgstr ""
EOF

$s = "";
}
}

my $box;

while (<$in>) {
chomp;

if (/^\@DIALOG_BOX (\d+)$/) {
$box = $1 + 1;
if ($box > 9) {
die "Too big DIALOG_BOX: $box";
}
next;
} elsif (/^\@DIALOG_OPT (\d+)$/) {
$box = $1;
$line = 0;
last;
} elsif (/^#END$/) {
next;
} elsif (/^\$(\d+)$/) {
$s = "$_: ";
$line = $1;
} else {
my $n = sprintf("%d%02d", $box, $line);
$data{'talktxt.txt'}{$dialog}{$n} = "$s$_";
print <<EOF;
#: dialog$dialog.txt:$n
msgid "$s$_"
msgstr ""
EOF

}
}

my $needPrint = 0;
my $snew;

while (<$in>) {
chomp;

if (/^#HERO$/) {
$snew = "HERO: ";
$needPrint = 1;
} elsif (/^#OTHER$/) {
$snew = "OTHER: ";
$needPrint = 1;
} elsif (/^#OTHER2$/) {
$snew = "OTHER2: ";
$needPrint = 1;
} elsif (/^#PAUSE$/) {
$s .= "#P";
} elsif (/^#ENABLE (\d+)$/) {
$s .= "#E$1"
} elsif (/^#DISABLE (\d+)$/) {
$s .= "#D$1"
} elsif (/^#BOX (\d+)$/) {
$s .= "#B$1"
} elsif (/^#EXIT (\d+)$/) {
$s .= "#X$1"
} elsif (/^#FLAG (\d+)$/) {
$s .= "#F$1"
} elsif (/^#END$/) {
$needPrint = 1;
$snew = "";

if ($line == 0) {
$line = 1; # Force print empty lines
}
} elsif (/^\@DIALOG_OPT (\d+)$/) {
$box = $1;
$line = 0;
} elsif (/^#ENDEND$/) {
last;
} else {
$line++;
$s .= $_;
}

if ($needPrint) {
my $n = sprintf("%d%02d", 1000 + $box, $line);

if ($line) {
$data{'talktxt.txt'}{$dialog}{$n} = "$s";
print <<EOF;
#: dialog$dialog.txt:$n
msgid "$s"
msgstr ""
EOF
}

$s = $snew;
$needPrint = 0;
}
}
}

sub process_talkNoDialog($$) {
my $dialog = shift;
my $in = shift;

my $s;
my $line = 0;

while (<$in>) {
chomp;

if (/^#HERO$/) {
$s .= "HERO: ";
} elsif (/^#OTHER$/) {
$s .= "OTHER: ";
} elsif (/^#OTHER2$/) {
$s .= "OTHER2: ";
} elsif (/^#PAUSE$/) {
$s .= "P#";
} elsif (/^#END$/) {
last; # Break
} else {
$line++;
$data{'talktxt.txt'}{$dialog}{$line} = "$s$_";
print <<EOF;
#: dialog$dialog.txt:$line
msgid "$s$_"
msgstr ""
EOF

$s = "";
}
}
}

No commit comments for this range

You can’t perform that action at this time.