Hooked up the pathfinder so that it seems to work. Animation opcode 0x12.
[scummvm-innocent.git] / tools / extract-words-tok.pl
blob53c7ae09a9c95a328aa007ad410c57aa22563de2
1 #!perl
3 # ScummVM - Scumm Interpreter
4 # Copyright (C) 2006 The ScummVM project
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 # $URL$
21 # $Id$
24 # This script extracts AGI words.tok file
26 # It produces one word per line. Multiword verbs get splitted
28 # Typical usage:
30 # for i in agigames/*/words.tok
31 # do
32 # tools/extract-words-tok.pl "$i"
33 # done | tools/construct-pred-dict.pl
36 local $/;
37 local $file = <>;
39 #$off = ord(substr($file, $i * 2, 1)) * 256 + ord(substr($file, $i * 2 + 1, 1));
40 #$offn = ord(substr($file, ($i + 1) * 2, 1)) * 256 + ord(substr($file, ($i + 1) * 2 + 1, 1));
42 $off = 52;
44 $word = "";
45 $mode = 0;
47 while ($off < length $file) {
48 $c = (ord(substr($file, $off, 1)));
49 if ($mode == 0) {
50 $word = substr $word, 0, $c;
51 $mode = 1;
52 $off++;
53 next;
56 $r = ($c & 0x7f) ^ 0x7f;
57 $word .= chr($r);
59 if ($c & 0x80) {
60 for $w (split ' ', $word) {
61 print "$w\n";
63 $off += 3;
64 $mode = 0;
65 next;
68 $off++;
71 for $w (split ' ', $word) {
72 print "$w\n";