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 "util.h"
27 #include "create_cryomni3d_dat.h"
28
29 #include "versailles.h"
30
writeVersaillesSubtitleEntry(FILE * fp,const SubtitleEntry & entry)31 size_t writeVersaillesSubtitleEntry(FILE *fp, const SubtitleEntry &entry) {
32 size_t size = 0;
33
34 size += writeUint32LE(fp, entry.frameStart);
35 size += writeString16(fp, entry.text);
36
37 return size;
38 }
39
writeVersaillesSubtitle(FILE * fp,Subtitle const & subtitle)40 size_t writeVersaillesSubtitle(FILE *fp, Subtitle const &subtitle) {
41 size_t size = 0;
42
43 size += writeString16(fp, subtitle.videoName);
44
45 size_t count = 0;
46 for (; count < ARRAYSIZE(subtitle.entries) &&
47 (subtitle.entries[count].text != nullptr ||
48 subtitle.entries[count].frameStart != 0); count++) { }
49
50 size += writeArray<SubtitleEntry, writeVersaillesSubtitleEntry, uint16, writeUint16LE>(fp,
51 subtitle.entries, count);
52
53 return size;
54 }
55
writeVersaillesSubtitles16(FILE * fp,Subtitle const * subtitles,uint16 elems)56 size_t writeVersaillesSubtitles16(FILE *fp, Subtitle const *subtitles, uint16 elems) {
57 return writeArray<Subtitle, writeVersaillesSubtitle, uint16, writeUint16LE>(fp, subtitles, elems);
58 }
59
60 // In Versailles platform doesn't seem to change anything
61 #define DEFINE_FUNCS(lang) \
62 size_t writeVersailles_ALL_ ## lang ## _Header(FILE *f, uint32 offset, uint32 size) { \
63 return writeGameHeader(f, VERSAILLES_GAMEID, VERSAILLES_VERSION, LANG_ ## lang, PLATFORM_ALL, \
64 offset, size); \
65 } \
66 \
67 size_t writeVersailles_ALL_ ## lang ## _Data(FILE *f) { \
68 size_t size = 0; \
69 \
70 assert(VERSAILLES_LOCALIZED_FILENAMES_COUNT == ARRAYSIZE(versailles ## lang ## localizedFilenames)); \
71 size += writeString16Array16(f, versailles ## lang ## localizedFilenames, \
72 VERSAILLES_LOCALIZED_FILENAMES_COUNT); \
73 \
74 size += writeString16(f, versailles ## lang ## EpilMsg); \
75 size += writeString16(f, versailles ## lang ## EpilPwd); \
76 \
77 size += writeString16(f, versailles ## lang ## BombPwd); \
78 \
79 assert(VERSAILLES_MESSAGES_COUNT == ARRAYSIZE(versailles ## lang ## messages)); \
80 size += writeString16Array16(f, versailles ## lang ## messages, ARRAYSIZE(versailles ## lang ## messages)); \
81 \
82 assert(VERSAILLES_PAINTINGS_COUNT == ARRAYSIZE(versailles ## lang ## paintings)); \
83 size += writeString16Array16(f, versailles ## lang ## paintings, ARRAYSIZE(versailles ## lang ## paintings)); \
84 \
85 size += writePadding(f); \
86 return size; \
87 }
88
89 #define DEFINE_FUNCS_CJK(lang) \
90 size_t writeVersailles_ALL_ ## lang ## _Header(FILE *f, uint32 offset, uint32 size) { \
91 return writeGameHeader(f, VERSAILLES_GAMEID, VERSAILLES_VERSION, LANG_ ## lang, PLATFORM_ALL, \
92 offset, size); \
93 } \
94 \
95 size_t writeVersailles_ALL_ ## lang ## _Data(FILE *f) { \
96 size_t size = 0; \
97 \
98 assert(VERSAILLES_LOCALIZED_FILENAMES_COUNT == ARRAYSIZE(versailles ## lang ## localizedFilenames)); \
99 size += writeString16Array16(f, versailles ## lang ## localizedFilenames, \
100 VERSAILLES_LOCALIZED_FILENAMES_COUNT); \
101 \
102 size += writeString16(f, versailles ## lang ## EpilMsg); \
103 size += writeString16(f, versailles ## lang ## EpilPwd); \
104 \
105 if ((LANG_ ## lang == LANG_JA)) { \
106 assert(VERSAILLES_JA_BOMB_ALPHABET_SIZE + 1 == sizeof(versaillesJABombAlphabet)); \
107 size += writeString16(f, versaillesJABombAlphabet); \
108 } \
109 size += writeString16(f, versailles ## lang ## BombPwd); \
110 \
111 assert(VERSAILLES_MESSAGES_COUNT_CJK == ARRAYSIZE(versailles ## lang ## messages)); \
112 size += writeString16Array16(f, versailles ## lang ## messages, ARRAYSIZE(versailles ## lang ## messages)); \
113 \
114 assert(VERSAILLES_PAINTINGS_COUNT == ARRAYSIZE(versailles ## lang ## paintings)); \
115 size += writeString16Array16(f, versailles ## lang ## paintings, ARRAYSIZE(versailles ## lang ## paintings)); \
116 \
117 /* No need to assert as we don't expect a fixed count in engine */ \
118 size += writeVersaillesSubtitles16(f, versailles ## lang ## subtitles, ARRAYSIZE(versailles ## lang ## subtitles)); \
119 \
120 size += writePadding(f); \
121 return size; \
122 }
123
124 DEFINE_FUNCS(FR)
125 DEFINE_FUNCS(BR)
126 DEFINE_FUNCS(DE)
127 DEFINE_FUNCS(EN)
128 DEFINE_FUNCS(ES)
129 DEFINE_FUNCS(IT)
130 DEFINE_FUNCS_CJK(JA)
131 DEFINE_FUNCS_CJK(KO)
132 DEFINE_FUNCS_CJK(ZT)
133