1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612
|
#!/usr/bin/perl
#
# This tools is kind of a hack to be able to maintain the credits list of
# ScummVM in a single central location. We then generate the various versions
# of the credits in other places from this source. In particular:
# - The AUTHORS file
# - The gui/credits.h header file
# - The Credits.rtf file used by the Mac OS X port
# - The credits.xml file, part of the DocBook manual
# - Finally, credits.xml, for use on the website (different format than the DocBook one)
#
# Initial version written by Fingolfin in December 2004.
#
use strict;
use Text::Wrap;
if ($Text::Wrap::VERSION < 2001.0929) {
die "Text::Wrap version >= 2001.0929 is required. You have $Text::Wrap::VERSION\n";
}
my $mode = "";
my $max_name_width;
# Count the level in the section hierarchy, i.e. how deep we are currently nested
# in terms of 'sections'.
my $section_level = 0;
# Count how many sections there have been on this level already
my @section_count = ( 0, 0, 0 );
if ($#ARGV >= 0) {
$mode = "TEXT" if ($ARGV[0] eq "--text"); # AUTHORS file
$mode = "XML-WEB" if ($ARGV[0] eq "--xml-website"); # credits.xml (for use on the website)
$mode = "CPP" if ($ARGV[0] eq "--cpp"); # credits.h (for use by about.cpp)
$mode = "XML-DOC" if ($ARGV[0] eq "--xml-docbook"); # credits.xml (DocBook)
$mode = "RTF" if ($ARGV[0] eq "--rtf"); # Credits.rtf (Mac OS X About box)
}
if ($mode eq "") {
print STDERR "Usage: $0 [--text | --xml-website | --cpp | --xml-docbook | --rtf]\n";
print STDERR " Just pass --text / --xml-website / --cpp / --xml-docbook / --rtf as parameter, and credits.pl\n";
print STDERR " will print out the corresponding version of the credits to stdout.\n";
exit 1;
}
$Text::Wrap::unexpand = 0;
if ($mode eq "TEXT") {
$Text::Wrap::columns = 78;
$max_name_width = 28; # The maximal width of a name.
} elsif ($mode eq "CPP") {
$Text::Wrap::columns = 48; # Approx.
}
# Convert HTML entities to ASCII for the plain text mode
sub html_entities_to_ascii {
my $text = shift;
# For now we hardcode these mappings
# á -> a
# é -> e
# í -> i
# ì -> i
# ó -> o
# ø -> o
# ö -> o / oe
# ä -> a
# ë -> e
# ü -> ue
# å -> aa
# & -> &
# ł -> l
# ś -> s
# Š -> S
# ñ -> n
$text =~ s/á/a/g;
$text =~ s/é/e/g;
$text =~ s/í/i/g;
$text =~ s/ì/i/g;
$text =~ s/ó/o/g;
$text =~ s/ø/o/g;
$text =~ s/ł/l/g;
$text =~ s/ś/s/g;
$text =~ s/Š/S/g;
$text =~ s/å/aa/g;
$text =~ s/ñ/n/g;
$text =~ s/ä/a/g;
$text =~ s/ë/e/g;
$text =~ s/ü/ue/g;
# HACK: Torbj*o*rn but G*oe*ffringmann and R*oe*ver and J*oe*rg
$text =~ s/Torbjörn/Torbjorn/g;
$text =~ s/ö/oe/g;
$text =~ s/&/&/g;
return $text;
}
# Convert HTML entities to C++ characters
sub html_entities_to_cpp {
my $text = shift;
# The numerical values are octal!
$text =~ s/á/\\341/g;
$text =~ s/é/\\351/g;
$text =~ s/í/\\355/g;
$text =~ s/ì/\\354/g;
$text =~ s/ó/\\363/g;
$text =~ s/ø/\\370/g;
$text =~ s/ł/l/g;
$text =~ s/ś/s/g;
$text =~ s/Š/S/g;
$text =~ s/å/\\345/g;
$text =~ s/ñ/\\361/g;
$text =~ s/ä/\\344/g;
$text =~ s/ë/\\353/g;
$text =~ s/ö/\\366/g;
$text =~ s/ü/\\374/g;
$text =~ s/&/&/g;
return $text;
}
# Convert HTML entities to RTF codes
# This is using the Mac OS Roman encoding
sub html_entities_to_rtf {
my $text = shift;
$text =~ s/á/\\'87/g;
$text =~ s/é/\\'8e/g;
$text =~ s/í/\\'92/g;
$text =~ s/ì/\\'93/g;
$text =~ s/ó/\\'97/g;
$text =~ s/ø/\\'bf/g;
$text =~ s/å/\\'8c/g;
# The following numerical values are octal!
$text =~ s/ł/\\uc0\\u322 /g;
$text =~ s/Š/\\uc0\\u540 /g;
# Back to hex numbers
$text =~ s/ñ/\\'96/g;
$text =~ s/ä/\\'8a/g;
$text =~ s/ë/\\'eb/g;
$text =~ s/ö/\\'9a/g;
$text =~ s/ü/\\'9f/g;
$text =~ s/&/&/g;
return $text;
}
# Convert HTML entities to TeX codes
sub html_entities_to_tex {
my $text = shift;
$text =~ s/á/\\'a/g;
$text =~ s/é/\\'e/g;
$text =~ s/í/\\'i/g;
$text =~ s/ì/\\`\\i/g;
$text =~ s/ó/\\'o/g;
$text =~ s/ø/{\\o}/g;
$text =~ s/å/\\aa /g;
$text =~ s/ł/{\\l}/g;
$text =~ s/Š/{\\v S}/g;
$text =~ s/ñ/\\˜n/g;
$text =~ s/ä/\\"a/g;
$text =~ s/ö/\\"o/g;
$text =~ s/ë/\\"e/g;
$text =~ s/ü/\\"u/g;
$text =~ s/&/\\&/g;
return $text;
}
#
# Small reference of the RTF commands used here:
#
# \fs28 switches to 14 point font (28 = 2 * 14)
# \pard reset to default paragraph properties
#
# \ql left-aligned text
# \qr right-aligned text
# \qc centered text
# \qj justified text
#
# \b turn on bold
# \b0 turn off bold
#
# For more information: <http://latex2rtf.sourceforge.net/rtfspec.html>
#
sub begin_credits {
my $title = shift;
if ($mode eq "TEXT") {
#print html_entities_to_ascii($title)."\n";
} elsif ($mode eq "RTF") {
print '{\rtf1\mac\ansicpg10000' . "\n";
print '{\fonttbl\f0\fswiss\fcharset77 Helvetica-Bold;\f1\fswiss\fcharset77 Helvetica;}' . "\n";
print '{\colortbl;\red255\green255\blue255;\red0\green128\blue0;\red128\green128\blue128;}' . "\n";
print '\vieww6920\viewh15480\viewkind0' . "\n";
print "\n";
} elsif ($mode eq "CPP") {
print "// This file was generated by credits.pl. Do not edit by hand!\n";
print "static const char *credits[] = {\n";
} elsif ($mode eq "XML-DOC") {
print "<?xml version='1.0'?>\n";
print "<!-- This file was generated by credits.pl. Do not edit by hand! -->\n";
print "<!DOCTYPE appendix PUBLIC '-//OASIS//DTD DocBook XML V4.2//EN'\n";
print " 'http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd'>\n";
print "<appendix id='credits'>\n";
print " <title>" . $title . "</title>\n";
print " <informaltable frame='none'>\n";
print " <tgroup cols='3' align='left' colsep='0' rowsep='0'>\n";
print " <colspec colname='start' colwidth='0.5cm'/>\n";
print " <colspec colname='name' colwidth='4cm'/>\n";
print " <colspec colname='job'/>\n";
print " <tbody>\n";
} elsif ($mode eq "XML-WEB") {
print "<?xml version='1.0'?>\n";
print "<!-- This file was generated by credits.pl. Do not edit by hand! -->\n";
print "<credits>\n";
}
}
sub end_credits {
if ($mode eq "TEXT") {
} elsif ($mode eq "RTF") {
print "}\n";
} elsif ($mode eq "CPP") {
print "};\n";
} elsif ($mode eq "XML-DOC") {
print " </tbody>\n";
print " </tgroup>\n";
print " </informaltable>\n";
print "</appendix>\n";
} elsif ($mode eq "XML-WEB") {
print "</credits>\n";
}
}
sub begin_section {
my $title = shift;
if ($mode eq "TEXT") {
$title = html_entities_to_ascii($title);
if ($section_level >= 2) {
$title .= ":"
}
print " " x $section_level . $title."\n";
if ($section_level eq 0) {
print " " x $section_level . "*" x (length $title)."\n";
} elsif ($section_level eq 1) {
print " " x $section_level . "-" x (length $title)."\n";
}
} elsif ($mode eq "RTF") {
$title = html_entities_to_rtf($title);
# Center text
print '\pard\qc' . "\n";
print '\f0\b';
if ($section_level eq 0) {
print '\fs40 ';
} elsif ($section_level eq 1) {
print '\fs32 ';
}
# Insert an empty line before this section header, *unless*
# this is the very first section header in the file.
if ($section_level > 0 || @section_count[0] > 0) {
print "\\\n";
}
print '\cf2 ' . $title . "\n";
print '\f1\b0\fs24 \cf0 \\' . "\n";
} elsif ($mode eq "CPP") {
if ($section_level eq 0) {
# TODO: Would be nice to have a 'fat' or 'large' mode for
# headlines...
my $ascii_title = html_entities_to_ascii($title);
$title = html_entities_to_cpp($title);
if ($ascii_title ne $title) {
print '"A1""'.$ascii_title.'",' . "\n";
}
print '"C1""'.$title.'",' . "\n";
print '"",' . "\n";
} else {
my $ascii_title = html_entities_to_ascii($title);
$title = html_entities_to_cpp($title);
if ($ascii_title ne $title) {
print '"A1""'.$ascii_title.'",' . "\n";
}
print '"C1""'.$title.'",' . "\n";
}
} elsif ($mode eq "XML-DOC") {
print " <row><entry namest='start' nameend='job'>";
print "<emphasis role='bold'>" . $title . ":</emphasis>";
print "</entry></row>\n";
} elsif ($mode eq "XML-WEB") {
if ($section_level eq 0) {
print "\t<section>\n";
print "\t\t<title>" . $title . "</title>\n";
} elsif ($section_level eq 1) {
print "\t\t<subsection>\n";
print "\t\t\t<title>" . $title . "</title>\n";
} else {
#print "\t\t\t<group>" . $title . "</group>\n";
#print "\t\t\t\t<name>" . $title . "</name>\n";
}
}
# Implicit start of person list on section level 2
if ($section_level >= 2) {
begin_persons($title);
}
@section_count[$section_level]++;
$section_level++;
@section_count[$section_level] = 0;
}
sub end_section {
$section_level--;
# Implicit end of person list on section level 2
if ($section_level >= 2) {
end_persons();
}
if ($mode eq "TEXT") {
# nothing
} elsif ($mode eq "RTF") {
# nothing
} elsif ($mode eq "CPP") {
print '"",' . "\n";
} elsif ($mode eq "XML-DOC") {
print " <row><entry namest='start' nameend='job'> </entry></row>\n\n";
} elsif ($mode eq "XML-WEB") {
if ($section_level eq 0) {
print "\t</section>\n";
} elsif ($section_level eq 1) {
print "\t\t</subsection>\n";
} else {
#print "\t\t\t</group>\n";
}
}
}
sub begin_persons {
my $title = shift;
if ($mode eq "XML-WEB") {
print "\t\t\t<group>\n";
print "\t\t\t\t<name>" . $title . "</name>\n";
#print "\t\t\t\t<persons>\n";
}
}
sub end_persons {
if ($mode eq "TEXT") {
print "\n";
} elsif ($mode eq "RTF") {
# nothing
} elsif ($mode eq "XML-WEB") {
#print "\t\t\t\t</persons>\n";
print "\t\t\t</group>\n";
}
}
sub add_person {
my $name = shift;
my $nick = shift;
my $desc = shift;
my $tab;
if ($mode eq "TEXT") {
my $min_name_width = length $desc > 0 ? $max_name_width : 0;
$name = $nick if $name eq "";
$name = html_entities_to_ascii($name);
if (length $name > $max_name_width) {
print STDERR "Warning: max_name_width is too small (" . $max_name_width . " < " . (length $name) . " for \"" . $name. "\")\n";
}
$desc = html_entities_to_ascii($desc);
$tab = " " x ($section_level * 2 + 1);
printf $tab."%-".$min_name_width.".".$max_name_width."s", $name;
# Print desc wrapped
if (length $desc > 0) {
my $inner_indent = ($section_level * 2 + 1) + $max_name_width + 3;
my $multitab = " " x $inner_indent;
print " - " . substr(wrap($multitab, $multitab, $desc), $inner_indent);
}
print "\n";
} elsif ($mode eq "RTF") {
$name = $nick if $name eq "";
$name = html_entities_to_rtf($name);
# Center text
print '\pard\qc' . "\n";
# Activate 1.5 line spacing mode
print '\sl360\slmult1';
# The name
print $name . "\\\n";
# Description using italics
if (length $desc > 0) {
$desc = html_entities_to_rtf($desc);
print '\pard\qc' . "\n";
print "\\cf3\\i " . $desc . "\\i0\\cf0\\\n";
}
} elsif ($mode eq "CPP") {
$name = $nick if $name eq "";
my $ascii_name = html_entities_to_ascii($name);
$name = html_entities_to_cpp($name);
if ($ascii_name ne $name) {
print '"A0""'.$ascii_name.'",' . "\n";
}
print '"C0""'.$name.'",' . "\n";
# Print desc wrapped
if (length $desc > 0) {
my $ascii_desc = html_entities_to_ascii($desc);
$desc = html_entities_to_cpp($desc);
if ($ascii_desc ne $desc) {
print '"A2""'.$ascii_desc.'",' . "\n";
}
print '"C2""'.$desc.'",' . "\n";
}
} elsif ($mode eq "XML-DOC") {
$name = $nick if $name eq "";
print " <row><entry namest='name'>" . $name . "</entry>";
print "<entry>" . $desc . "</entry></row>\n";
} elsif ($mode eq "XML-WEB") {
$name = "???" if $name eq "";
print "\t\t\t\t<person>\n";
print "\t\t\t\t\t<name>" . $name . "</name>\n";
print "\t\t\t\t\t<alias>" . $nick . "</alias>\n";
print "\t\t\t\t\t<description>" . $desc . "</description>\n";
print "\t\t\t\t</person>\n";
}
}
sub add_paragraph {
my $text = shift;
my $tab;
if ($mode eq "TEXT") {
$tab = " " x ($section_level * 2 + 1);
print wrap($tab, $tab, html_entities_to_ascii($text))."\n";
print "\n";
} elsif ($mode eq "RTF") {
$text = html_entities_to_rtf($text);
# Center text
print '\pard\qc' . "\n";
print "\\\n";
print $text . "\\\n";
} elsif ($mode eq "CPP") {
$text = html_entities_to_ascii($text);
my $line_start = '"C0""';
my $line_end = '",';
print $line_start . $text . $line_end . "\n";
print $line_start . $line_end . "\n";
} elsif ($mode eq "XML-DOC") {
print " <row><entry namest='start' nameend='job'>" . $text . "</entry></row>\n";
print " <row><entry namest='start' nameend='job'> </entry></row>\n\n";
} elsif ($mode eq "XML-WEB") {
print "\t\t<paragraph>" . $text . "</paragraph>\n";
}
}
#
# Now follows the actual credits data! The format should be clear, I hope.
# Note that people are sorted by their last name in most cases; in the
# 'Team' section, they are first grouped by category (Engine; porter; misc).
#
begin_credits("Credits");
begin_section("ResidualVM");
begin_section("Project Leaders");
begin_persons();
add_person("Paweł Kołodziejski", "aquadran", "");
add_person("Einar Johan T. Sømåen", "somaen", "");
end_persons();
end_section();
begin_section("Teams");
begin_section("Grim Team");
add_person("James Brown", "ender", "Grim developer (retired)");
add_person("Giulio Camuffo", "giucam", "Grim developer");
add_person("Dries Harnie", "Botje", "EMI, Android, OpenGL ES developer");
add_person("Paweł Kołodziejski", "aquadran", "Core developer (suspended)");
add_person("Christian Krause", "chkr", "EMI developer");
add_person("Einar Johan T. Sømåen", "somaen", "Grim, EMI developer");
add_person("Joel Teichroeb ", "klusark", "EMI, Android developer");
add_person("Joni Vähämäki", "Akz", "EMI developer");
end_section();
begin_section("Myst 3 Team");
add_person("Bastien Bouclet", "bgK", "Core developer");
end_section();
begin_section("Stark Team");
add_person("Bastien Bouclet", "bgK", "Core developer");
add_person("Einar Johan T. Sømåen", "somaen", "Core developer (retired)");
end_section();
end_section();
begin_section("Contributors");
add_paragraph(
"If you have contributed to this engine then you deserve to be on this ".
"list. Contact us and we'll add you.");
begin_section("Grim");
add_person("Thomas Allen", "olldray", "Various engine code fixes and improvements");
add_person("Torbjörn Andersson", "eriktorbjorn", "Various code fixes");
add_person("Ori Avtalion", "salty-horse", "Lipsync, LAF support, various code fixes");
add_person("Robert Biro", "DarthJDG", "Antialiasing support");
add_person("Bastien Bouclet", "bgK", "Various fixes to engine");
add_person("David Cardwell", "d356", "Few fixes to EMI");
add_person("Marcus Comstedt", "marcus_c", "Initial Dreamcast port");
add_person("Andrea Corna", "Yak Bizzarro", "Patcher module, various engine improvements");
add_person("Jonathan Gray", "khalek", "Various code fixes");
add_person("Tobias Gunkel", "tobigun", "Initial Android port, few engines fixes");
add_person("Azamat H. Hackimov", "winterheart", "Configure fix");
add_person("Vincent Hamm", "yazoo", "Various engine code fixes and improvements");
add_person("Sven Hesse", "DrMcCoy", "Various compilation fixes");
add_person("Matthew Hoops", "clone2727", "Smush codec48, Grim and EMI engine improvements");
add_person("Erich Hoover", "Compholio", "x86-64 fixes, various code fixes and improvements");
add_person("Max Horn", "fingolfin", "Few code fixes");
add_person("Travis Howell", "Kirben", "Various code fixes, Windows port");
add_person("Joseph Jezak", "JoseJX", "A lot of engine improvements and fixes");
add_person("Guillem Jover", "guillemj", "Few code improvements");
add_person("Filippos Karapetis", "bluegr", "Compilation fixes");
add_person("Ingo van Lil", "inguin", "Various fixes and improvements for EMI");
add_person("Vincent Pelletier", "vpelletier", "Various engine improvements and code fixes");
add_person("Joost Peters", "joostp", "Various code fixes");
add_person("George Macon", "gmacon", "Few fixes");
add_person("Josh Matthews", "jdm", "Few fixes to engine");
add_person("Matthieu Milan", "usineur", "Various engine improvements");
add_person("Gregory Montoir", "cyx", "Few fixes to engine");
add_person("Stefano Musumeci", "subr3v", "TinyGL backend and engine driver improvements");
add_person("Christian Neumair", "mannythegnome", "Various optimisation patches");
add_person("Daniel Schepler", "", "Initial grim engine contributor, LUA support");
add_person("Dmitry Smirnov", "onlyjob", "Minor spelling corrections");
add_person("Yaron Tausky", "yaront", "Fixes to subtitles");
add_person("Julien Templier", "Littleboy", "create_project tool");
add_person("Pino Toscano", "pinotree", "Debian GNU/Linux package files");
add_person("Lionel Ulmer", "bbrox", "OpenGL optimisations");
add_person("", "cmayer0087", "Various engine code fixes");
add_person("", "JenniBee", "Compilation fixes");
add_person("", "karjonas", "Various engine code fixes");
add_person("", "PoulpiFr", "Few fixes to Android port");
add_person("", "sietschie", "Few fixes to engine");
end_section();
begin_section("Myst 3");
add_person("Matthew Hoops", "clone2727", "Various engine improvements and code fixes");
add_person("Stefano Musumeci", "subr3v", "TinyGL engine driver support");
end_section();
begin_section("Stark");
add_person("Matthew Hoops", "clone2727", "ADPCM decoder");
add_person("Paweł Kołodziejski", "aquadran", "Various engine code fixes");
add_person("Vincent Pelletier", "vpelletier", "Raw sound support");
add_person("Jordi Vilalta Prat", "jvprat", "Initial engine contributor");
add_person("Scott Thomas", "ST", "Initial engine author");
end_section();
end_section();
end_section();
begin_section("ScummVM code");
add_paragraph(
"ResidualVM uses a lot of ScummVM code. ".
"For a list of authors look into COPYRIGHT file.");
end_section();
begin_section("Website code");
begin_persons();
add_person("Fredrik Wendel", "", "");
end_persons();
end_section();
# HACK!
$max_name_width = 16;
begin_section("Special thanks to");
add_paragraph(
"The LUA developers, for creating a nice compact script interpreter.");
add_paragraph(
"Tim Schafer, for obvious reasons, and everybody else who helped make ".
"Grim Fandango a brilliant game; and the EMI team for giving it their ".
"best try.");
add_paragraph(
"Bret Mogilefsky, for managing to create a SPUTM-style 3D LUA engine, ".
"and avoiding the horrible hack it could have been.");
add_paragraph(
"Benjamin Haisch, for emimeshviewer, which our EMI code borrows heavily from.");
end_section();
end_credits();
|