| 1 |
program scr2cpr; |
| 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 uncompressed .scr format to Ironseed compressed .cpr format |
| 22 |
|
| 23 |
Copyright: |
| 24 |
2020 Matija Nalis <[email protected]> |
| 25 |
**********************************************} |
| 26 |
|
| 27 |
uses data2, sysutils; |
| 28 |
|
| 29 |
var basename, s: String; |
| 30 |
flags: byte; |
| 31 |
w,h: word; |
| 32 |
|
| 33 |
begin |
| 34 |
basename := paramstr(1); |
| 35 |
if basename = '' then |
| 36 |
begin |
| 37 |
writeln ('Usage: scr2cpr <BASENAME> [flags] [width height]'); |
| 38 |
writeln (' opens uncompressed BASENAME.scr and BASENAME.pal, and creates compressed BASENAME.cpr'); |
| 39 |
writeln (' default flags=1 include PAL in SCR, flags=0 does not.'); |
| 40 |
errorhandler('Wrong cmdline usage',6) |
| 41 |
end; |
| 42 |
|
| 43 |
flags := 1; |
| 44 |
w := 320; |
| 45 |
h := 200; |
| 46 |
|
| 47 |
if paramcount > 1 then |
| 48 |
begin |
| 49 |
s := paramstr(2); |
| 50 |
flags := StrToInt(s); |
| 51 |
end; |
| 52 |
|
| 53 |
if paramcount > 2 then |
| 54 |
begin |
| 55 |
s := paramstr(3); |
| 56 |
w := StrToInt(s); |
| 57 |
s := paramstr(4); |
| 58 |
h := StrToInt(s); |
| 59 |
end; |
| 60 |
|
| 61 |
fillchar(screen,sizeof(screen),0); |
| 62 |
|
| 63 |
(* if flags and 1>0 then |
| 64 |
begin // has embedded palette *) |
| 65 |
writeln ('Loading uncompressed files ', basename, '.scr and ', basename, '.pal'); |
| 66 |
quickloadscreen(basename, @screen, true); |
| 67 |
(* end |
| 68 |
else |
| 69 |
begin // no palette |
| 70 |
writeln ('Loading uncompressed file ', basename, '.scr'); |
| 71 |
quickloadscreen(basename, @screen, false); |
| 72 |
end; |
| 73 |
*) |
| 74 |
|
| 75 |
writeln ('Saving compressed file ', basename, '.cpr with flags=', flags,' w=',w,' h=',h); |
| 76 |
compressfile (basename, @screen,w,h,flags); |
| 77 |
|
| 78 |
writeln ('Done!'); |
| 79 |
end. |