Debian Codegraph @

Data_Generators/misc/cpr2scr.pas

raw
1 program cpr2scr;
2 (********************************************************************
3 This program is free software: you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation, either version 3 of the License, or
6 (at your option) any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program. If not, see <https://www.gnu.org/licenses/>.
15
16 On Debian systems, the complete text of the GNU General Public
17 License, version 3, can be found in /usr/share/common-licenses/GPL-3.
18 ********************************************************************)
19
20 {*********************************************
21 Data Generator: converts Ironseed compressed .cpr format to Ironseed uncompressed .scr format
22
23 Copyright:
24 2020 Matija Nalis <[email protected]>
25 **********************************************}
26
27 uses data2;
28
29 var basename: String;
30
31 begin
32 basename := paramstr(1);
33 if basename = '' then
34 begin
35 writeln ('Usage: cpr2scr <BASENAME>');
36 writeln (' opens compressed BASENAME.cpr and creates uncompressed BASENAME.scr and BASENAME.pal, on which scr2ppm.pl can be used');
37 errorhandler('Wrong cmdline usage',6)
38 end;
39
40 fillchar(screen,sizeof(screen),0);
41
42 writeln ('Loading compressed file ', basename, '.cpr');
43 loadscreen(basename, @screen);
44
45 if has_pal
46 then
47 begin
48 writeln ('Saving uncompressed files ', basename, '.scr and ', basename, '.pal');
49 quicksavescreen (basename, @screen, true);
50 end
51 else
52 begin
53 writeln ('Saving uncompressed file ', basename, '.scr');
54 quicksavescreen (basename, @screen, false);
55 end;
56
57 writeln ('Done!');
58 end.