From 29616127b32d833c7c413cfc979f2c523def1e11 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 10 Feb 2017 02:50:55 +0200 Subject: CRYO: Rename create_led_dat to create_cryo_dat --- devtools/create_cryo/create_cryo_dat.cpp | 110 +++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 devtools/create_cryo/create_cryo_dat.cpp (limited to 'devtools/create_cryo/create_cryo_dat.cpp') diff --git a/devtools/create_cryo/create_cryo_dat.cpp b/devtools/create_cryo/create_cryo_dat.cpp new file mode 100644 index 0000000000..794dee3e32 --- /dev/null +++ b/devtools/create_cryo/create_cryo_dat.cpp @@ -0,0 +1,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. + * + */ + +#include + +#include "eden.h" +#include "eden_icons.h" +#include "eden_rooms.h" + +#define CRYO_DAT_VER 1 // 1 byte + +template +static void writeLE(FILE *f, T value) { + for (int i = 0; i < sizeof(value); i++, value >>= 8) { + unsigned char b = value & 0xFF; + fwrite(&b, 1, 1, f); + } +} + +struct _icon_t : icon_t { + void write(FILE *f) { + writeLE(f, sx); + writeLE(f, sy); + writeLE(f, ex); + writeLE(f, ey); + writeLE(f, cursor_id); + writeLE(f, action_id); + writeLE(f, object_id); + } +}; + +static void emitIcons(FILE *f) { + _icon_t *icons = (_icon_t*)gameIcons; + for (int i = 0; i < kNumIcons; i++) + icons[i].write(f); +} + +struct _room_t : room_t { + void write(FILE *f) { + writeLE(f, ff_0); + writeLE(f, exits[0]); + writeLE(f, exits[1]); + writeLE(f, exits[2]); + writeLE(f, exits[3]); + writeLE(f, flags); + writeLE(f, bank); + writeLE(f, party); + writeLE(f, level); + writeLE(f, video); + writeLE(f, location); + writeLE(f, background); + } +}; + +static void emitRooms(FILE *f) { + _room_t *rooms = (_room_t*)gameRooms; + for (int i = 0; i < kNumRooms; i++) + rooms[i].write(f); +} + +static int emitData(char *outputFilename) { + FILE *f = fopen(outputFilename, "w+b"); + if (!f) { + printf("ERROR: Unable to create output file %s\n", outputFilename); + return 1; + } + + printf("Generating %s...\n", outputFilename); + + fwrite("CRYODATA", 8, 1, f); + writeLE(f, CRYO_DAT_VER); + + emitIcons(f); + emitRooms(f); + + fclose(f); + + printf("Done!\n"); + + return 0; +} + +int main(int argc, char **argv) { + + if (argc > 1) + return emitData(argv[1]); + else + printf("Usage: %s \n", argv[0]); + + return 0; +} -- cgit v1.2.3 From 8ed8b3225f2fa521f795aeb1cbf765263c99c7f1 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 10 Feb 2017 11:41:50 +0200 Subject: CRYO: Move all static data for Lost Eden to cryo.dat (1/2) --- devtools/create_cryo/create_cryo_dat.cpp | 106 ++++++++++++++++++++++++++++++- 1 file changed, 105 insertions(+), 1 deletion(-) (limited to 'devtools/create_cryo/create_cryo_dat.cpp') diff --git a/devtools/create_cryo/create_cryo_dat.cpp b/devtools/create_cryo/create_cryo_dat.cpp index 794dee3e32..a3fefc28f5 100644 --- a/devtools/create_cryo/create_cryo_dat.cpp +++ b/devtools/create_cryo/create_cryo_dat.cpp @@ -25,6 +25,7 @@ #include "eden.h" #include "eden_icons.h" #include "eden_rooms.h" +#include "eden_static.h" #define CRYO_DAT_VER 1 // 1 byte @@ -77,6 +78,108 @@ static void emitRooms(FILE *f) { rooms[i].write(f); } +static void emitStatic(FILE *f) { + const int kNumFollowers = 15; + const int kNumLabyrinthPath = 70; + const int kNumDinoSpeedForCitaLevel = 16; + const int kNumTabletView = 12; + const int kNumPersoRoomBankTable = 84; + const int kNumGotos = 130; + const int kNumObjects = 42; + const int kNumObjectLocations = 45; + const int kNumPersons = 58; + const int kNumCitadel = 7; + const int kNumCharacterRects = 19; + const int kNumCharacters = 20; + const int kNumActionCursors = 299; + const int kNumAreas = 12; + + for (int i = 0; i < kNumFollowers; i++) { + writeLE(f, followerList[i]._id); + writeLE(f, followerList[i]._spriteNum); + writeLE(f, followerList[i].sx); + writeLE(f, followerList[i].sy); + writeLE(f, followerList[i].ex); + writeLE(f, followerList[i].ey); + writeLE(f, followerList[i]._spriteBank); + writeLE(f, followerList[i].ff_C); + writeLE(f, followerList[i].ff_E); + } + + fwrite(kLabyrinthPath, 1, kNumLabyrinthPath, f); + fwrite(kDinoSpeedForCitaLevel, 1, kNumDinoSpeedForCitaLevel, f); + fwrite(kTabletView, 1, kNumTabletView, f); + fwrite(kPersoRoomBankTable, 1, kNumPersoRoomBankTable, f); + fwrite(gotos, sizeof(Goto), kNumGotos, f); + + for (int i = 0; i < kNumObjects; i++) { + writeLE(f, _objects[i]._id); + writeLE(f, _objects[i]._flags); + writeLE(f, _objects[i]._locations); + writeLE(f, _objects[i]._itemMask); + writeLE(f, _objects[i]._powerMask); + writeLE(f, _objects[i]._count); + } + + for (int i = 0; i < kNumObjectLocations; i++) { + writeLE(f, kObjectLocations[i]); + } + + for (int i = 0; i < kNumPersons; i++) { + writeLE(f, kPersons[i]._roomNum); + writeLE(f, kPersons[i]._actionId); + writeLE(f, kPersons[i]._partyMask); + writeLE(f, kPersons[i]._id); + writeLE(f, kPersons[i]._flags); + writeLE(f, kPersons[i]._roomBankId); + writeLE(f, kPersons[i]._spriteBank); + writeLE(f, kPersons[i]._items); + writeLE(f, kPersons[i]._powers); + writeLE(f, kPersons[i]._targetLoc); + writeLE(f, kPersons[i]._lastLoc); + writeLE(f, kPersons[i]._speed); + writeLE(f, kPersons[i]._steps); + } + + for (int i = 0; i < kNumCitadel; i++) { + writeLE(f, _citadelList[i]._id); + for (int j = 0; j < 8; j++) + writeLE(f, _citadelList[i]._bank[j]); + for (int j = 0; j < 8; j++) + writeLE(f, _citadelList[i]._video[j]); + } + + for (int i = 0; i < kNumCharacterRects; i++) { + writeLE(f, _characterRects[i].left); + writeLE(f, _characterRects[i].top); + writeLE(f, _characterRects[i].right); + writeLE(f, _characterRects[i].bottom); + } + + fwrite(_characterArray, 5, kNumCharacters, f); + + for (int i = 0; i < kNumAreas; i++) { + writeLE(f, kAreasTable[i]._num); + writeLE(f, kAreasTable[i]._type); + writeLE(f, kAreasTable[i]._flags); + writeLE(f, kAreasTable[i]._firstRoomIdx); + writeLE(f, kAreasTable[i]._citadelLevel); + writeLE(f, kAreasTable[i]._placeNum); + // pointer to _citadelRoomPtr is always initialized to null + writeLE(f, kAreasTable[i]._visitCount); + } + + for (int i = 0; i < 64; i++) { + writeLE(f, tab_2CEF0[i]); + } + + for (int i = 0; i < 64; i++) { + writeLE(f, tab_2CF70[i]); + } + + fwrite(kActionCursors, 1, kNumActionCursors, f); +} + static int emitData(char *outputFilename) { FILE *f = fopen(outputFilename, "w+b"); if (!f) { @@ -91,7 +194,8 @@ static int emitData(char *outputFilename) { emitIcons(f); emitRooms(f); - + emitStatic(f); + fclose(f); printf("Done!\n"); -- cgit v1.2.3 From 37c53cdf49209a582cc661b3c300c5b067ced8b8 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 11 Feb 2017 17:16:26 +0200 Subject: CRYO: Move more static data to cryo.dat (1/2) --- devtools/create_cryo/create_cryo_dat.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'devtools/create_cryo/create_cryo_dat.cpp') diff --git a/devtools/create_cryo/create_cryo_dat.cpp b/devtools/create_cryo/create_cryo_dat.cpp index a3fefc28f5..875acad3f1 100644 --- a/devtools/create_cryo/create_cryo_dat.cpp +++ b/devtools/create_cryo/create_cryo_dat.cpp @@ -178,6 +178,8 @@ static void emitStatic(FILE *f) { } fwrite(kActionCursors, 1, kNumActionCursors, f); + fwrite(mapMode, 1, 12, f); + fwrite(cubeTextureCoords, 6 * 2 * 3 * 2, 3, f); } static int emitData(char *outputFilename) { -- cgit v1.2.3 From a3f59d8433230cbb279092c8e7876522a7830fd2 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 11 Feb 2017 18:02:47 +0200 Subject: CRYO: Remove one more usage of sizeof() --- devtools/create_cryo/create_cryo_dat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'devtools/create_cryo/create_cryo_dat.cpp') diff --git a/devtools/create_cryo/create_cryo_dat.cpp b/devtools/create_cryo/create_cryo_dat.cpp index 875acad3f1..5a693d96fe 100644 --- a/devtools/create_cryo/create_cryo_dat.cpp +++ b/devtools/create_cryo/create_cryo_dat.cpp @@ -110,7 +110,7 @@ static void emitStatic(FILE *f) { fwrite(kDinoSpeedForCitaLevel, 1, kNumDinoSpeedForCitaLevel, f); fwrite(kTabletView, 1, kNumTabletView, f); fwrite(kPersoRoomBankTable, 1, kNumPersoRoomBankTable, f); - fwrite(gotos, sizeof(Goto), kNumGotos, f); + fwrite(gotos, 5, kNumGotos, f); // sizeof(Goto) for (int i = 0; i < kNumObjects; i++) { writeLE(f, _objects[i]._id); -- cgit v1.2.3 From fefad640cd171fd17f8a7e08326c7e6f3e91d684 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 11 Feb 2017 18:04:42 +0200 Subject: CRYO: Change the version of cryo.dat to be a 32-bit integer (1/2) Though it's unlikely that we'll ever have that many changes, it's better to provision for more space now, for versioning --- devtools/create_cryo/create_cryo_dat.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'devtools/create_cryo/create_cryo_dat.cpp') diff --git a/devtools/create_cryo/create_cryo_dat.cpp b/devtools/create_cryo/create_cryo_dat.cpp index 5a693d96fe..ca6d4bf790 100644 --- a/devtools/create_cryo/create_cryo_dat.cpp +++ b/devtools/create_cryo/create_cryo_dat.cpp @@ -27,7 +27,7 @@ #include "eden_rooms.h" #include "eden_static.h" -#define CRYO_DAT_VER 1 // 1 byte +#define CRYO_DAT_VER 1 // 32-bit integer template static void writeLE(FILE *f, T value) { @@ -192,7 +192,7 @@ static int emitData(char *outputFilename) { printf("Generating %s...\n", outputFilename); fwrite("CRYODATA", 8, 1, f); - writeLE(f, CRYO_DAT_VER); + writeLE(f, CRYO_DAT_VER); emitIcons(f); emitRooms(f); -- cgit v1.2.3