aboutsummaryrefslogtreecommitdiff
path: root/devtools/create_supernova2
diff options
context:
space:
mode:
authorJaromir Wysoglad2019-07-01 23:25:17 +0200
committerThierry Crozat2019-07-28 15:09:14 +0100
commit7ea4d0359704998ebb7e8dbe1fbf4a838c902023 (patch)
tree7c4367df144f8b2ce58f93f347b01fd04a5a732f /devtools/create_supernova2
parent61975aa2e2cb8f432b58d7c1c4af6110fbf9d81d (diff)
downloadscummvm-rg350-7ea4d0359704998ebb7e8dbe1fbf4a838c902023.tar.gz
scummvm-rg350-7ea4d0359704998ebb7e8dbe1fbf4a838c902023.tar.bz2
scummvm-rg350-7ea4d0359704998ebb7e8dbe1fbf4a838c902023.zip
SUPERNOVA: Add size computation to create_image.
Diffstat (limited to 'devtools/create_supernova2')
-rw-r--r--devtools/create_supernova2/create_image/028/palette64
-rw-r--r--devtools/create_supernova2/create_image/create_image.cpp44
-rw-r--r--devtools/create_supernova2/ms2_data.015-enbin87123 -> 87123 bytes
-rw-r--r--devtools/create_supernova2/ms2_data.028-enbin64558 -> 64744 bytes
4 files changed, 97 insertions, 11 deletions
diff --git a/devtools/create_supernova2/create_image/028/palette b/devtools/create_supernova2/create_image/028/palette
index 18fcc1f6a3..bb77e05946 100644
--- a/devtools/create_supernova2/create_image/028/palette
+++ b/devtools/create_supernova2/create_image/028/palette
@@ -1,4 +1,4 @@
-177
+239
0 0 0
10 10 10
@@ -177,3 +177,65 @@
55 55 55
55 55 55
55 55 55
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
+0 0 0
diff --git a/devtools/create_supernova2/create_image/create_image.cpp b/devtools/create_supernova2/create_image/create_image.cpp
index 9600f0cd33..1bf1e24f7c 100644
--- a/devtools/create_supernova2/create_image/create_image.cpp
+++ b/devtools/create_supernova2/create_image/create_image.cpp
@@ -11,7 +11,7 @@ int writePalette(std::ofstream &output) {
std::string filename = filenumber + "/palette";
std::ifstream palette(filename.c_str());
if (!palette.is_open()) {
- std::cerr << "Couldn't open palette file";
+ std::cerr << "Couldn't open palette file" << std::endl;
return 1;
}
int input;
@@ -29,7 +29,7 @@ int writeSections(std::ofstream &output) {
std::string filename = filenumber + "/section_info";
std::ifstream sectionInfo(filename.c_str());
if (!sectionInfo.is_open()) {
- std::cerr << "Couldn't open section_info file";
+ std::cerr << "Couldn't open section_info file" << std::endl;
return 0;
}
int numSections;
@@ -72,7 +72,7 @@ int writeClickFields(std::ofstream &output) {
std::string filename = filenumber + "/clickfield_info";
std::ifstream clickFieldInfo(filename.c_str());
if (!clickFieldInfo.is_open()) {
- std::cerr << "Couldn't open clickfield_info file";
+ std::cerr << "Couldn't open clickfield_info file" << std::endl;
return 1;
}
int numClickFields;
@@ -109,8 +109,8 @@ int writePixelData(std::ofstream &output, int imageNum, int skip) {
fileName << filenumber << "/image" << imageNum << ".bmp";
std::ifstream image(fileName.str().c_str(), std::ios::binary);
if (!image.is_open()) {
- std::cerr << "Couldn't open " << fileName.str() << " file";
- return 1;
+ std::cerr << "Couldn't open " << fileName.str() << " file" << std::endl;
+ return 0;
}
image.seekg(0, image.end);
@@ -121,7 +121,7 @@ int writePixelData(std::ofstream &output, int imageNum, int skip) {
image.read(buf, length);
output.write(buf, length);
delete buf;
- return 0;
+ return length;
}
void printHelp() {
@@ -152,11 +152,11 @@ int main(int argc, char *argv[]) {
oFileName += "." + filenumber;
std::ofstream output(oFileName.c_str(), std::ios::binary);
if (!output.is_open()) {
- std::cerr << "Couldn't open output file";
+ std::cerr << "Couldn't open output file" << std::endl;
return 1;
}
// size
- // don't know how to determine that yet
+ // just a place holder, will be filled later
output << (char) 0x40;
output << (char) 0x70;
output << (char) 0x01;
@@ -171,8 +171,32 @@ int main(int argc, char *argv[]) {
// we don't compress the images, so set to 0
output << (char) 0; //numRepeat
output << (char) 0; //numZw
- for (int i = 0; i < numImages; i++)
- writePixelData(output, i, bytesSkip);
+ int totalLength = 0;
+ int oldLength = 0;
+ for (int i = 0; i < numImages; i++) {
+ totalLength += writePixelData(output, i, bytesSkip);
+ if (oldLength == totalLength) {
+ std::cerr << "Error while reading the image number: " << i << std::endl;
+ return 1;
+ }
+ oldLength = totalLength;
+ }
+
+ //reversing the size computation inside the engine
+ totalLength += 15;
+ totalLength /= 16;
+ totalLength -= 0x70;
+ int i = (totalLength & 0xf000) >> 12;
+ int j = totalLength << 4;
+ char *i_p = (char *) &i;
+ char *j_p = (char *) &j;
+
+ //writing the size
+ output.seekp(0);
+ output << j_p[0];
+ output << j_p[1];
+ output << i_p[0];
+ output << i_p[1];
output.close();
return 0;
}
diff --git a/devtools/create_supernova2/ms2_data.015-en b/devtools/create_supernova2/ms2_data.015-en
index d0994589bc..20ab5307db 100644
--- a/devtools/create_supernova2/ms2_data.015-en
+++ b/devtools/create_supernova2/ms2_data.015-en
Binary files differ
diff --git a/devtools/create_supernova2/ms2_data.028-en b/devtools/create_supernova2/ms2_data.028-en
index 5ac4feded4..88ab4c8ec1 100644
--- a/devtools/create_supernova2/ms2_data.028-en
+++ b/devtools/create_supernova2/ms2_data.028-en
Binary files differ