1 /* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 *
21 */
22
23 // Disable symbol overrides so that we can use system headers.
24 #define FORBIDDEN_SYMBOL_ALLOW_ALL
25
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include <string.h>
29 #include "cc.h"
30 #include "file.h"
31 #include "clouds.h"
32 #include "swords.h"
33 #include "constants.h"
34 #include "map.h"
35
36 #define VERSION_NUMBER 5
37
error(const char * s,...)38 void NORETURN_PRE error(const char *s, ...) {
39 va_list ap;
40
41 va_start(ap, s);
42 vfprintf(stderr, s, ap);
43 va_end(ap);
44
45 fputc('\n', stderr);
46
47 exit(1);
48 }
49
writeVersion(CCArchive & cc)50 static void writeVersion(CCArchive &cc) {
51 Common::MemFile f;
52 f.writeLong(VERSION_NUMBER);
53 cc.add("VERSION", f);
54 }
55
main(int argc,char * argv[])56 int main(int argc, char *argv[]) {
57 if (argc != 3) {
58 error("Format: %s dark.cc \"swords xeen.dat\"", argv[0]);
59 }
60
61 Common::File outputFile;
62 if (!outputFile.open("xeen.ccs", Common::kFileWriteMode)) {
63 error("Could not open input file");
64 }
65
66 CCArchive cc(outputFile, kWrite);
67 writeVersion(cc);
68 writeConstants(cc);
69 writeMap(cc);
70
71 const char *darkName = argv[1];
72 writeCloudsData(cc, darkName);
73
74 const char *swordsDatName = argv[2];
75 writeSwordsData(cc, swordsDatName);
76
77 cc.close();
78 return 0;
79 }
80