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
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
/*
* This code is based on the original source code of Lord Avalot d'Argent version 1.3.
* Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman.
*/
namespace Avalanche {
enum flavourtype {ch_ega, ch_bgi, last_flavourtype};
struct chunkblocktype {
flavourtype flavour;
integer x, y;
integer xl, yl;
longint size;
boolean natural;
boolean memorise; /* Hold it in memory? */
};
untyped_file f;
string fn;
byte num_chunks, fv;
longint offset;
chunkblocktype ch;
int main(int argc, const char *argv[]) {
pio_initialize(argc, argv);
output << NL;
output << "CHUNKER 12/3/1995 TT" << NL;
output << NL;
if (paramcount != 1) {
output << "which chunk file?" << NL;
exit(0);
}
fn = paramstr(1);
assign(f, fn);
reset(f, 1);
output << "----- In chunk file " << fn << ", there are: -----" << NL;
seek(f, 44);
blockread(f, num_chunks, 1);
output << format(num_chunks, 4) << " chunks:" << NL;
output << " No Hdr Offset Flvr Mem Nat X Y Width Height Size of image" << NL;
for (fv = 1; fv <= num_chunks; fv ++) {
output << "Ch" << format(fv, 2) << ':';
seek(f, 41 + fv * 4);
output << format(41 + fv * 4, 4);
blockread(f, offset, 4);
output << format(offset, 10);
seek(f, offset);
blockread(f, ch, sizeof(ch));
{
if (ch.flavour == ch_bgi)
output << " ch_BGI";
else
output << " ch_EGA";
if (ch.memorise)
output << " yes";
else
output << " no ";
if (ch.natural)
output << " yes";
else
output << " no ";
output << format(ch.x, 7) << format(ch.y, 7) << format(ch.xl, 7) << format(ch.yl, 7) << format(ch.size, 10);
}
output << NL;
}
output << "---ENDS---" << NL;
close(f);
return EXIT_SUCCESS;
}
} // End of namespace Avalanche.
|