From c73270a3d38798c01dbc5bbc1937efacce79632b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 10 Feb 2017 02:50:07 +0200 Subject: CRYO: Add ID and versioning to cryo.dat --- devtools/create_cryo/create_led_dat.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/devtools/create_cryo/create_led_dat.cpp b/devtools/create_cryo/create_led_dat.cpp index e58ee7512d..794dee3e32 100644 --- a/devtools/create_cryo/create_led_dat.cpp +++ b/devtools/create_cryo/create_led_dat.cpp @@ -26,6 +26,8 @@ #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) { @@ -84,6 +86,9 @@ static int emitData(char *outputFilename) { printf("Generating %s...\n", outputFilename); + fwrite("CRYODATA", 8, 1, f); + writeLE(f, CRYO_DAT_VER); + emitIcons(f); emitRooms(f); -- cgit v1.2.3 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 +++++++++++++++++++++++++++++++ devtools/create_cryo/create_led_dat.cpp | 110 ------------------------------- devtools/create_cryo/module.mk | 4 +- 3 files changed, 112 insertions(+), 112 deletions(-) create mode 100644 devtools/create_cryo/create_cryo_dat.cpp delete mode 100644 devtools/create_cryo/create_led_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; +} diff --git a/devtools/create_cryo/create_led_dat.cpp b/devtools/create_cryo/create_led_dat.cpp deleted file mode 100644 index 794dee3e32..0000000000 --- a/devtools/create_cryo/create_led_dat.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* 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; -} diff --git a/devtools/create_cryo/module.mk b/devtools/create_cryo/module.mk index f8e350a95d..f1e8ea3aa9 100644 --- a/devtools/create_cryo/module.mk +++ b/devtools/create_cryo/module.mk @@ -2,10 +2,10 @@ MODULE := devtools/create_cryo MODULE_OBJS := \ - create_led_dat.o + create_cryo_dat.o # Set the name of the executable -TOOL_EXECUTABLE := create_led_dat +TOOL_EXECUTABLE := create_cryo_dat # Include common rules include $(srcdir)/rules.mk -- cgit v1.2.3 From 248e5d3c59adae40006db4b80a0efc3107312082 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 10 Feb 2017 02:51:52 +0200 Subject: CRYO: Add handling for the cryo.dat aux data file --- engines/cryo/eden.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp index b8e191c50b..4ff18bf307 100644 --- a/engines/cryo/eden.cpp +++ b/engines/cryo/eden.cpp @@ -48,6 +48,8 @@ namespace Cryo { +#define CRYO_DAT_VER 1 // 1 byte + int16 _torchTick = 0; int16 _glowIndex = 0; int16 _torchCurIndex = 0; @@ -4733,11 +4735,23 @@ void EdenGame::loadpermfiles() { // Since PC version stores hotspots and rooms info in the executable, load them from premade resource file Common::File f; - if (f.open("led.dat")) { + if (f.open("cryo.dat")) { const int kNumIcons = 136; const int kNumRooms = 424; - if (f.size() != kNumIcons * sizeof(Icon) + kNumRooms * sizeof(Room)) - error("Mismatching aux data"); + const int dataSize = f.size() - 8 - 1; // CRYODATA + version + char headerId[9]; + + f.read(headerId, 8); + headerId[8] = '\0'; + if (strcmp(headerId, "CRYODATA")) + error("Invalid aux data file"); + + if (f.readByte() != CRYO_DAT_VER) + error("Incorrect aux data version"); + + if (dataSize != kNumIcons * sizeof(Icon) + kNumRooms * sizeof(Room)) + error("Mismatching data in aux data file"); + for (int i = 0; i < kNumIcons; i++) { _gameIcons[i].sx = f.readSint16LE(); _gameIcons[i].sy = f.readSint16LE(); -- cgit v1.2.3 From 130dfccfc155d7806e5972d71bb1c8f894de1e69 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 10 Feb 2017 03:00:10 +0200 Subject: CRYO: Use cryo.dat for all game versions All the static data will be eventually moved into this file --- engines/cryo/eden.cpp | 52 +++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp index 4ff18bf307..214744f530 100644 --- a/engines/cryo/eden.cpp +++ b/engines/cryo/eden.cpp @@ -4729,29 +4729,30 @@ void EdenGame::convertMacToPC() { } void EdenGame::loadpermfiles() { - switch (_vm->getPlatform()) { - case Common::kPlatformDOS: - { - // Since PC version stores hotspots and rooms info in the executable, load them from premade resource file - Common::File f; + Common::File f; + const int kNumIcons = 136; + const int kNumRooms = 424; - if (f.open("cryo.dat")) { - const int kNumIcons = 136; - const int kNumRooms = 424; - const int dataSize = f.size() - 8 - 1; // CRYODATA + version - char headerId[9]; - - f.read(headerId, 8); - headerId[8] = '\0'; - if (strcmp(headerId, "CRYODATA")) - error("Invalid aux data file"); + if (f.open("cryo.dat")) { + const int dataSize = f.size() - 8 - 1; // CRYODATA + version + char headerId[9]; - if (f.readByte() != CRYO_DAT_VER) - error("Incorrect aux data version"); + f.read(headerId, 8); + headerId[8] = '\0'; + if (strcmp(headerId, "CRYODATA")) + error("Invalid aux data file"); - if (dataSize != kNumIcons * sizeof(Icon) + kNumRooms * sizeof(Room)) - error("Mismatching data in aux data file"); + if (f.readByte() != CRYO_DAT_VER) + error("Incorrect aux data version"); + if (dataSize != kNumIcons * sizeof(Icon) + kNumRooms * sizeof(Room)) + error("Mismatching data in aux data file"); + } else + error("Can not load aux data"); + + switch (_vm->getPlatform()) { + case Common::kPlatformDOS: + // Since PC version stores hotspots and rooms info in the executable, load them from premade resource file for (int i = 0; i < kNumIcons; i++) { _gameIcons[i].sx = f.readSint16LE(); _gameIcons[i].sy = f.readSint16LE(); @@ -4774,22 +4775,25 @@ void EdenGame::loadpermfiles() { _gameRooms[i]._location = f.readByte(); _gameRooms[i]._backgroundBankNum = f.readByte(); } - - f.close(); - } else - error("Can not load aux data"); - } break; case Common::kPlatformMacintosh: loadIconFile(2498, _gameIcons); loadRoomFile(2497, _gameRooms); loadRawFile(2486, _gameLipsync); convertMacToPC(); + + // Skip the icons and rooms of the DOS version + f.skip(kNumIcons * sizeof(Icon) + kNumRooms * sizeof(Room)); break; default: error("Unsupported platform"); } + // Read the common static data + // TODO + + f.close(); + loadRawFile(0, _mainBankBuf); loadRawFile(402, _gameFont); loadRawFile(404, _gameDialogs); -- cgit v1.2.3 From aa56958b8e7a4097101569a8ab2f84505ca8c805 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 10 Feb 2017 03:11:14 +0200 Subject: CRYO: Add explicit sizes to some static data arrays Makes it easier to move them to a data file --- engines/cryo/staticdata.cpp | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/engines/cryo/staticdata.cpp b/engines/cryo/staticdata.cpp index 1184791850..ad33ce3cef 100644 --- a/engines/cryo/staticdata.cpp +++ b/engines/cryo/staticdata.cpp @@ -25,7 +25,7 @@ namespace Cryo { -Follower followerList[] = { +Follower followerList[15] = { // char, X, sx, sy, ex, ey,bank, { PersonId::pidGregor, 5, 211, 9, 320, 176, 228, 0, 0 }, { PersonId::pidEloi, 4, 162, 47, 223, 176, 228, 112, 78 }, @@ -44,15 +44,7 @@ Follower followerList[] = { { -1, -1, -1, -1, -1, -1, -1, -1, -1 } }; - -/* - Labyrinth of Mo - - | | | | | | | | - -*/ - -byte kLabyrinthPath[] = { +byte kLabyrinthPath[70] = { // each nibble tells which direction to choose to exit the labyrinth 0x11, 0x11, 0x11, 0x22, 0x33, 0x55, 0x25, 0x44, 0x25, 0x11, 0x11, 0x11, 0x11, 0x35, 0x55, 0x45, 0x45, 0x44, 0x44, 0x34, 0x44, 0x34, 0x32, 0x52, @@ -64,7 +56,7 @@ byte kLabyrinthPath[] = { char kDinoSpeedForCitaLevel[16] = { 1, 2, 3, 4, 4, 5, 6, 7, 8, 9 }; -char kTabletView[] = { //TODO: make as struct? +char kTabletView[12] = { //TODO: make as struct? // opposite tablet id, video id Objects::obUnused10, 83, Objects::obUnused10, 84, @@ -75,7 +67,7 @@ char kTabletView[] = { //TODO: make as struct? }; // special character backgrounds for specific rooms -char kPersoRoomBankTable[] = { +char kPersoRoomBankTable[84] = { // first entry is default bank, then pairs of [roomNum, bankNum], terminated by -1 0, 3, 33, -1, 21, 17, 35, -1, @@ -102,7 +94,7 @@ char kPersoRoomBankTable[] = { }; // area transition descriptors -Goto gotos[] = { +Goto gotos[130] = { // area, oldarea, vid, time, valleyVid { 0, 1, 0, 2, 20 }, { 0, 1, 162, 3, 168 }, @@ -236,7 +228,7 @@ Goto gotos[] = { { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, }; -object_t _objects[] = { +object_t _objects[42] = { //id,fl,loc,masklow,maskhi,ct { 1, 0, 3, 1, 0, 0}, // Eve's Way Stone { 2, 0, 3, 2, 0, 0}, // Thau's Seashell @@ -371,7 +363,7 @@ perso_t kPersons[] = { { 0x628, 237, PersonMask::pmEve , PersonId::pidEve , 0, 78, 10, 0, 0, 7, 35, 0, 0 } }; -Citadel _citadelList[] = { +Citadel _citadelList[7] = { { 1, { 163, 182, 0, 0, 124, 147, 193, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 } }, { 48, { 285, 286, 0, 0, 287, 288, 284, 0 }, { 114, 115, 0, 0, 116, 117, 113, 0 } }, { 63, { 290, 291, 0, 0, 292, 293, 289, 0 }, { 119, 120, 0, 0, 121, 122, 118, 0 } }, @@ -381,7 +373,7 @@ Citadel _citadelList[] = { { 255, { 310, 311, 0, 0, 312, 313, 309, 0 }, { 139, 140, 0, 0, 141, 142, 138, 0 } } }; -prect_t _characterRects[] = { //TODO: just an array of int16s? +prect_t _characterRects[19] = { // TODO: just an array of int16s? { 93, 69, 223, 176}, { 102, 86, 162, 126}, { 88, 103, 168, 163}, @@ -403,7 +395,7 @@ prect_t _characterRects[] = { //TODO: just an array of int16s? { 188, 83, 251, 158} }; -byte _characterArray[][5] = { //TODO: struc? +byte _characterArray[][5] = { // TODO: struc? { 8, 15, 23, 25, 0xFF}, { 0, 9, 0xFF }, { 0, 9, 0xFF }, -- 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 ++++++- devtools/create_cryo/eden.h | 233 +++++++++++++++ devtools/create_cryo/eden_static.h | 479 +++++++++++++++++++++++++++++++ 3 files changed, 817 insertions(+), 1 deletion(-) create mode 100644 devtools/create_cryo/eden_static.h 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"); diff --git a/devtools/create_cryo/eden.h b/devtools/create_cryo/eden.h index dfbe7cae52..e9dd6be746 100644 --- a/devtools/create_cryo/eden.h +++ b/devtools/create_cryo/eden.h @@ -49,3 +49,236 @@ struct room_t { byte background; }; #define END_ROOMS {0xFF, {0xFF, 0xFF, 0xFF, 0xFF}, 0xFF, 0xFFFF, 0xFFFF, 0xFF, 0xFF, 0xFF, 0xFF} + +struct Follower { // Characters on Mirror screen + char _id; // character + char _spriteNum; // sprite number + int16 sx; + int16 sy; + int16 ex; + int16 ey; + int16 _spriteBank; + int16 ff_C; + int16 ff_E; +}; + +enum PersonId { + pidGregor = 0, // The King + pidDina, // Pink dino + pidTau, // Late grandpa + pidMonk, // Old wizard + pidJabber, // Executioner + pidEloi, // Evergreen ptero + pidMungo, // Dina's husband + pidEve, // Blonde girl + pidShazia, // Big boobs sis + pidLeadersBegin, // 9 + pidChongOfChamaar = pidLeadersBegin, // Dogface + pidKommalaOfKoto, // Clones + pidUlanOfUlele, // Shaman + pidCabukaOfCantura, // Stone people + pidMarindaOfEmbalmers, // Gods + pidFuggOfTamara, // Boar-like + pidThugg, // Bodyguard + pidNarrator, // 16, Old Eloi, also BGM + pidNarrim, // Sea snake + pidMorkus, // Vicious tyran + pidDinosaur, // different species of friendly dino + pidEnemy // different species of enemy dino +}; + +enum PersonMask { + pmGregor = 1, + pmDina = 2, + pmTau = 4, + pmMonk = 8, + pmJabber = 0x10, + pmEloi = 0x20, + pmMungo = 0x40, + pmEve = 0x80, + pmShazia = 0x100, + pmLeader = 0x200, // valley tribe leader + pmThugg = 0x400, + pmQuest = 0x800, // special quest person + pmDino = 0x1000, + pmEnemy = 0x2000, + pmMorkus = 0x4000 +}; + +enum PersonFlags { + pfType0 = 0, + pftTyrann, + pfType2, + pfType3, + pfType4, + pfType5, + pfType6, + pfType7, + pfType8, + pftMosasaurus, + pftTriceraptor, + pftVelociraptor, + pfType12, + pfType13, + pfType14, + pfType15, + pfTypeMask = 0xF, + pf10 = 0x10, + pf20 = 0x20, + pfInParty = 0x40, + pf80 = 0x80 +}; + +enum Objects { + obNone, + obWayStone, + obShell, + obTalisman, + obTooth, + obPrism, // 5 + obFlute, + obApple, + obEgg, // 8 + obRoot, + obUnused10, + obShroom, // 11 + obBadShroom, // 12 + obKnife, // 13 + obNest, // 14 + obFullNest, // 15 + obGold, // 16 + obMoonStone, + obBag, + obSunStone, // 19 + obHorn, // 20 + obSword, + + obMaskOfDeath, + obMaskOfBonding, + obMaskOfBirth, + + obEyeInTheStorm, // 25 + obSkyHammer, + obFireInTheClouds, + obWithinAndWithout, + obEyeInTheCyclone, + obRiverThatWinds, + + obTrumpet, // 31 + obUnused32, + obDrum, + obUnused34, + obUnused35, + obRing, + + obTablet1, // 37 is 1st plaque, 6 total + obTablet2, + obTablet3, // 39 + obTablet4, + obTablet5, + obTablet6 +}; + +struct Goto { + byte _areaNum; // target area + byte _curAreaNum; // current area + byte _enterVideoNum; + byte _travelTime; // time to skip while in travel + byte _arriveVideoNum; +}; + +struct object_t { + byte _id; + byte _flags; + int _locations; // index in kObjectLocations + uint16 _itemMask; + uint16 _powerMask; // object of power bitmask + int16 _count; +}; + +struct perso_t { + uint16 _roomNum; // room this person currently in + uint16 _actionId; // TODO: checkme + uint16 _partyMask; // party bit mask + byte _id; // character + byte _flags; // flags and kind + byte _roomBankId;// index in kPersoRoomBankTable for specific room banks + byte _spriteBank; // sprite bank + uint16 _items; // inventory + uint16 _powers; // obj of power bitmask + byte _targetLoc; // For party member this is mini sprite index + byte _lastLoc; // For party member this is mini sprite x offset + byte _speed; // num ticks per step + byte _steps; // current ticks +}; + +struct Citadel { + int16 _id; + int16 _bank[8]; + int16 _video[8]; +}; + +// A struct to hold the struct members of Common::Rect +struct Rect { + int16 left, top, right, bottom; +}; + +enum Areas { + arMo = 1, + arTausCave, + arChamaar, + arUluru, + arKoto, + arTamara, + arCantura, + arShandovra, + arNarimsCave, + arEmbalmersCave, + arWhiteArch, + arMoorkusLair +}; + +enum AreaFlags { + afFlag1 = 1, + afFlag2 = 2, + afFlag4 = 4, + afFlag8 = 8, + afGaveGold = 0x10, + afFlag20 = 0x20, + + HasTriceraptors = 0x100, + HasVelociraptors = 0x200, + HasTyrann = 0x400, + + TyrannSighted = 0x4000, + afFlag8000 = 0x8000 +}; + +struct Room { + byte _id; + byte _exits[4]; //TODO: signed? + byte _flags; + uint16 _bank; + uint16 _party; + byte _level; // Citadel level + byte _video; + byte _location; + byte _backgroundBankNum; // bg/mirror image number (relative) +}; + +struct Area { + byte _num; + byte _type; + uint16 _flags; + uint16 _firstRoomIdx; + byte _citadelLevel; + byte _placeNum; + Room *_citadelRoomPtr; + int16 _visitCount; +}; + +enum AreaType { + atCitadel = 1, + atValley = 2, + atCave = 3 +}; diff --git a/devtools/create_cryo/eden_static.h b/devtools/create_cryo/eden_static.h new file mode 100644 index 0000000000..fe4ff20e3b --- /dev/null +++ b/devtools/create_cryo/eden_static.h @@ -0,0 +1,479 @@ +/* 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. + * + */ + +#pragma once +#include "eden.h" + +Follower followerList[15] = { +// char, X, sx, sy, ex, ey,bank, + { PersonId::pidGregor, 5, 211, 9, 320, 176, 228, 0, 0 }, + { PersonId::pidEloi, 4, 162, 47, 223, 176, 228, 112, 78 }, + { PersonId::pidDina, 3, 55, 0, 172, 176, 228, 90, 16 }, + { PersonId::pidChongOfChamaar, 4, 0, 5, 114, 176, 229, 0, 16 }, + { PersonId::pidKommalaOfKoto, 3, 0, 15, 102, 176, 229, 0, 16 }, + { PersonId::pidUlanOfUlele, 1, 0, 0, 129, 176, 230, 0, 16 }, + { PersonId::pidCabukaOfCantura, 2, 0, 0, 142, 176, 230, 0, 16 }, + { PersonId::pidFuggOfTamara, 0, 0, 17, 102, 176, 230, 0, 16 }, + { PersonId::pidJabber, 2, 0, 6, 134, 176, 228, 0, 16 }, + { PersonId::pidShazia, 1, 90, 17, 170, 176, 228, 50, 22 }, + { PersonId::pidThugg, 0, 489, 8, 640, 176, 228, 160, 24 }, + { PersonId::pidMungo, 5, 361, 0, 517, 176, 229, 0, 16 }, + { PersonId::pidMonk, 0, 419, 22, 569, 176, 229, 100, 30 }, + { PersonId::pidEve, 1, 300, 28, 428, 176, 229, 0, 38 }, + { -1, -1, -1, -1, -1, -1, -1, -1, -1 } +}; + +byte kLabyrinthPath[70] = { +// each nibble tells which direction to choose to exit the labyrinth + 0x11, 0x11, 0x11, 0x22, 0x33, 0x55, 0x25, 0x44, 0x25, 0x11, 0x11, 0x11, + 0x11, 0x35, 0x55, 0x45, 0x45, 0x44, 0x44, 0x34, 0x44, 0x34, 0x32, 0x52, + 0x33, 0x23, 0x24, 0x44, 0x24, 0x22, 0x54, 0x22, 0x54, 0x54, 0x44, 0x22, + 0x22, 0x42, 0x45, 0x22, 0x42, 0x45, 0x35, 0x11, 0x44, 0x34, 0x52, 0x11, + 0x44, 0x32, 0x55, 0x11, 0x11, 0x33, 0x11, 0x11, 0x53, 0x11, 0x11, 0x53, + 0x54, 0x24, 0x11, 0x22, 0x25, 0x33, 0x53, 0x54, 0x23, 0x44 +}; + +char kDinoSpeedForCitaLevel[16] = { 1, 2, 3, 4, 4, 5, 6, 7, 8, 9 }; + +char kTabletView[12] = { //TODO: make as struct? + // opposite tablet id, video id + Objects::obUnused10, 83, + Objects::obUnused10, 84, + Objects::obTablet4, 85, + Objects::obTablet3, 86, + Objects::obTablet6, 87, + Objects::obTablet5, 85 +}; + +// special character backgrounds for specific rooms +char kPersoRoomBankTable[84] = { + // first entry is default bank, then pairs of [roomNum, bankNum], terminated by -1 + 0, 3, 33, -1, + 21, 17, 35, -1, + 0, 2, 36, -1, + 22, 9, 38, 3, 39, -1, + 23, 8, 40, -1, + 0, 3, 41, 7, 42, -1, + 25, -1, + 27, 17, 45, -1, + 28, 26, 46, -1, + 29, 51, 48, -1, + 30, 53, 49, -1, + 0, 27, 50, -1, + 32, 17, 51, -1, + 52, 2, 52, -1, + -3, 3, -3, -1, + 31, -1, + 24, 6, 43, -1, + 47, -1, + 0, 2, 64, -1, + 54, 3, 54, -1, + 27, -1, + 26, 17, 45, -1 +}; + +// area transition descriptors +Goto gotos[130] = { +// area, oldarea, vid, time, valleyVid + { 0, 1, 0, 2, 20 }, + { 0, 1, 162, 3, 168 }, + { 0, 2, 0, 2, 21 }, + { 0, 6, 0, 3, 108 }, + { 0, 9, 151, 3, 0 }, + { 0, 7, 106, 2, 101 }, + { 0, 10, 79, 3, 102 }, + { 0, 12, 0, 3, 0 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 1, 3, 58, 2, 104 }, + { 1, 4, 100, 4, 104 }, + { 1, 5, 107, 6, 104 }, + { 1, 6, 155, 8, 104 }, + { 1, 7, 165, 6, 104 }, + { 1, 8, 169, 6, 104 }, + { 1, 10, 111, 2, 104 }, + { 1, 11, 164, 4, 104 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 1, 3, 161, 3, 102 }, + { 1, 4, 163, 6, 102 }, + { 1, 5, 157, 9, 102 }, + { 1, 9, 160, 9, 102 }, + { 1, 10, 79, 3, 102 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 1, 3, 0, 3, 153 }, // 24 + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 3, 1, 154, 2, 103 }, + { 3, 4, 100, 2, 103 }, + { 3, 5, 107, 4, 103 }, + { 3, 6, 155, 6, 103 }, + { 3, 7, 165, 8, 103 }, + { 3, 8, 169, 6, 103 }, + { 3, 10, 111, 4, 103 }, + { 3, 11, 164, 6, 103 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 3, 1, 162, 3, 22 }, + { 3, 4, 163, 6, 22 }, + { 3, 5, 157, 9, 22 }, + { 3, 9, 160, 9, 22 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 3, 1, 0, 3, 166 }, // 40 + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 4, 1, 154, 4, 51 }, + { 4, 3, 58, 2, 51 }, + { 4, 5, 107, 2, 51 }, + { 4, 6, 155, 4, 51 }, + { 4, 7, 165, 6, 51 }, + { 4, 8, 169, 8, 51 }, + { 4, 10, 111, 6, 51 }, + { 4, 11, 164, 8, 51 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 4, 1, 162, 3, 109 }, // 51 + { 4, 3, 161, 6, 109 }, + { 4, 5, 157, 9, 109 }, + { 4, 9, 160, 9, 109 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 5, 1, 154, 6, 33 }, + { 5, 3, 58, 4, 33 }, + { 5, 4, 100, 2, 33 }, + { 5, 6, 155, 2, 33 }, + { 5, 7, 165, 4, 33 }, + { 5, 8, 169, 8, 33 }, + { 5, 10, 111, 8, 33 }, + { 5, 11, 164, 8, 33 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 5, 1, 162, 3, 99 }, // 65 + { 5, 3, 161, 6, 99 }, + { 5, 4, 163, 9, 99 }, + { 5, 9, 160, 9, 99 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 9, 1, 162, 3, 167 }, // 70 + { 9, 3, 161, 6, 167 }, + { 9, 4, 163, 9, 167 }, + { 9, 5, 157, 9, 167 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 6, 1, 154, 8, 105 }, // 75 + { 6, 3, 58, 6, 105 }, + { 6, 4, 100, 4, 105 }, + { 6, 5, 107, 2, 105 }, + { 6, 7, 165, 2, 105 }, + { 6, 8, 169, 10, 105 }, + { 6, 10, 111, 6, 105 }, + { 6, 11, 164, 8, 105 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 7, 1, 154, 4, 158 }, // 84 + { 7, 3, 58, 6, 158 }, + { 7, 4, 100, 6, 158 }, + { 7, 5, 107, 4, 158 }, + { 7, 6, 155, 2, 158 }, + { 7, 8, 169, 8, 158 }, + { 7, 10, 111, 4, 158 }, + { 7, 11, 164, 6, 158 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 8, 1, 154, 2, 159 }, // 93 + { 8, 3, 58, 4, 159 }, + { 8, 4, 100, 6, 159 }, + { 8, 5, 107, 8, 159 }, + { 8, 6, 155, 10, 159 }, + { 8, 7, 165, 8, 159 }, + { 8, 10, 111, 6, 159 }, + { 8, 11, 164, 4, 159 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 10, 1, 154, 2, 77 }, // 102 + { 10, 3, 58, 4, 77 }, + { 10, 4, 100, 6, 77 }, + { 10, 5, 107, 8, 77 }, + { 10, 6, 155, 6, 77 }, + { 10, 7, 165, 4, 77 }, + { 10, 8, 169, 6, 77 }, + { 10, 11, 164, 4, 77 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 11, 1, 154, 2, 80 }, // 111 + { 11, 3, 58, 4, 80 }, + { 11, 4, 100, 6, 80 }, + { 11, 5, 107, 8, 80 }, + { 11, 6, 155, 8, 80 }, + { 11, 7, 165, 6, 80 }, + { 11, 8, 169, 2, 80 }, + { 11, 10, 111, 4, 80 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + { 12, 1, 154, 8, 56 }, // 120 + { 12, 3, 58, 4, 56 }, + { 12, 4, 100, 4, 56 }, + { 12, 5, 107, 6, 56 }, + { 12, 6, 155, 8, 56 }, + { 12, 7, 165, 10, 56 }, + { 12, 8, 169, 4, 56 }, + { 12, 10, 111, 10, 56 }, + { 12, 11, 164, 6, 56 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, +}; + +object_t _objects[42] = { + //id,fl,loc,masklow,maskhi,ct + { 1, 0, 3, 1, 0, 0}, // Eve's Way Stone + { 2, 0, 3, 2, 0, 0}, // Thau's Seashell + { 3, 0, 3, 4, 0, 0}, // Talisman of bravery + { 4, 0, 3, 8, 0, 0}, // An old tooth. Very old! Whoever lost it most certainly has no further use for it! + { 5, 0, 0, 0x10, 0, 0}, // Prism + { 6, 0, 3, 0, 0, 0}, // Flute + { 7, 0, 3, 0x4000, 0, 0}, // Apple + { 8, 0, 4, 0x1000, 0, 0}, // Egg of Destiny + { 9, 0, 3, 0x800, 0, 0}, // Root + { 10, 0, 3, 0, 0, 0}, // ??? + { 11, 0, 6, 0, 0, 0}, // Mushroom + { 12, 0, 13, 0, 0, 0}, // Poisonous Mushroom + { 13, 0, 2, 0x400, 0, 0}, // Graa's Knife + { 14, 0, 22, 0, 0, 0}, // Empty Nest + { 15, 0, 26, 0, 0, 0}, // Full Nest + { 16, 0, 33, 0x20, 0, 0}, // Gold + { 17, 0, 3, 0, 0, 0}, // Sign of Shadow Mistress (moon stone) + { 18, 0, 3, 0, 0, 0}, // Sign of Mother of all (bag of soil) + { 19, 0, 40, 0, 0, 0}, // Sign of the life-giving (sun star) + { 20, 0, 20, 0x200, 0, 0}, // King's Horn + { 21, 0, 3, 0, 0, 0}, // Golden Sword of Mashaar + // Masks + { 22, 0, 3, 0x40, 0, 0}, // Mask of Death + { 23, 0, 3, 0x80, 0, 0}, // Mask of Bonding + { 24, 0, 3, 0x100, 0, 0}, // Mask of Birth + // Objects of power + { 25, 0, 3, 0, 1, 0}, // Eye in the Storm + { 26, 0, 3, 0, 2, 0}, // Sky Hammer + { 27, 0, 3, 0, 4, 0}, // Fire in the Clouds + { 28, 0, 3, 0, 8, 0}, // Within and Without + { 29, 0, 3, 0, 0x10, 0}, // Eye in the Cyclone + { 30, 0, 3, 0, 0x20, 0}, // River that Winds + // Musical instruments + { 31, 0, 3, 0, 0x40, 0}, // Trumpet + { 32, 0, 3, 0, 0x80, 0}, // -- unused (but still has a dialog line) + { 33, 0, 3, 0, 0x100, 0}, // Drum + { 34, 0, 3, 0, 0x200, 0}, // -- unused (but still has a dialog line) + { 35, 0, 3, 0, 0x400, 0}, // -- unused (but still has a dialog line) + { 36, 0, 3, 0, 0x800, 0}, // Ring + // Tablets + { 37, 0, 3, 0, 0, 0}, // Tablet #1 (Mo) + { 38, 0, 42, 0x2000, 0, 0}, // Tablet #2 (Morkus' Lair) + { 39, 0, 3, 0, 0, 0}, // Tablet #3 (White Arch?) + { 40, 0, 3, 0, 0, 0}, // Tablet #4 + { 41, 0, 3, 0, 0, 0}, // Tablet #5 + { 42, 0, 3, 0x8000, 0, 0} // Tablet #6 (Castra) +}; + +uint16 kObjectLocations[45] = { + 0x112, 0xFFFF, + 0x202, 0xFFFF, + 0x120, 0xFFFF, + 0x340, 0x44B, 0x548, 0x640, 0x717, 0x830, 0xFFFF, + 0x340, 0x44B, 0x548, 0x640, 0x717, 0x830, 0xFFFF, + 0, 0xFFFF, + 0x344, 0x53A, 0x831, 0xFFFF, + 0x331, 0x420, 0x54B, 0x637, 0x716, 0x840, 0xFFFF, + 0x834A, 0x8430, 0x8531, 0x644, 0x745, 0x838, 0xFFFF, + 0x510, 0xFFFF, + 0xC04, 0xFFFF, + 0xFFFF +}; + +perso_t kPersons[58] = { + // room, aid, party mask, id, flags, X,bank,X, X,sprId,sprX,speed, X + { 0x103, 230, PersonMask::pmGregor, PersonId::pidGregor , 0, 0, 1, 0, 0, 0, 0, 0, 0 }, + { 0x116, 231, PersonMask::pmDina , PersonId::pidDina , 0, 4, 2, 0, 0, 3, 9, 0, 0 }, + { 0x202, 232, PersonMask::pmTau , PersonId::pidTau , 0, 8, 3, 0, 0, 0, 0, 0, 0 }, + { 0x109, 233, PersonMask::pmMonk , PersonId::pidMonk , 0, 12, 4, 0, 0, 6, 52, 0, 0 }, + { 0x108, 234, PersonMask::pmJabber, PersonId::pidJabber , 0, 18, 5, 0, 0, 2, 0, 0, 0 }, + { 0x103, 235, PersonMask::pmEloi , PersonId::pidEloi , 0, 22, 6, 0, 0, 4, 20, 0, 0 }, + { 0x301, 236, PersonMask::pmMungo , PersonId::pidMungo , 0, 28, 8, 0, 0, 11, 45, 0, 0 }, + { 0x628, 237, PersonMask::pmEve , PersonId::pidEve , 0, 30, 10, 0, 0, 7, 35, 0, 0 }, + { 0x81A, 238, PersonMask::pmShazia, PersonId::pidShazia , 0, 34, 11, 0, 0, 1, 11, 0, 0 }, + { 0x330, 239, PersonMask::pmLeader, PersonId::pidChongOfChamaar , 0, 38, 13, 0, 0, 10, 0, 0, 0 }, + { 0x41B, 239, PersonMask::pmLeader, PersonId::pidUlanOfUlele , 0, 46, 15, 0, 0, 13, 0, 0, 0 }, + { 0x53B, 239, PersonMask::pmLeader, PersonId::pidKommalaOfKoto , 0, 42, 14, 0, 0, 9, 0, 0, 0 }, + { 0x711, 239, PersonMask::pmLeader, PersonId::pidCabukaOfCantura , 0, 50, 16, 0, 0, 14, 0, 0, 0 }, + { 0xA02, 239, PersonMask::pmLeader, PersonId::pidMarindaOfEmbalmers, 0, 54, 17, 0, 0, 0, 0, 0, 0 }, + { 0x628, 239, PersonMask::pmLeader, PersonId::pidFuggOfTamara , 0, 62, 18, 0, 0, 12, 0, 0, 0 }, + { 0x801, 239, PersonMask::pmLeader, PersonId::pidChongOfChamaar , 0, 38, 13, 0, 0, 10, 0, 0, 0 }, + { 0x41B, 10, PersonMask::pmQuest , PersonId::pidUlanOfUlele , PersonFlags::pfType2 , 46, 15, 0, 0, 13, 0, 0, 0 }, + { 0x711, 11, PersonMask::pmQuest , PersonId::pidCabukaOfCantura , PersonFlags::pfType2 , 50, 16, 0, 0, 14, 0, 0, 0 }, + { 0x106, 240, PersonMask::pmThugg , PersonId::pidThugg , 0, 64, 7, 0, 0, 0, 61, 0, 0 }, + { 0, 13, 0, PersonId::pidNarrator , 0, 68, 12, 0, 0, 0, 0, 0, 0 }, + { 0x902, 241, PersonMask::pmQuest , PersonId::pidNarrim , 0, 70, 19, 0, 0, 0, 0, 0, 0 }, + { 0xC03, 244, PersonMask::pmMorkus, PersonId::pidMorkus , 0, 74, 20, 0, 0, 0, 0, 0, 0 }, + // dinos in each valley + { 0x332, 242, PersonMask::pmDino , PersonId::pidDinosaur , PersonFlags::pfType8 , 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0x329, 242, PersonMask::pmDino , PersonId::pidDinosaur , PersonFlags::pfType8 , 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0x33B, 242, PersonMask::pmDino , PersonId::pidDinosaur , PersonFlags::pf80 | PersonFlags::pftTriceraptor , 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0x317, 242, PersonMask::pmDino , PersonId::pidDinosaur , PersonFlags::pf80 | PersonFlags::pftVelociraptor, 0, 0, 0, 0, 0, 0, 1, 0 }, + { 0x320, 242, PersonMask::pmDino , PersonId::pidDinosaur , PersonFlags::pfType12 , 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0x349, 242, PersonMask::pmDino , PersonId::pidDinosaur , PersonFlags::pf80 | PersonFlags::pftMosasaurus , 0, 0, 0, 0, 0, 0, 0, 0 }, + + { 0x429, 242, PersonMask::pmDino , PersonId::pidDinosaur , PersonFlags::pfType8 , 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0x43B, 242, PersonMask::pmDino , PersonId::pidDinosaur , PersonFlags::pf80 | PersonFlags::pftTriceraptor , 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0x422, 242, PersonMask::pmDino , PersonId::pidDinosaur , PersonFlags::pf80 | PersonFlags::pftVelociraptor, 0, 0, 0, 0, 0, 0, 1, 0 }, + { 0x432, 242, PersonMask::pmDino , PersonId::pidDinosaur , PersonFlags::pf80 | PersonFlags::pftMosasaurus , 0, 0, 0, 0, 0, 0, 0, 0 }, + + { 0x522, 242, PersonMask::pmDino , PersonId::pidDinosaur , PersonFlags::pfType8 , 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0x534, 242, PersonMask::pmDino , PersonId::pidDinosaur , PersonFlags::pf80 | PersonFlags::pftTriceraptor , 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0x515, 242, PersonMask::pmDino , PersonId::pidDinosaur , PersonFlags::pftVelociraptor , 0, 0, 0, 0, 0, 0, 1, 0 }, + { 0x533, 242, PersonMask::pmDino , PersonId::pidDinosaur , PersonFlags::pf80 | PersonFlags::pftMosasaurus , 0, 0, 0, 0, 0, 0, 0, 0 }, + + { 0x622, 242, PersonMask::pmDino , PersonId::pidDinosaur , PersonFlags::pfType8 , 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0x630, 242, PersonMask::pmDino , PersonId::pidDinosaur , PersonFlags::pf80 | PersonFlags::pftTriceraptor , 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0x643, 242, PersonMask::pmDino , PersonId::pidDinosaur , PersonFlags::pf80 | PersonFlags::pftVelociraptor, 0, 0, 0, 0, 0, 0, 1, 0 }, + { 0x63A, 242, PersonMask::pmDino , PersonId::pidDinosaur , PersonFlags::pf80 | PersonFlags::pftMosasaurus , 0, 0, 0, 0, 0, 0, 0, 0 }, + + { 0x737, 242, PersonMask::pmDino , PersonId::pidDinosaur , PersonFlags::pfType8 , 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0x739, 242, PersonMask::pmDino , PersonId::pidDinosaur , PersonFlags::pf80 | PersonFlags::pftTriceraptor , 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0x74A, 242, PersonMask::pmDino , PersonId::pidDinosaur , PersonFlags::pf80 | PersonFlags::pftVelociraptor, 0, 0, 0, 0, 0, 0, 1, 0 }, + { 0x726, 242, PersonMask::pmDino , PersonId::pidDinosaur , PersonFlags::pf80 | PersonFlags::pftMosasaurus , 0, 0, 0, 0, 0, 0, 0, 0 }, + + { 0x842, 242, PersonMask::pmDino , PersonId::pidDinosaur , PersonFlags::pf80 | PersonFlags::pfType8 , 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0x822, 242, PersonMask::pmDino , PersonId::pidDinosaur , PersonFlags::pf80 | PersonFlags::pftTriceraptor , 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0x828, 242, PersonMask::pmDino , PersonId::pidDinosaur , PersonFlags::pftVelociraptor , 0, 0, 0, 0, 0, 0, 1, 0 }, + { 0x84B, 242, PersonMask::pmDino , PersonId::pidDinosaur , PersonFlags::pf80 | PersonFlags::pftMosasaurus , 0, 0, 0, 0, 0, 0, 0, 0 }, + + { 0xB03, 242, PersonMask::pmDino , PersonId::pidDinosaur , PersonFlags::pfType8 , 58, 252, 0, 0, 0, 0, 0, 0 }, + // enemy dinos + { 0x311, 243, PersonMask::pmEnemy , PersonId::pidEnemy , PersonFlags::pf80 | PersonFlags::pftTyrann , 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0x410, 243, PersonMask::pmEnemy , PersonId::pidEnemy , PersonFlags::pf80 | PersonFlags::pftTyrann , 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0x51B, 243, PersonMask::pmEnemy , PersonId::pidEnemy , PersonFlags::pf80 | PersonFlags::pftTyrann , 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0x618, 243, PersonMask::pmEnemy , PersonId::pidEnemy , PersonFlags::pf80 | PersonFlags::pftTyrann , 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0x71B, 243, PersonMask::pmEnemy , PersonId::pidEnemy , PersonFlags::pf80 | PersonFlags::pftTyrann , 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0x81B, 243, PersonMask::pmEnemy , PersonId::pidEnemy , PersonFlags::pf80 | PersonFlags::pftTyrann , 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0xFFFF, 0xFFFF, 0xFFFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFFFF, 0xFFFF, 0xFF, 0xFF, 0xFF, 0xFF}, + { 0x628, 237, PersonMask::pmEve , PersonId::pidEve , 0, 80, 9, 0, 0, 8, 35, 0, 0 }, + { 0x628, 237, PersonMask::pmEve , PersonId::pidEve , 0, 78, 10, 0, 0, 7, 35, 0, 0 } +}; + +Citadel _citadelList[7] = { + { 1, { 163, 182, 0, 0, 124, 147, 193, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 } }, + { 48, { 285, 286, 0, 0, 287, 288, 284, 0 }, { 114, 115, 0, 0, 116, 117, 113, 0 } }, + { 63, { 290, 291, 0, 0, 292, 293, 289, 0 }, { 119, 120, 0, 0, 121, 122, 118, 0 } }, + { 95, { 295, 296, 0, 0, 297, 298, 294, 0 }, { 124, 125, 0, 0, 126, 127, 123, 0 } }, + { 127, { 300, 301, 0, 0, 302, 303, 299, 0 }, { 129, 130, 0, 0, 131, 132, 128, 0 } }, + { 159, { 305, 306, 0, 0, 307, 308, 304, 0 }, { 134, 135, 0, 0, 136, 137, 133, 0 } }, + { 255, { 310, 311, 0, 0, 312, 313, 309, 0 }, { 139, 140, 0, 0, 141, 142, 138, 0 } } +}; + +Rect _characterRects[19] = { // TODO: just an array of int16s? + { 93, 69, 223, 176}, + { 102, 86, 162, 126}, + { 88, 103, 168, 163}, + { 116, 66, 192, 176}, + { 129, 92, 202, 153}, + { 60, 95, 160, 176}, + { 155, 97, 230, 145}, + { 100, 77, 156, 145}, + { 110, 78, 170, 156}, + { 84, 76, 166, 162}, + { 57, 77, 125, 114}, + { 93, 69, 223, 175}, + { 93, 69, 223, 176}, + { 93, 69, 223, 176}, + { 154, 54, 245, 138}, + { 200, 50, 261, 116}, + { 70, 84, 162, 176}, + { 125, 101, 222, 172}, + { 188, 83, 251, 158} +}; + +byte _characterArray[20][5] = { // TODO: struc? + { 8, 15, 23, 25, 0xFF }, + { 0, 9, 0xFF, 0, 0 }, + { 0, 9, 0xFF, 0, 0 }, + { 0, 9, 0xFF, 0, 0 }, + { 0, 13, 0xFF, 0, 0 }, + { 16, 21, 0xFF, 0, 0 }, + { 11, 20, 0xFF, 0, 0 }, + { 0, 12, 0xFF, 0, 0 }, + { 0, 9, 0xFF, 0, 0 }, + { 0, 9, 0xFF, 0, 0 }, + { 5, 13, 0xFF, 0, 0 }, + { 0xFF, 0, 0, 0, 0 }, + { 0, 8, 0xFF, 0, 0 }, + { 0xFF, 0, 0, 0, 0 }, + { 0, 7, 0xFF, 0, 0 }, + { 0, 8, 0xFF, 0, 0 }, + { 8, 12, 0xFF, 0, 0 }, + { 0, 5, 0xFF, 0, 0 }, + { 0, 4, 0xFF, 0, 0 }, + { 0xFF, 0, 0, 0, 0 } +}; + +Area kAreasTable[12] = { + { Areas::arMo , AreaType::atCitadel, 0, 0, 0, 1, 0, 0}, + { Areas::arTausCave , AreaType::atCave , 0, 112, 0, 2, 0, 0}, + { Areas::arChamaar , AreaType::atValley , 0, 133, 0, 3, 0, 0}, + { Areas::arUluru , AreaType::atValley , 0, 187, 0, 4, 0, 0}, + { Areas::arKoto , AreaType::atValley , AreaFlags::HasVelociraptors, 236, 0, 5, 0, 0}, + { Areas::arTamara , AreaType::atValley , 0, 288, 0, 6, 0, 0}, + { Areas::arCantura , AreaType::atValley , 0, 334, 0, 7, 0, 0}, + { Areas::arShandovra , AreaType::atValley , 0, 371, 0, 8, 0, 0}, + { Areas::arNarimsCave , AreaType::atCave , 0, 115, 0, 9, 0, 0}, + { Areas::arEmbalmersCave, AreaType::atCave , 0, 118, 0, 10, 0, 0}, + { Areas::arWhiteArch , AreaType::atCave , 0, 122, 0, 11, 0, 0}, + { Areas::arMoorkusLair , AreaType::atCave , 0, 127, 0, 12, 0, 0} +}; + +int16 tab_2CEF0[64] = { + 25, 257, 0, 0, 37, 258, 38, 259, 0, 0, 24, 260, 0, 0, 0, 0, + 0, 0, 53, 265, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 39, 261, 0, 0, 40, 262, 62, 263, 0, 0, 63, 264, 0, 0, 0, 0, + 18, 275, 0, 0, 35, 254, 36, 255, 19, 318, 23, 256, 0, 0, 0, 0 +}; + +int16 tab_2CF70[64] = { + 65, 266, 0, 0, 66, 267, 67, 268, 0, 0, 68, 269, 0, 0, 0, 0, + 0, 0, 73, 274, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 69, 270, 0, 0, 70, 271, 71, 272, 0, 0, 72, 273, 0, 0, 0, 0, + 18, 275, 0, 0, 35, 254, 36, 255, 19, 318, 23, 256, 0, 0, 0, 0, +}; + +byte kActionCursors[299] = { + 3, 1, 2, 4, 5, 5, 5, 0, 5, 5, + 5, 5, 5, 3, 2, 5, 5, 5, 3, 2, + 4, 5, 7, 7, 4, 5, 5, 0, 0, 0, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 0, 0, 0, 0, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, + 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 0, 0, 0, 0, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 0, 5, 6, + 6, 1, 6, 6, 0, 0, 6, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 6, 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, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 0, 0, 6, 6, + 53, 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 +}; -- cgit v1.2.3 From 77f11945865e02c6f2f30409ccae938fc1e3800d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 10 Feb 2017 11:51:58 +0200 Subject: CRYO: Move all static data for Lost Eden to cryo.dat (2/2) --- engines/cryo/defs.h | 27 --- engines/cryo/eden.cpp | 128 +++++++++++- engines/cryo/eden.h | 28 ++- engines/cryo/module.mk | 1 - engines/cryo/staticdata.cpp | 487 -------------------------------------------- 5 files changed, 151 insertions(+), 520 deletions(-) delete mode 100644 engines/cryo/staticdata.cpp diff --git a/engines/cryo/defs.h b/engines/cryo/defs.h index b7206dc7e4..e646b9fc72 100644 --- a/engines/cryo/defs.h +++ b/engines/cryo/defs.h @@ -783,33 +783,6 @@ enum { LAB_W }; -extern byte kLabyrinthPath[]; - -extern char kDinoSpeedForCitaLevel[16]; - -extern char kTabletView[]; - -// special character backgrounds for specific rooms -extern char kPersoRoomBankTable[]; - -// area transition descriptors -extern Goto gotos[]; -extern object_t _objects[]; -extern uint16 kObjectLocations[100]; -extern perso_t kPersons[]; -extern Citadel _citadelList[]; - -struct prect_t { - int16 left, top, right, bottom; -}; - -extern prect_t _characterRects[]; -extern byte _characterArray[][5]; -extern Area kAreasTable[]; -extern int16 tab_2CEF0[64]; -extern int16 tab_2CF70[64]; -extern int16 kActionCursors[299]; - struct CubeFace { int tri; char ff_4; diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp index 214744f530..47cd1e05a3 100644 --- a/engines/cryo/eden.cpp +++ b/engines/cryo/eden.cpp @@ -4732,6 +4732,42 @@ void EdenGame::loadpermfiles() { Common::File f; const int kNumIcons = 136; const int kNumRooms = 424; + 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 kNumAreas = 12; + // tab_2CEF0 + // tab_2CF70 + const int kNumActionCursors = 299; + + const int expectedDataSize = + kNumIcons * sizeof(Icon) + + kNumRooms * sizeof(Room) + + kNumFollowers * sizeof(Follower) + + kNumLabyrinthPath + + kNumDinoSpeedForCitaLevel + + kNumTabletView + + kNumPersoRoomBankTable + + kNumGotos * sizeof(Goto) + + kNumObjects * sizeof(object_t) + + kNumObjectLocations * 2 + + kNumPersons * sizeof(perso_t) + + kNumCitadel * sizeof(Citadel) + + kNumCharacterRects * 8 + + kNumCharacters * 5 + + kNumAreas * (sizeof(Area) - 4) + + 64 * 2 + + 64 * 2 + + kNumActionCursors; if (f.open("cryo.dat")) { const int dataSize = f.size() - 8 - 1; // CRYODATA + version @@ -4745,8 +4781,8 @@ void EdenGame::loadpermfiles() { if (f.readByte() != CRYO_DAT_VER) error("Incorrect aux data version"); - if (dataSize != kNumIcons * sizeof(Icon) + kNumRooms * sizeof(Room)) - error("Mismatching data in aux data file"); + if (dataSize != expectedDataSize) + error("Mismatching data in aux data file (got %d, expected %d)", dataSize, expectedDataSize); } else error("Can not load aux data"); @@ -4763,7 +4799,7 @@ void EdenGame::loadpermfiles() { _gameIcons[i]._objectId = f.readUint32LE(); } - for (int i = 0; i _name.c_str(), offs, size); _bigfile.seek(offs, SEEK_SET); - int count = size / sizeof(Icon); + int count = size / 14; // sizeof(Icon) for (int i = 0; i < count; i++) { if (_vm->getPlatform() == Common::kPlatformMacintosh) { buffer[i].sx = _bigfile.readSint16BE(); @@ -4638,7 +4638,7 @@ void EdenGame::loadRoomFile(uint16 num, Room *buffer) { debug("* Loading room - Resource %d (%s) at 0x%X, %d bytes", num, file->_name.c_str(), offs, size); _bigfile.seek(offs, SEEK_SET); - int count = size / sizeof(Room); + int count = size / 11; // sizeof(Room) for (int i = 0; i < count; i++) { buffer[i]._id = _bigfile.readByte(); for (int j = 0; j < 4; j++) @@ -4750,21 +4750,21 @@ void EdenGame::loadpermfiles() { const int kNumActionCursors = 299; const int expectedDataSize = - kNumIcons * sizeof(Icon) + - kNumRooms * sizeof(Room) + - kNumFollowers * sizeof(Follower) + + kNumIcons * 14 + // sizeof(Icon) + kNumRooms * 11 + // sizeof(Room) + kNumFollowers * 16 + // sizeof(Follower) kNumLabyrinthPath + kNumDinoSpeedForCitaLevel + kNumTabletView + kNumPersoRoomBankTable + - kNumGotos * sizeof(Goto) + - kNumObjects * sizeof(object_t) + + kNum_gotos * 5 + // sizeof(Goto) + kNumObjects * 10 + // sizeof(object_t) kNumObjectLocations * 2 + - kNumPersons * sizeof(perso_t) + - kNumCitadel * sizeof(Citadel) + + kNumPersons * 18 + // sizeof(perso_t) + kNumCitadel * 6 + // sizeof(Citadel) kNumCharacterRects * 8 + kNumCharacters * 5 + - kNumAreas * (sizeof(Area) - 4) + + kNumAreas * 10 + // (sizeof(Area) - 4) 64 * 2 + 64 * 2 + kNumActionCursors; @@ -4819,7 +4819,7 @@ void EdenGame::loadpermfiles() { convertMacToPC(); // Skip the icons and rooms of the DOS version - f.skip(kNumIcons * sizeof(Icon) + kNumRooms * sizeof(Room)); + f.skip(kNumIcons * 14 + kNumRooms * 11); break; default: error("Unsupported platform"); @@ -4843,7 +4843,7 @@ void EdenGame::loadpermfiles() { f.read(kDinoSpeedForCitaLevel, kNumDinoSpeedForCitaLevel); f.read(kTabletView, kNumTabletView); f.read(kPersoRoomBankTable, kNumPersoRoomBankTable); - f.read(gotos, kNumGotos * sizeof(Goto)); + f.read(gotos, kNumGotos * 5); // sizeof(Goto) for (int i = 0; i < kNumObjects; i++) { _objects[i]._id = f.readByte(); -- 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 ++ devtools/create_cryo/eden_static.h | 62 ++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) 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) { diff --git a/devtools/create_cryo/eden_static.h b/devtools/create_cryo/eden_static.h index fe4ff20e3b..4bff896869 100644 --- a/devtools/create_cryo/eden_static.h +++ b/devtools/create_cryo/eden_static.h @@ -477,3 +477,65 @@ byte kActionCursors[299] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +byte mapMode[12] = { 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 2, 0 }; + +// Cube faces to texture coords mapping +// each entry is num_polys(6) * num_faces_per_poly(2) * vertex_per_face(3) * uv(2) +byte cubeTextureCoords[3][6 * 2 * 3 * 2] = { + { + 32, 32, 0, 32, 0, 0, + 32, 32, 0, 0, 32, 0, + + 0, 32, 0, 0, 32, 0, + 0, 32, 32, 0, 32, 32, + + 32, 32, 0, 32, 0, 0, + 32, 32, 0, 0, 32, 0, + + 32, 0, 32, 32, 0, 32, + 32, 0, 0, 32, 0, 0, + + 0, 0, 32, 0, 32, 32, + 0, 0, 32, 32, 0, 32, + + 0, 32, 0, 0, 32, 0, + 0, 32, 32, 0, 32, 32 + }, { + 32, 32, 0, 32, 0, 0, + 32, 32, 0, 0, 32, 0, + + 32, 0, 32, 32, 0, 32, + 32, 0, 0, 32, 0, 0, + + 32, 0, 32, 32, 0, 32, + 32, 0, 0, 32, 0, 0, + + 0, 32, 0, 0, 32, 0, + 0, 32, 32, 0, 32, 32, + + 32, 0, 32, 32, 0, 32, + 32, 0, 0, 32, 0, 0, + + 32, 0, 32, 32, 0, 32, + 32, 0, 0, 32, 0, 0 + }, { + 30, 30, 2, 30, 2, 2, + 30, 30, 2, 2, 30, 2, + + 2, 30, 2, 2, 30, 2, + 2, 30, 30, 2, 30, 30, + + 30, 30, 2, 30, 2, 2, + 30, 30, 2, 2, 30, 2, + + 30, 2, 30, 30, 2, 30, + 30, 2, 2, 30, 2, 2, + + 2, 2, 30, 2, 30, 30, + 2, 2, 30, 30, 2, 30, + + 2, 30, 2, 2, 30, 2, + 2, 30, 30, 2, 30, 30 + } +}; \ No newline at end of file -- cgit v1.2.3 From 05c99c5b0d2103bbbceeb68520484cc5ecbd0360 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 11 Feb 2017 17:16:45 +0200 Subject: CRYO: Move more static data to cryo.dat (2/2) --- engines/cryo/eden.cpp | 70 ++++----------------------------------------------- engines/cryo/eden.h | 3 ++- 2 files changed, 7 insertions(+), 66 deletions(-) diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp index 49ede20e32..b0175e3970 100644 --- a/engines/cryo/eden.cpp +++ b/engines/cryo/eden.cpp @@ -4911,6 +4911,8 @@ void EdenGame::loadpermfiles() { } f.read(kActionCursors, kNumActionCursors); + f.read(_mapMode, 12); + f.read(_cubeTextureCoords, 3 * 6 * 2 * 3 * 2); f.close(); @@ -8829,77 +8831,15 @@ int EdenGame::nextVal(char **ptr, char *error) { } void EdenGame::selectMap(int16 num) { - static const char mapMode[12] = { 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 2, 0 }; - // Cube faces to texture coords mapping - // each entry is num_polys(6) * num_faces_per_poly(2) * vertex_per_face(3) * uv(2) - - static const int16 cube_texcoords[3][6 * 2 * 3 * 2] = { - { - 32, 32, 0, 32, 0, 0, - 32, 32, 0, 0, 32, 0, - - 0, 32, 0, 0, 32, 0, - 0, 32, 32, 0, 32, 32, - - 32, 32, 0, 32, 0, 0, - 32, 32, 0, 0, 32, 0, - - 32, 0, 32, 32, 0, 32, - 32, 0, 0, 32, 0, 0, - - 0, 0, 32, 0, 32, 32, - 0, 0, 32, 32, 0, 32, - - 0, 32, 0, 0, 32, 0, - 0, 32, 32, 0, 32, 32 - }, { - 32, 32, 0, 32, 0, 0, - 32, 32, 0, 0, 32, 0, - - 32, 0, 32, 32, 0, 32, - 32, 0, 0, 32, 0, 0, - - 32, 0, 32, 32, 0, 32, - 32, 0, 0, 32, 0, 0, - - 0, 32, 0, 0, 32, 0, - 0, 32, 32, 0, 32, 32, - - 32, 0, 32, 32, 0, 32, - 32, 0, 0, 32, 0, 0, - - 32, 0, 32, 32, 0, 32, - 32, 0, 0, 32, 0, 0 - }, { - 30, 30, 2, 30, 2, 2, - 30, 30, 2, 2, 30, 2, - - 2, 30, 2, 2, 30, 2, - 2, 30, 30, 2, 30, 30, - - 30, 30, 2, 30, 2, 2, - 30, 30, 2, 2, 30, 2, - - 30, 2, 30, 30, 2, 30, - 30, 2, 2, 30, 2, 2, - - 2, 2, 30, 2, 30, 30, - 2, 2, 30, 30, 2, 30, - - 2, 30, 2, 2, 30, 2, - 2, 30, 30, 2, 30, 30 - } - }; - _cursCurPCMap = num; int16 k = 0; - int mode = mapMode[num]; + int mode = _mapMode[num]; int16 x = (num & 7) * 32; int16 y = (num & 0x18) * 4; for (int i = 0; i < 6 * 2; i++) { for (int j = 0; j < 3; j++) { - _cube._faces[i]->_uv[j * 2 ] = x + cube_texcoords[mode][k++]; - _cube._faces[i]->_uv[j * 2 + 1] = y + cube_texcoords[mode][k++]; + _cube._faces[i]->_uv[j * 2 ] = x + _cubeTextureCoords[mode][k++]; + _cube._faces[i]->_uv[j * 2 + 1] = y + _cubeTextureCoords[mode][k++]; } } } diff --git a/engines/cryo/eden.h b/engines/cryo/eden.h index 1abc364d2b..79ea63a43c 100644 --- a/engines/cryo/eden.h +++ b/engines/cryo/eden.h @@ -759,7 +759,8 @@ private: int16 tab_2CEF0[64]; int16 tab_2CF70[64]; byte kActionCursors[299]; - + byte _mapMode[12]; + byte _cubeTextureCoords[3][6 * 2 * 3 * 2]; float _translationZ = -3400; float flt_2DF80 = -3400; float flt_2DF84 = 200; -- cgit v1.2.3 From 24a4c231dabcea6d35c909a1731e59af209f4496 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 11 Feb 2017 17:20:54 +0200 Subject: CRYO: Rename variables to conform to our formatting guidelines --- engines/cryo/defs.h | 4 +- engines/cryo/eden.cpp | 444 +++++++++++++++++++++++++------------------------- engines/cryo/eden.h | 18 +- 3 files changed, 233 insertions(+), 233 deletions(-) diff --git a/engines/cryo/defs.h b/engines/cryo/defs.h index e646b9fc72..7952fef9ac 100644 --- a/engines/cryo/defs.h +++ b/engines/cryo/defs.h @@ -312,7 +312,7 @@ struct perso_t { uint16 _partyMask; // party bit mask byte _id; // character byte _flags; // flags and kind - byte _roomBankId;// index in kPersoRoomBankTable for specific room banks + byte _roomBankId;// index in _personRoomBankTable for specific room banks byte _spriteBank; // sprite bank uint16 _items; // inventory uint16 _powers; // obj of power bitmask @@ -340,7 +340,7 @@ enum ObjectFlags { struct object_t { byte _id; byte _flags; - int _locations; // index in kObjectLocations + int _locations; // index in _objectLocations uint16 _itemMask; uint16 _powerMask; // object of power bitmask int16 _count; diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp index b0175e3970..b6064c70b9 100644 --- a/engines/cryo/eden.cpp +++ b/engines/cryo/eden.cpp @@ -302,7 +302,7 @@ void EdenGame::characterInMirror() { displayFollower(suiveur, suiveur->sx, suiveur->sy); for (; suiveur->_id != -1; suiveur++) { perso_t *perso; - for (perso = kPersons; perso != &kPersons[PER_UNKN_156]; perso++) { + for (perso = _persons; perso != &_persons[PER_UNKN_156]; perso++) { if (perso->_id != suiveur->_id) continue; @@ -358,7 +358,7 @@ void EdenGame::flipMode() { if (_personTalking) { endCharacterSpeech(); if (_globals->_displayFlags == DisplayFlags::dfPerson) { - if (_globals->_characterPtr == &kPersons[PER_TAU] && _globals->_phaseNum >= 80) + if (_globals->_characterPtr == &_persons[PER_TAU] && _globals->_phaseNum >= 80) displaySubtitles(); else { getDataSync(); @@ -510,7 +510,7 @@ void EdenGame::deplaval(uint16 roomNum) { if (c1 == 0xFF) { _globals->_eventType = EventType::etEventE; showEvents(); - if (!kPersons[PER_ELOI]._roomNum && checkEloiReturn()) + if (!_persons[PER_ELOI]._roomNum && checkEloiReturn()) setChrono(800); return; } @@ -526,9 +526,9 @@ void EdenGame::deplaval(uint16 roomNum) { newRoomNum |= 1; _globals->_newRoomNum = newRoomNum; if (newAreaNum == Areas::arTausCave) - gotoPlace(&gotos[0]); + gotoPlace(&_gotos[0]); else { - for (Goto *go = gotos + 1; go->_curAreaNum != 0xFF; go++) { + for (Goto *go = _gotos + 1; go->_curAreaNum != 0xFF; go++) { if (go->_curAreaNum == curAreaNum) { gotoPlace(go); break; @@ -707,7 +707,7 @@ void EdenGame::actionChoose() { // Original name: dinaparle void EdenGame::handleDinaDialog() { - perso_t *perso = &kPersons[PER_DINA]; + perso_t *perso = &_persons[PER_DINA]; if (perso->_partyMask & (_globals->_party | _globals->_partyOutside)) { if (_globals->_frescoNumber < 3) _globals->_frescoNumber = 3; @@ -873,7 +873,7 @@ void EdenGame::actionGetTablet() { // Original name: voirlac void EdenGame::actionLookLake() { - perso_t *perso = &kPersons[PER_MORKUS]; + perso_t *perso = &_persons[PER_MORKUS]; Room *room = _globals->_roomPtr; Area *area = _globals->_areaPtr; int16 vid = _globals->_curObjectId == Objects::obApple ? 81 : 54; @@ -1610,7 +1610,7 @@ void EdenGame::drawTopScreen() { // Draw top bar (location / party / map) noclipax(36, 83, 0); noclipax(_globals->_areaPtr->_num - 1, 0, 0); noclipax(23, 145, 0); - for (perso_t *perso = &kPersons[PER_DINA]; perso != &kPersons[PER_UNKN_156]; perso++) { + for (perso_t *perso = &_persons[PER_DINA]; perso != &_persons[PER_UNKN_156]; perso++) { if ((perso->_flags & PersonFlags::pfInParty) && !(perso->_flags & PersonFlags::pf80)) noclipax(perso->_targetLoc + 18, perso->_lastLoc + 120, 0); } @@ -1624,7 +1624,7 @@ void EdenGame::drawTopScreen() { // Draw top bar (location / party / map) void EdenGame::displayValleyMap() { // Draw mini-map if (_globals->_areaPtr->_type == AreaType::atValley) { noclipax(_globals->_areaPtr->_num + 9, 266, 1); - for (perso_t *perso = &kPersons[PER_UNKN_18C]; perso->_roomNum != 0xFFFF; perso++) { + for (perso_t *perso = &_persons[PER_UNKN_18C]; perso->_roomNum != 0xFFFF; perso++) { if (((perso->_roomNum >> 8) == _globals->_areaNum) && !(perso->_flags & PersonFlags::pf80) && (perso->_flags & PersonFlags::pf20)) displayMapMark(33, perso->_roomNum & 0xFF); @@ -1716,7 +1716,7 @@ void EdenGame::saveAdamMapMark(int16 x, int16 y) { bool EdenGame::istrice(int16 roomNum) { char loc = roomNum & 0xFF; int16 area = roomNum & 0xFF00; - for (perso_t *perso = &kPersons[PER_UNKN_18C]; perso != &kPersons[PER_UNKN_372]; perso++) { + for (perso_t *perso = &_persons[PER_UNKN_18C]; perso != &_persons[PER_UNKN_372]; perso++) { if ((perso->_flags & PersonFlags::pf80) || (perso->_flags & PersonFlags::pfTypeMask) != PersonFlags::pftTriceraptor) continue; if (perso->_roomNum == (area | (loc - 16))) @@ -1735,7 +1735,7 @@ bool EdenGame::istyran(int16 roomNum) { char loc = roomNum & 0xFF; int16 area = roomNum & 0xFF00; // TODO: orig bug: this ptr is not initialized when first called from getsalle - // PC version scans kPersons[] directly and is not affected + // PC version scans _persons[] directly and is not affected if (!_tyranPtr) return false; @@ -1757,7 +1757,7 @@ bool EdenGame::istyran(int16 roomNum) { void EdenGame::istyranval(Area *area) { byte areaNum = area->_num; area->_flags &= ~AreaFlags::HasTyrann; - for (perso_t *perso = &kPersons[PER_UNKN_372]; perso->_roomNum != 0xFFFF; perso++) { + for (perso_t *perso = &_persons[PER_UNKN_372]; perso->_roomNum != 0xFFFF; perso++) { if (perso->_flags & PersonFlags::pf80) continue; @@ -1808,7 +1808,7 @@ bool EdenGame::canMoveThere(char loc, perso_t *perso) { continue; if (!(room->_flags & RoomFlags::rf01)) return false; - for (perso = &kPersons[PER_UNKN_18C]; perso->_roomNum != 0xFFFF; perso++) { + for (perso = &_persons[PER_UNKN_18C]; perso->_roomNum != 0xFFFF; perso++) { if (perso->_flags & PersonFlags::pf80) continue; if (perso->_roomNum == roomNum) @@ -1849,7 +1849,7 @@ void EdenGame::scrambleDirections() { } bool EdenGame::naitredino(char persoType) { - for (perso_t *perso = &kPersons[PER_MORKUS]; (++perso)->_roomNum != 0xFFFF;) { + for (perso_t *perso = &_persons[PER_MORKUS]; (++perso)->_roomNum != 0xFFFF;) { char areaNum = perso->_roomNum >> 8; if (areaNum != _globals->_citadelAreaNum) continue; @@ -1879,7 +1879,7 @@ void EdenGame::newCitadel(char area, int16 level, Room *room) { // Original name: citaevol void EdenGame::evolveCitadel(int16 level) { Room *room = _globals->_curAreaPtr->_citadelRoomPtr; - perso_t *perso = &kPersons[PER_UNKN_372]; + perso_t *perso = &_persons[PER_UNKN_372]; byte loc = room->_location; if (level >= 80 && !istrice((_globals->_citadelAreaNum << 8) | loc)) { room->_level = 79; @@ -1899,7 +1899,7 @@ void EdenGame::evolveCitadel(int16 level) { } room->_level = level; newCitadel(_globals->_citadelAreaNum, level, room); - byte speed = kDinoSpeedForCitaLevel[room->_level >> 4]; + byte speed = _dinoSpeedForCitadelLevel[room->_level >> 4]; for (; perso->_roomNum != 0xFFFF; perso++) { if (perso->_flags & PersonFlags::pf80) continue; @@ -1910,7 +1910,7 @@ void EdenGame::evolveCitadel(int16 level) { // Original name: citacapoute void EdenGame::destroyCitadelRoom(int16 roomNum) { - perso_t *perso = &kPersons[PER_UNKN_18C]; + perso_t *perso = &_persons[PER_UNKN_18C]; Room *room = _globals->_curAreaPtr->_citadelRoomPtr; room->_flags |= RoomFlags::rf01; room->_flags &= ~RoomFlags::rfHasCitadel; @@ -1974,7 +1974,7 @@ void EdenGame::buildCitadel() { Room *room = _globals->_curAreaPtr->_citadelRoomPtr; byte loc = room->_location; - _tyranPtr = &kPersons[PER_UNKN_372]; + _tyranPtr = &_persons[PER_UNKN_372]; if (istyran((_globals->_citadelAreaNum << 8) | loc)) { if (!(_globals->_curAreaPtr->_flags & AreaFlags::TyrannSighted)) { addInfo(_globals->_citadelAreaNum + ValleyNews::vnTyrannIn); @@ -2041,7 +2041,7 @@ void EdenGame::moveDino(perso_t *perso) { // Original name: deplaalldino void EdenGame::moveAllDino() { - for (perso_t *perso = &kPersons[PER_UNKN_18C]; perso->_roomNum != 0xFFFF; perso++) { + for (perso_t *perso = &_persons[PER_UNKN_18C]; perso->_roomNum != 0xFFFF; perso++) { if (((perso->_roomNum >> 8) & 0xFF) != _globals->_citadelAreaNum) continue; if ((perso->_flags & PersonFlags::pf80) || !perso->_targetLoc) @@ -2060,7 +2060,7 @@ void EdenGame::moveAllDino() { void EdenGame::newValley() { static int16 roomNumList[] = { 2075, 2080, 2119, -1}; - perso_t *perso = &kPersons[PER_UNKN_372]; + perso_t *perso = &_persons[PER_UNKN_372]; int16 *ptr = roomNumList; int16 roomNum = *ptr++; while (roomNum != -1) { @@ -2071,7 +2071,7 @@ void EdenGame::newValley() { roomNum = *ptr++; } perso->_roomNum = 0xFFFF; - kAreasTable[7]._flags |= AreaFlags::HasTyrann; + _areasTable[7]._flags |= AreaFlags::HasTyrann; _globals->_worldHasTyran = 32; } @@ -2140,7 +2140,7 @@ void EdenGame::placeVava(Area *area) { } void EdenGame::vivredino() { - for (perso_t *perso = &kPersons[PER_UNKN_18C]; perso->_roomNum != 0xFFFF; perso++) { + for (perso_t *perso = &_persons[PER_UNKN_18C]; perso->_roomNum != 0xFFFF; perso++) { if (((perso->_roomNum >> 8) & 0xFF) != _globals->_citadelAreaNum) continue; if (perso->_flags & PersonFlags::pf80) @@ -2175,7 +2175,7 @@ void EdenGame::vivredino() { case PersonFlags::pftVelociraptor: if (perso->_flags & PersonFlags::pf10) { if (perso->_roomNum == _globals->_roomNum) { - perso_t *perso2 = &kPersons[PER_UNKN_372]; + perso_t *perso2 = &_persons[PER_UNKN_372]; bool found = false; for (; perso2->_roomNum != 0xFFFF; perso2++) { if ((perso->_roomNum & ~0xFF) == (perso2->_roomNum & ~0xFF)) { @@ -2190,7 +2190,7 @@ void EdenGame::vivredino() { if (found) continue; } else { - _tyranPtr = &kPersons[PER_UNKN_372]; + _tyranPtr = &_persons[PER_UNKN_372]; if (istyran(perso->_roomNum)) { if (_globals->_phaseNum < 481 && (perso->_powers & (1 << (_globals->_citadelAreaNum - 3)))) { _tyranPtr->_flags |= PersonFlags::pf80; @@ -2230,7 +2230,7 @@ void EdenGame::vivredino() { void EdenGame::vivreval(int16 areaNum) { _globals->_citadelAreaNum = areaNum; - _globals->_curAreaPtr = &kAreasTable[areaNum - 1]; + _globals->_curAreaPtr = &_areasTable[areaNum - 1]; _globals->_citaAreaFirstRoom = &_gameRooms[_globals->_curAreaPtr->_firstRoomIdx]; moveAllDino(); buildCitadel(); @@ -2359,7 +2359,7 @@ void EdenGame::addanim() { _globals->_curCharacterAnimPtr = _globals->_persoSpritePtr; getanimrnd(); _animationActive = true; - if (_globals->_characterPtr == &kPersons[PER_KING]) + if (_globals->_characterPtr == &_persons[PER_KING]) return; setCharacterSprite(_globals->_persoSpritePtr + READ_LE_UINT16(_globals->_persoSpritePtr)); //TODO: GetElem(0) _mouthAnimations = _imageDesc + 200; @@ -2671,7 +2671,7 @@ void EdenGame::displayBackgroundFollower() { void EdenGame::displayNoFollower(int16 bank) { if (bank) { useBank(bank); - if (_globals->_characterPtr == &kPersons[PER_UNKN_156]) + if (_globals->_characterPtr == &_persons[PER_UNKN_156]) noclipax_avecnoir(0, 0, 16); else noclipax(0, 0, 16); @@ -2682,7 +2682,7 @@ void EdenGame::displayNoFollower(int16 bank) { void EdenGame::displayCharacterBackground1() { byte bank; char *ptab; - if (_globals->_characterPtr == &kPersons[PER_ELOI]) { + if (_globals->_characterPtr == &_persons[PER_ELOI]) { _gameIcons[0].sx = 0; _characterRects[PER_ELOI].left = 2; bank = _globals->_characterBackgroundBankIdx; @@ -2694,14 +2694,14 @@ void EdenGame::displayCharacterBackground1() { _gameIcons[0].sx = 60; _characterRects[PER_ELOI].left = 62; } - if (_globals->_characterPtr == &kPersons[PER_TAU]) { + if (_globals->_characterPtr == &_persons[PER_TAU]) { bank = 37; if (_globals->_curObjectId == Objects::obShell) { displayNoFollower(bank); return; } } - ptab = kPersoRoomBankTable + _globals->_characterPtr->_roomBankId; + ptab = _personRoomBankTable + _globals->_characterPtr->_roomBankId; bank = *ptab++; if (!(_globals->_characterPtr->_partyMask & _globals->_party)) { while ((bank = *ptab++) != 0xFF) { @@ -2712,7 +2712,7 @@ void EdenGame::displayCharacterBackground1() { ptab++; } if (bank == 0xFF) { - ptab = kPersoRoomBankTable + _globals->_characterPtr->_roomBankId; + ptab = _personRoomBankTable + _globals->_characterPtr->_roomBankId; bank = *ptab++; } } @@ -2733,7 +2733,7 @@ void EdenGame::setCharacterIcon() { if (_globals->_iconsIndex == 4) return; - if (_globals->_characterPtr == &kPersons[PER_ELOI] && _globals->_eventType == EventType::etEventE) { + if (_globals->_characterPtr == &_persons[PER_ELOI] && _globals->_eventType == EventType::etEventE) { _globals->_iconsIndex = 123; return; } @@ -2758,7 +2758,7 @@ void EdenGame::showCharacter() { loadCharacter(perso); setCharacterIcon(); displayCharacterBackground(); - if (perso == &kPersons[PER_TAU] && _globals->_curObjectId == Objects::obShell) { + if (perso == &_persons[PER_TAU] && _globals->_curObjectId == Objects::obShell) { displaySubtitles(); updateCursor(); _paletteUpdateRequired = true; @@ -2775,10 +2775,10 @@ void EdenGame::showCharacter() { } _restartAnimation = true; animCharacter(); - if (perso != &kPersons[PER_UNKN_156]) + if (perso != &_persons[PER_UNKN_156]) updateCursor(); _paletteUpdateRequired = true; - if (perso != &kPersons[PER_UNKN_156]) + if (perso != &_persons[PER_UNKN_156]) rundcurs(); display(); } else { @@ -2801,10 +2801,10 @@ void EdenGame::displayCharacterPanel() { if (_globals->_drawFlags & DrawFlags::drDrawFlag8) return; animCharacter(); - if (perso != &kPersons[PER_UNKN_156]) + if (perso != &_persons[PER_UNKN_156]) updateCursor(); display(); - if (perso != &kPersons[PER_UNKN_156]) + if (perso != &_persons[PER_UNKN_156]) rundcurs(); _globals->_drawFlags |= DrawFlags::drDrawFlag8; _globals->_iconsIndex = 112; @@ -3249,7 +3249,7 @@ void EdenGame::parle_moi() { if (!ok) { parlemoiNormalFlag = true; if (_globals->_var60) { - if (_globals->_characterPtr == &kPersons[PER_ELOI]) { + if (_globals->_characterPtr == &_persons[PER_ELOI]) { _globals->_dialogType = DialogType::dtTalk; if (_globals->_eloiHaveNews) parlemoi_normal(); @@ -3278,7 +3278,7 @@ void EdenGame::initCharacterPointers(perso_t *perso) { void EdenGame::perso1(perso_t *perso) { _globals->_phaseActionsCount++; - if (perso == &kPersons[PER_TAU]) + if (perso == &_persons[PER_TAU]) _globals->_phaseActionsCount--; _globals->_characterPtr = perso; initCharacterPointers(perso); @@ -3294,7 +3294,7 @@ void EdenGame::perso_normal(perso_t *perso) { // Original name: persoparle void EdenGame::handleCharacterDialog(int16 pers) { - perso_t *perso = &kPersons[pers]; + perso_t *perso = &_persons[pers]; _globals->_characterPtr = perso; _globals->_dialogType = DialogType::dtInspect; uint16 idx = perso->_id * 8 | _globals->_dialogType; @@ -3308,53 +3308,53 @@ void EdenGame::handleCharacterDialog(int16 pers) { // Original name: roi void EdenGame::actionKing() { - perso_normal(&kPersons[PER_KING]); + perso_normal(&_persons[PER_KING]); } // Original name: dina void EdenGame::actionDina() { - perso_normal(&kPersons[PER_DINA]); + perso_normal(&_persons[PER_DINA]); } // Original name: thoo void EdenGame::actionThoo() { - perso_normal(&kPersons[PER_TAU]); + perso_normal(&_persons[PER_TAU]); } // Original name: monk void EdenGame::actionMonk() { - perso_normal(&kPersons[PER_MONK]); + perso_normal(&_persons[PER_MONK]); } // Original name: bourreau void EdenGame::actionTormentor() { - perso_normal(&kPersons[PER_JABBER]); + perso_normal(&_persons[PER_JABBER]); } // Original name: messager void EdenGame::actionMessenger() { - perso_normal(&kPersons[PER_ELOI]); + perso_normal(&_persons[PER_ELOI]); } // Original name: mango void EdenGame::actionMango() { - perso_normal(&kPersons[PER_MUNGO]); + perso_normal(&_persons[PER_MUNGO]); } // Original name: eve void EdenGame::actionEve() { - perso_normal(&kPersons[PER_EVE]); + perso_normal(&_persons[PER_EVE]); } // Original name: azia void EdenGame::actionAzia() { - perso_normal(&kPersons[PER_SHAZIA]); + perso_normal(&_persons[PER_SHAZIA]); } // Original name: mammi void EdenGame::actionMammi() { perso_t *perso; - for (perso = &kPersons[PER_MAMMI]; perso->_partyMask == PersonMask::pmLeader; perso++) { + for (perso = &_persons[PER_MAMMI]; perso->_partyMask == PersonMask::pmLeader; perso++) { if (perso->_roomNum == _globals->_roomNum) { perso_normal(perso); break; @@ -3364,23 +3364,23 @@ void EdenGame::actionMammi() { // Original name: gardes void EdenGame::actionGuards() { - perso_normal(&kPersons[PER_GUARDS]); + perso_normal(&_persons[PER_GUARDS]); } // Original name: bambou void EdenGame::actionBamboo() { - perso_normal(&kPersons[PER_BAMBOO]); + perso_normal(&_persons[PER_BAMBOO]); } // Original name: kabuka void EdenGame::actionKabuka() { - if (_globals->_roomNum == 0x711) perso_normal(&kPersons[PER_KABUKA]); + if (_globals->_roomNum == 0x711) perso_normal(&_persons[PER_KABUKA]); else actionBamboo(); } // Original name: fisher void EdenGame::actionFisher() { - if (_globals->_roomNum == 0x902) perso_normal(&kPersons[PER_FISHER]); + if (_globals->_roomNum == 0x902) perso_normal(&_persons[PER_FISHER]); else actionKabuka(); } @@ -3405,13 +3405,13 @@ void EdenGame::actionDino() { waitEndSpeak(); if (_vm->shouldQuit()) return; - perso = &kPersons[PER_MUNGO]; + perso = &_persons[PER_MUNGO]; if (!(_globals->_party & PersonMask::pmMungo)) { - perso = &kPersons[PER_DINA]; + perso = &_persons[PER_DINA]; if (!(_globals->_party & PersonMask::pmDina)) { - perso = &kPersons[PER_EVE]; + perso = &_persons[PER_EVE]; if (!(_globals->_party & PersonMask::pmEve)) { - perso = &kPersons[PER_GUARDS]; + perso = &_persons[PER_GUARDS]; } } } @@ -3436,13 +3436,13 @@ void EdenGame::actionTyran() { _globals->_roomCharacterFlags = perso->_flags; _globals->_characterPtr = perso; initCharacterPointers(perso); - perso = &kPersons[PER_MUNGO]; + perso = &_persons[PER_MUNGO]; if (!(_globals->_party & PersonMask::pmMungo)) { - perso = &kPersons[PER_DINA]; + perso = &_persons[PER_DINA]; if (!(_globals->_party & PersonMask::pmDina)) { - perso = &kPersons[PER_EVE]; + perso = &_persons[PER_EVE]; if (!(_globals->_party & PersonMask::pmEve)) { - perso = &kPersons[PER_GUARDS]; + perso = &_persons[PER_GUARDS]; } } } @@ -3454,15 +3454,15 @@ void EdenGame::actionTyran() { // Original name: morkus void EdenGame::actionMorkus() { - perso_normal(&kPersons[PER_MORKUS]); + perso_normal(&_persons[PER_MORKUS]); } void EdenGame::comment() { - perso_t *perso = &kPersons[PER_DINA]; + perso_t *perso = &_persons[PER_DINA]; if (!(_globals->_party & PersonMask::pmDina)) { - perso = &kPersons[PER_EVE]; + perso = &_persons[PER_EVE]; if (!(_globals->_party & PersonMask::pmEve)) { - perso = &kPersons[PER_GUARDS]; + perso = &_persons[PER_GUARDS]; if (!(_globals->_party & PersonMask::pmThugg)) return; } @@ -3503,12 +3503,12 @@ void EdenGame::actionAdam() { updateRoom(_globals->_roomNum); } else { _globals->_dialogType = DialogType::dtHint; - perso1(&kPersons[PER_EVE]); + perso1(&_persons[PER_EVE]); } break; case Objects::obShell: _globals->_dialogType = DialogType::dtHint; - perso1(&kPersons[PER_TAU]); + perso1(&_persons[PER_TAU]); break; case Objects::obFlute: case Objects::obTrumpet: @@ -3528,7 +3528,7 @@ void EdenGame::actionAdam() { if ((_globals->_partyOutside & PersonMask::pmDina) && _globals->_curObjectId == Objects::obTablet1 && _globals->_phaseNum == 370) incPhase(); - char *objvid = &kTabletView[(_globals->_curObjectId - Objects::obTablet1) * 2]; + char *objvid = &_tabletView[(_globals->_curObjectId - Objects::obTablet1) * 2]; object_t *object = getObjectPtr(*objvid++); int16 vid = 84; if (!object->_count) @@ -3550,7 +3550,7 @@ void EdenGame::actionAdam() { case Objects::obDrum: if (_globals->_party & PersonMask::pmThugg) { _globals->_dialogType = DialogType::dtHint; - perso1(&kPersons[PER_GUARDS]); + perso1(&_persons[PER_GUARDS]); } break; default: @@ -3587,7 +3587,7 @@ void EdenGame::specialEmptyNest(perso_t *perso) { perso->_flags |= PersonFlags::pf10; _globals->_roomCharacterFlags |= PersonFlags::pf10; _globals->_gameFlags |= GameFlags::gfFlag400; - if (_globals->_characterPtr == &kPersons[PER_EVE]) { + if (_globals->_characterPtr == &_persons[PER_EVE]) { _globals->_areaPtr->_flags |= AreaFlags::afFlag4; _globals->_curAreaFlags |= AreaFlags::afFlag4; perso->_flags |= PersonFlags::pfInParty; @@ -3601,7 +3601,7 @@ void EdenGame::specialEmptyNest(perso_t *perso) { // Original name: SpcNido void EdenGame::specialNestWithEggs(perso_t *perso) { - if (perso == &kPersons[PER_GUARDS]) + if (perso == &_persons[PER_GUARDS]) giveObject(); } @@ -3630,7 +3630,7 @@ void EdenGame::specialGold(perso_t *perso) { // Original name: SpcPrisme void EdenGame::specialPrism(perso_t *perso) { - if (perso == &kPersons[PER_DINA]) { + if (perso == &_persons[PER_DINA]) { if (_globals->_partyOutside & PersonMask::pmMonk) _globals->_gameFlags |= GameFlags::gfPrismAndMonk; } @@ -3638,13 +3638,13 @@ void EdenGame::specialPrism(perso_t *perso) { // Original name: SpcTalisman void EdenGame::specialTalisman(perso_t *perso) { - if (perso == &kPersons[PER_DINA]) + if (perso == &_persons[PER_DINA]) addToParty(PER_DINA); } // Original name: SpcMasque void EdenGame::specialMask(perso_t *perso) { - if (perso == &kPersons[PER_BAMBOO]) { + if (perso == &_persons[PER_BAMBOO]) { dialautoon(); parlemoiNormalFlag = true; } @@ -3654,7 +3654,7 @@ void EdenGame::specialMask(perso_t *perso) { void EdenGame::specialBag(perso_t *perso) { if (_globals->_textToken1 != 3) return; - if (perso == &kPersons[PER_KABUKA] || perso == &kPersons[PER_MAMMI_3]) + if (perso == &_persons[PER_KABUKA] || perso == &_persons[PER_MAMMI_3]) loseObject(_curSpecialObject->_id); } @@ -3682,14 +3682,14 @@ void EdenGame::specialWeapons(perso_t *perso) { void EdenGame::specialInstrument(perso_t *perso) { if (!isAnswerYes()) return; - if (perso == &kPersons[PER_MONK]) { + if (perso == &_persons[PER_MONK]) { _globals->_partyInstruments &= ~1; //TODO: check me if (_curSpecialObject->_id == Objects::obRing) { _globals->_partyInstruments |= 1; _globals->_monkGotRing++; //TODO: |= 1 ? } } - if (perso == &kPersons[PER_GUARDS]) { + if (perso == &_persons[PER_GUARDS]) { _globals->_partyInstruments &= ~2; if (_curSpecialObject->_id == Objects::obDrum) _globals->_partyInstruments |= 2; @@ -3778,7 +3778,7 @@ void EdenGame::dialautooff() { void EdenGame::follow() { if (_globals->_roomCharacterType == PersonFlags::pfType12) { - debug("follow: hiding person %ld", _globals->_roomCharacterPtr - kPersons); + debug("follow: hiding person %ld", _globals->_roomCharacterPtr - _persons); _globals->_roomCharacterPtr->_flags |= PersonFlags::pf80; _globals->_roomCharacterPtr->_roomNum = 0; _globals->_gameFlags |= GameFlags::gfFlag8; @@ -3799,7 +3799,7 @@ void EdenGame::dialonfollow() { // Original name: abortdial void EdenGame::abortDialogue() { _globals->_varF6++; - if (_globals->_roomCharacterType != PersonFlags::pftTriceraptor || _globals->_characterPtr != &kPersons[PER_EVE]) + if (_globals->_roomCharacterType != PersonFlags::pftTriceraptor || _globals->_characterPtr != &_persons[PER_EVE]) return; _globals->_areaPtr->_flags |= AreaFlags::afFlag4; _globals->_curAreaFlags |= AreaFlags::afFlag4; @@ -3831,11 +3831,11 @@ void EdenGame::handleNarrator() { } _globals->_varF5 |= 0x80; _globals->_varF2 &= ~1; //TODO: check me - _globals->_characterPtr = &kPersons[PER_UNKN_156]; + _globals->_characterPtr = &_persons[PER_UNKN_156]; _globals->_var60 = 0; _globals->_eventType = 0; _globals->_var103 = 69; - if (dialogEvent(&kPersons[PER_UNKN_156])) { + if (dialogEvent(&_persons[PER_UNKN_156])) { _globals->_narratorDialogPtr = _globals->_dialogPtr; dialautoon(); _globals->_varF2 |= 1; @@ -3901,7 +3901,7 @@ byte *EdenGame::getPhrase(int16 id) { // Original name: gotocarte void EdenGame::actionGotoMap() { - Goto *go = &gotos[_curSpot2->_objectId]; + Goto *go = &_gotos[_curSpot2->_objectId]; endCharacterSpeech(); byte newArea = go->_areaNum; _globals->_newRoomNum = (go->_areaNum << 8) | 1; @@ -3935,7 +3935,7 @@ void EdenGame::record() { if (_globals->_curObjectId) return; - if (_globals->_characterPtr >= &kPersons[PER_UNKN_18C]) + if (_globals->_characterPtr >= &_persons[PER_UNKN_18C]) return; if (_globals->_eventType == EventType::etEventE || _globals->_eventType >= EventType::etGotoArea) @@ -3958,9 +3958,9 @@ void EdenGame::record() { } perso_t *perso = _globals->_characterPtr; - if (perso == &kPersons[PER_EVE]) - perso = _globals->_phaseNum >= 352 ? &kPersons[PER_UNKN_372] - : &kPersons[PER_UNKN_402]; + if (perso == &_persons[PER_EVE]) + perso = _globals->_phaseNum >= 352 ? &_persons[PER_UNKN_372] + : &_persons[PER_UNKN_402]; tape->_textNum = _globals->_textNum; tape->_perso = perso; tape->_party = _globals->_party; @@ -4018,7 +4018,7 @@ bool EdenGame::dial_scan(Dialog *dial) { if (!skipFl) { perso_t *perso; - for (perso = kPersons; !(perso->_partyMask == mask && perso->_roomNum == _globals->_roomNum); perso++) + for (perso = _persons; !(perso->_partyMask == mask && perso->_roomNum == _globals->_roomNum); perso++) ; //Find matching _globals->_characterPtr = perso; @@ -4089,7 +4089,7 @@ bool EdenGame::dialogEvent(perso_t *perso) { // Original name: stay_here void EdenGame::characterStayHere() { - if (_globals->_characterPtr == &kPersons[PER_DINA] && _globals->_roomNum == 260) + if (_globals->_characterPtr == &_persons[PER_DINA] && _globals->_roomNum == 260) _globals->_gameFlags |= GameFlags::gfFlag1000; removeCharacterFromParty(); } @@ -4162,9 +4162,9 @@ void EdenGame::setChrono(int16 t) { // Original name: prechargephrases void EdenGame::preloadDialogs(int16 vid) { - perso_t *perso = &kPersons[PER_MORKUS]; + perso_t *perso = &_persons[PER_MORKUS]; if (vid == 170) - perso = &kPersons[PER_UNKN_156]; + perso = &_persons[PER_UNKN_156]; _globals->_characterPtr = perso; _globals->_dialogType = DialogType::dtInspect; int num = (perso->_id << 3) | _globals->_dialogType; @@ -4757,7 +4757,7 @@ void EdenGame::loadpermfiles() { kNumDinoSpeedForCitaLevel + kNumTabletView + kNumPersoRoomBankTable + - kNum_gotos * 5 + // sizeof(Goto) + kNumGotos * 5 + // sizeof(Goto) kNumObjects * 10 + // sizeof(object_t) kNumObjectLocations * 2 + kNumPersons * 18 + // sizeof(perso_t) @@ -4839,11 +4839,11 @@ void EdenGame::loadpermfiles() { followerList[i].ff_E = f.readSint16LE(); } - f.read(kLabyrinthPath, kNumLabyrinthPath); - f.read(kDinoSpeedForCitaLevel, kNumDinoSpeedForCitaLevel); - f.read(kTabletView, kNumTabletView); - f.read(kPersoRoomBankTable, kNumPersoRoomBankTable); - f.read(gotos, kNumGotos * 5); // sizeof(Goto) + f.read(_labyrinthPath, kNumLabyrinthPath); + f.read(_dinoSpeedForCitadelLevel, kNumDinoSpeedForCitaLevel); + f.read(_tabletView, kNumTabletView); + f.read(_personRoomBankTable, kNumPersoRoomBankTable); + f.read(_gotos, kNumGotos * 5); // sizeof(Goto) for (int i = 0; i < kNumObjects; i++) { _objects[i]._id = f.readByte(); @@ -4855,23 +4855,23 @@ void EdenGame::loadpermfiles() { } for (int i = 0; i < kNumObjectLocations; i++) { - kObjectLocations[i] = f.readUint16LE(); + _objectLocations[i] = f.readUint16LE(); } for (int i = 0; i < kNumPersons; i++) { - kPersons[i]._roomNum = f.readUint16LE(); - kPersons[i]._actionId = f.readUint16LE(); - kPersons[i]._partyMask = f.readUint16LE(); - kPersons[i]._id = f.readByte(); - kPersons[i]._flags = f.readByte(); - kPersons[i]._roomBankId = f.readByte(); - kPersons[i]._spriteBank = f.readByte(); - kPersons[i]._items = f.readUint16LE(); - kPersons[i]._powers = f.readUint16LE(); - kPersons[i]._targetLoc = f.readByte(); - kPersons[i]._lastLoc = f.readByte(); - kPersons[i]._speed = f.readByte(); - kPersons[i]._steps = f.readByte(); + _persons[i]._roomNum = f.readUint16LE(); + _persons[i]._actionId = f.readUint16LE(); + _persons[i]._partyMask = f.readUint16LE(); + _persons[i]._id = f.readByte(); + _persons[i]._flags = f.readByte(); + _persons[i]._roomBankId = f.readByte(); + _persons[i]._spriteBank = f.readByte(); + _persons[i]._items = f.readUint16LE(); + _persons[i]._powers = f.readUint16LE(); + _persons[i]._targetLoc = f.readByte(); + _persons[i]._lastLoc = f.readByte(); + _persons[i]._speed = f.readByte(); + _persons[i]._steps = f.readByte(); } for (int i = 0; i < kNumCitadel; i++) { @@ -4892,14 +4892,14 @@ void EdenGame::loadpermfiles() { f.read(_characterArray, kNumCharacters * 5); for (int i = 0; i < kNumAreas; i++) { - kAreasTable[i]._num = f.readByte(); - kAreasTable[i]._type = f.readByte(); - kAreasTable[i]._flags = f.readUint16LE(); - kAreasTable[i]._firstRoomIdx = f.readUint16LE(); - kAreasTable[i]._citadelLevel = f.readByte(); - kAreasTable[i]._placeNum = f.readByte(); - kAreasTable[i]._citadelRoomPtr = nullptr; - kAreasTable[i]._visitCount = f.readSint16LE(); + _areasTable[i]._num = f.readByte(); + _areasTable[i]._type = f.readByte(); + _areasTable[i]._flags = f.readUint16LE(); + _areasTable[i]._firstRoomIdx = f.readUint16LE(); + _areasTable[i]._citadelLevel = f.readByte(); + _areasTable[i]._placeNum = f.readByte(); + _areasTable[i]._citadelRoomPtr = nullptr; + _areasTable[i]._visitCount = f.readSint16LE(); } for (int i = 0; i < 64; i++) { @@ -4910,7 +4910,7 @@ void EdenGame::loadpermfiles() { tab_2CF70[i] = f.readSint16LE(); } - f.read(kActionCursors, kNumActionCursors); + f.read(_actionCursors, kNumActionCursors); f.read(_mapMode, 12); f.read(_cubeTextureCoords, 3 * 6 * 2 * 3 * 2); @@ -5018,7 +5018,7 @@ void EdenGame::expandHSQ(byte *input, byte *output) { // Original name: ajouinfo void EdenGame::addInfo(byte info) { byte idx = _globals->_nextInfoIdx; - if (kPersons[PER_ELOI]._roomNum) + if (_persons[PER_ELOI]._roomNum) info |= 0x80; _infoList[idx] = info; if (idx == _globals->_lastInfoIdx) @@ -5286,7 +5286,7 @@ void EdenGame::displaySingleRoom(Room *room) { if (addIcon) { icon->_actionId = b0; icon->_objectId = b0; - icon->_cursorId = kActionCursors[b0]; + icon->_cursorId = _actionCursors[b0]; int16 x = READ_LE_UINT16(ptr); ptr += 2; int16 y = READ_LE_UINT16(ptr); @@ -5386,14 +5386,14 @@ void EdenGame::specialout() { if (_globals->_phaseNum >= 32 && _globals->_phaseNum < 48) { if (_globals->_newLocation == 9 || _globals->_newLocation == 4 || _globals->_newLocation == 24) { - kPersons[PER_ELOI]._roomNum = 263; + _persons[PER_ELOI]._roomNum = 263; return; } } if ((_globals->_phaseNum == 434) && (_globals->_newLocation == 5)) { removeFromParty(PER_JABBER); - kPersons[PER_JABBER]._roomNum = 264; + _persons[PER_JABBER]._roomNum = 264; return; } @@ -5425,7 +5425,7 @@ void EdenGame::specialin() { _gameRooms[129]._exits[0] = 0; _gameRooms[129]._exits[2] = 1; _globals->_roomNum = 3074; - kPersons[PER_MUNGO]._roomNum = 3074; + _persons[PER_MUNGO]._roomNum = 3074; _globals->_eventType = EventType::etEvent5; updateRoom(_globals->_roomNum); return; @@ -5437,7 +5437,7 @@ void EdenGame::specialin() { if (_globals->_roomNum == 259 && _globals->_phaseNum == 129) _globals->_narratorSequence = 12; if (_globals->_roomNum >= 289 && _globals->_roomNum < 359) - _globals->_labyrinthDirections = kLabyrinthPath[(_globals->_roomNum & 0xFF) - 33]; + _globals->_labyrinthDirections = _labyrinthPath[(_globals->_roomNum & 0xFF) - 33]; if (_globals->_roomNum == 305 && _globals->_prevLocation == 103) _globals->_gameFlags &= ~GameFlags::gfFlag2000; if (_globals->_roomNum == 304 && _globals->_prevLocation == 105) @@ -5474,7 +5474,7 @@ void EdenGame::getdino(Room *room) { assert(tab_2CEF0[4] == 0x25); room->_flags &= ~0xC; - for (perso_t *perso = &kPersons[PER_UNKN_18C]; perso->_roomNum != 0xFFFF; perso++) { + for (perso_t *perso = &_persons[PER_UNKN_18C]; perso->_roomNum != 0xFFFF; perso++) { if (perso->_flags & PersonFlags::pf80) continue; if (perso->_roomNum != _globals->_roomNum) @@ -5548,7 +5548,7 @@ void EdenGame::initPlace(int16 roomNum) { _globals->_gameFlags |= GameFlags::gfFlag4000; _gameIcons[18]._cursorId |= 0x8000; _globals->_lastAreaPtr = _globals->_areaPtr; - _globals->_areaPtr = &kAreasTable[((roomNum >> 8) & 0xFF) - 1]; + _globals->_areaPtr = &_areasTable[((roomNum >> 8) & 0xFF) - 1]; Area *area = _globals->_areaPtr; area->_visitCount++; _globals->_areaVisitCount = area->_visitCount; @@ -6506,23 +6506,23 @@ void EdenGame::handleHNMSubtitles() { switch (_globals->_curVideoNum) { case 170: frames = kFramesVid170; - perso = &kPersons[PER_UNKN_156]; + perso = &_persons[PER_UNKN_156]; break; case 83: frames = kFramesVid83; - perso = &kPersons[PER_MORKUS]; + perso = &_persons[PER_MORKUS]; break; case 88: frames = kFramesVid88; - perso = &kPersons[PER_MORKUS]; + perso = &_persons[PER_MORKUS]; break; case 89: frames = kFramesVid89; - perso = &kPersons[PER_MORKUS]; + perso = &_persons[PER_MORKUS]; break; case 94: frames = kFramesVid94; - perso = &kPersons[PER_MORKUS]; + perso = &_persons[PER_MORKUS]; break; default: return; @@ -6825,7 +6825,7 @@ void EdenGame::lostObject() { // Original name: objecthere bool EdenGame::isObjectHere(int16 id) { object_t *object = getObjectPtr(id); - for (_currentObjectLocation = &kObjectLocations[object->_locations]; *_currentObjectLocation != 0xFFFF; _currentObjectLocation++) { + for (_currentObjectLocation = &_objectLocations[object->_locations]; *_currentObjectLocation != 0xFFFF; _currentObjectLocation++) { if (*_currentObjectLocation == _globals->_roomNum) return true; } @@ -6876,7 +6876,7 @@ void EdenGame::putObject() { void EdenGame::newObject(int16 id, int16 arg2) { object_t *object = getObjectPtr(id); - uint16 e, *t = &kObjectLocations[object->_locations]; + uint16 e, *t = &_objectLocations[object->_locations]; while ((e = *t) != 0xFFFF) { e &= ~0x8000; if ((e >> 8) == arg2) @@ -6887,7 +6887,7 @@ void EdenGame::newObject(int16 id, int16 arg2) { void EdenGame::giveobjectal(int16 id) { if (id == Objects::obKnife) - kObjectLocations[2] = 0; + _objectLocations[2] = 0; if (id == Objects::obApple) _globals->_stepsToFindAppleNormal = 0; if (id >= Objects::obEyeInTheStorm && id < (Objects::obRiverThatWinds + 1) && _globals->_roomCharacterType == PersonFlags::pftVelociraptor) { @@ -6942,7 +6942,7 @@ void EdenGame::newEmptyNest() { if (_objects[Objects::obNest - 1]._count) return; object_t *obj = getObjectPtr(Objects::obNest); - for (uint16 *ptr = kObjectLocations + obj->_locations; *ptr != 0xFFFF; ptr++) { + for (uint16 *ptr = _objectLocations + obj->_locations; *ptr != 0xFFFF; ptr++) { if ((*ptr & ~0x8000) >> 8 != _globals->_citadelAreaNum) continue; *ptr &= ~0x8000; @@ -6966,7 +6966,7 @@ void EdenGame::newNestWithEggs() { if (_objects[Objects::obNest - 1]._count) return; object_t *obj = getObjectPtr(Objects::obFullNest); - for (uint16 *ptr = kObjectLocations + obj->_locations; *ptr != 0xFFFF; ptr++) { + for (uint16 *ptr = _objectLocations + obj->_locations; *ptr != 0xFFFF; ptr++) { if ((*ptr & ~0x8000) >> 8 != _globals->_citadelAreaNum) continue; *ptr &= ~0x8000; @@ -7074,9 +7074,9 @@ void EdenGame::cancel2() { void EdenGame::testvoice() { _globals->_frescoNumber = 0; - _globals->_characterPtr = kPersons; + _globals->_characterPtr = _persons; _globals->_dialogType = DialogType::dtInspect; - int16 num = (kPersons[PER_KING]._id << 3) | _globals->_dialogType; + int16 num = (_persons[PER_KING]._id << 3) | _globals->_dialogType; dialoscansvmas((Dialog *)getElem(_gameDialogs, num)); restoreUnderSubtitles(); displaySubtitles(); @@ -7142,9 +7142,9 @@ void EdenGame::initafterload() { _gameIcons[18]._cursorId |= 0x8000; if (_globals->_curAreaType == AreaType::atValley) _gameIcons[18]._cursorId &= ~0x8000; - kPersoRoomBankTable[30] = 27; + _personRoomBankTable[30] = 27; if (_globals->_phaseNum >= 352) - kPersoRoomBankTable[30] = 26; + _personRoomBankTable[30] = 26; _animateTalking = false; _animationActive = false; _globals->_var100 = 0; @@ -7199,9 +7199,9 @@ void EdenGame::panelrestart() { _gameIcons[18]._cursorId |= 0x8000; if (_globals->_curAreaType == AreaType::atValley) _gameIcons[18]._cursorId &= ~0x8000; - kPersoRoomBankTable[30] = 27; + _personRoomBankTable[30] = 27; if (_globals->_phaseNum >= 352) - kPersoRoomBankTable[30] = 26; + _personRoomBankTable[30] = 26; _animateTalking = false; _animationActive = false; _globals->_var100 = 0; @@ -7512,9 +7512,9 @@ void EdenGame::displayTopPanel() { // Original name: affresult void EdenGame::displayResult() { restoreUnderSubtitles(); - _globals->_characterPtr = &kPersons[19]; + _globals->_characterPtr = &_persons[19]; _globals->_dialogType = DialogType::dtInspect; - int16 num = (kPersons[PER_UNKN_156]._id << 3) | _globals->_dialogType; + int16 num = (_persons[PER_UNKN_156]._id << 3) | _globals->_dialogType; if (dialoscansvmas((Dialog *)getElem(_gameDialogs, num))) displaySubtitles(); _globals->_varCA = 0; @@ -7590,7 +7590,7 @@ void EdenGame::evenements(perso_t *perso) { if (_globals->_var113) return; - if (perso >= &kPersons[PER_UNKN_18C]) + if (perso >= &_persons[PER_UNKN_18C]) return; if (!dialogEvent(perso)) @@ -7633,7 +7633,7 @@ void EdenGame::rangermammi(perso_t *perso, Room *room) { } void EdenGame::perso_ici(int16 action) { - perso_t *perso = &kPersons[PER_UNKN_156]; + perso_t *perso = &_persons[PER_UNKN_156]; // room_t *room = p_global->last_area_ptr->room_ptr; //TODO: compiler opt bug? causes access to zero ptr??? last_area_ptr == 0 switch (action) { case 0: @@ -7652,7 +7652,7 @@ void EdenGame::perso_ici(int16 action) { rangermammi(perso, _globals->_lastAreaPtr->_citadelRoomPtr); break; } - perso = kPersons; + perso = _persons; do { if (perso->_roomNum == _globals->_roomNum && !(perso->_flags & PersonFlags::pf80)) { switch (action) { @@ -7679,7 +7679,7 @@ void EdenGame::perso_ici(int16 action) { // Original name: setpersohere void EdenGame::setCharacterHere() { - debug("setCharacterHere, perso is %ld", _globals->_characterPtr - kPersons); + debug("setCharacterHere, perso is %ld", _globals->_characterPtr - _persons); _globals->_partyOutside = 0; _globals->_party = 0; _globals->_roomCharacterPtr = nullptr; @@ -7705,7 +7705,7 @@ void EdenGame::faire_suivre(int16 roomNum) { // Original name: suis_moi5 void EdenGame::AddCharacterToParty() { - debug("adding person %ld to party", _globals->_characterPtr - kPersons); + debug("adding person %ld to party", _globals->_characterPtr - _persons); _globals->_characterPtr->_flags |= PersonFlags::pfInParty; _globals->_characterPtr->_roomNum = _globals->_roomNum; _globals->_party |= _globals->_characterPtr->_partyMask; @@ -7715,14 +7715,14 @@ void EdenGame::AddCharacterToParty() { // Original name: suis_moi void EdenGame::addToParty(int16 index) { perso_t *old_perso = _globals->_characterPtr; - _globals->_characterPtr = &kPersons[index]; + _globals->_characterPtr = &_persons[index]; AddCharacterToParty(); _globals->_characterPtr = old_perso; } // Original name: reste_ici5 void EdenGame::removeCharacterFromParty() { - debug("removing person %ld from party", _globals->_characterPtr - kPersons); + debug("removing person %ld from party", _globals->_characterPtr - _persons); _globals->_characterPtr->_flags &= ~PersonFlags::pfInParty; _globals->_partyOutside |= _globals->_characterPtr->_partyMask; _globals->_party &= ~_globals->_characterPtr->_partyMask; @@ -7732,7 +7732,7 @@ void EdenGame::removeCharacterFromParty() { // Original name: reste_ici void EdenGame::removeFromParty(int16 index) { perso_t *old_perso = _globals->_characterPtr; - _globals->_characterPtr = &kPersons[index]; + _globals->_characterPtr = &_persons[index]; removeCharacterFromParty(); _globals->_characterPtr = old_perso; } @@ -7741,8 +7741,8 @@ void EdenGame::removeFromParty(int16 index) { void EdenGame::handleEloiDeparture() { removeFromParty(PER_ELOI); _globals->_gameFlags &= ~GameFlags::gfFlag4000; - kPersons[PER_ELOI]._roomNum = 0; - _globals->_partyOutside &= ~kPersons[PER_ELOI]._partyMask; + _persons[PER_ELOI]._roomNum = 0; + _globals->_partyOutside &= ~_persons[PER_ELOI]._partyMask; if (_globals->_roomNum == 2817) setChrono(3000); _globals->_eloiDepartureDay = _globals->_gameDays; @@ -7765,8 +7765,8 @@ bool EdenGame::checkEloiReturn() { // Original name: eloirevient void EdenGame::handleEloiReturn() { - if (_globals->_areaPtr->_type == AreaType::atValley && !kPersons[PER_ELOI]._roomNum) - kPersons[PER_ELOI]._roomNum = (_globals->_roomNum & 0xFF00) + 1; + if (_globals->_areaPtr->_type == AreaType::atValley && !_persons[PER_ELOI]._roomNum) + _persons[PER_ELOI]._roomNum = (_globals->_roomNum & 0xFF00) + 1; } //// phase.c void EdenGame::incPhase() { @@ -7810,7 +7810,7 @@ void EdenGame::incPhase() { void EdenGame::phase113() { removeFromParty(PER_DINA); - kPersons[PER_DINA]._roomNum = 274; + _persons[PER_DINA]._roomNum = 274; } void EdenGame::phase130() { @@ -7821,7 +7821,7 @@ void EdenGame::phase130() { void EdenGame::phase161() { Area *area = _globals->_areaPtr; addToParty(PER_MAMMI); - kPersons[PER_MAMMI]._flags |= PersonFlags::pf10; + _persons[PER_MAMMI]._flags |= PersonFlags::pf10; area->_flags |= AreaFlags::afFlag1; _globals->_curAreaFlags |= AreaFlags::afFlag1; } @@ -7840,8 +7840,8 @@ void EdenGame::phase257() { void EdenGame::phase353() { removeFromParty(PER_DINA); - kPersons[PER_DINA]._roomNum = 0; - kTabletView[1] = 88; + _persons[PER_DINA]._roomNum = 0; + _tabletView[1] = 88; } void EdenGame::phase369() { @@ -7882,8 +7882,8 @@ void EdenGame::phase418() { void EdenGame::phase433() { dialautoon(); - kPersons[PER_MAMMI_4]._flags &= ~PersonFlags::pf80; - kPersons[PER_JABBER]._flags &= ~PersonFlags::pf80; + _persons[PER_MAMMI_4]._flags &= ~PersonFlags::pf80; + _persons[PER_JABBER]._flags &= ~PersonFlags::pf80; setCharacterHere(); _globals->_chronoFlag = 0; _globals->_chrono = 0; @@ -7997,11 +7997,11 @@ void EdenGame::phase48() { void EdenGame::phase64() { addToParty(PER_DINA); - kPersons[PER_ELOI]._roomNum = 259; + _persons[PER_ELOI]._roomNum = 259; } void EdenGame::phase80() { - kPersons[PER_TAU]._roomNum = 0; + _persons[PER_TAU]._roomNum = 0; } void EdenGame::phase96() { @@ -8032,7 +8032,7 @@ void EdenGame::phase176() { void EdenGame::phase192() { Area *area = _globals->_areaPtr; addToParty(PER_MAMMI_1); - kPersons[PER_MAMMI_1]._flags |= PersonFlags::pf10; + _persons[PER_MAMMI_1]._flags |= PersonFlags::pf10; dialautoon(); area->_flags |= AreaFlags::afFlag1; _globals->_curAreaFlags |= AreaFlags::afFlag1; @@ -8051,7 +8051,7 @@ void EdenGame::phase224() { void EdenGame::phase240() { Area *area = _globals->_areaPtr; addToParty(PER_MAMMI_2); - kPersons[PER_MAMMI_2]._flags |= PersonFlags::pf10; + _persons[PER_MAMMI_2]._flags |= PersonFlags::pf10; area->_flags |= AreaFlags::afFlag1; _globals->_curAreaFlags |= AreaFlags::afFlag1; } @@ -8067,7 +8067,7 @@ void EdenGame::phase272() { void EdenGame::phase288() { setChoiceYes(); - kPersons[PER_MUNGO]._roomNum = 0; + _persons[PER_MUNGO]._roomNum = 0; removeFromParty(PER_MUNGO); addToParty(PER_ELOI); _globals->_narratorSequence = 8; @@ -8077,7 +8077,7 @@ void EdenGame::phase304() { Area *area = _globals->_areaPtr; addToParty(PER_EVE); addToParty(PER_MAMMI_5); - kPersons[PER_MAMMI_5]._flags |= PersonFlags::pf10; + _persons[PER_MAMMI_5]._flags |= PersonFlags::pf10; dialautoon(); area->_flags |= AreaFlags::afFlag1; _globals->_curAreaFlags |= AreaFlags::afFlag1; @@ -8095,9 +8095,9 @@ void EdenGame::phase336() { } void EdenGame::phase352() { - kPersoRoomBankTable[30] = 26; - kPersons[PER_EVE]._spriteBank = 9; - kPersons[PER_EVE]._targetLoc = 8; + _personRoomBankTable[30] = 26; + _persons[PER_EVE]._spriteBank = 9; + _persons[PER_EVE]._targetLoc = 8; followerList[13]._spriteNum = 2; dialautoon(); _gameRooms[288]._exits[0] = 0xFF; @@ -8109,8 +8109,8 @@ void EdenGame::phase352() { void EdenGame::phase368() { removeFromParty(PER_EVE); dialautoon(); - kPersons[PER_ELOI]._roomNum = 1811; - kPersons[PER_DINA]._roomNum = 1607; + _persons[PER_ELOI]._roomNum = 1811; + _persons[PER_DINA]._roomNum = 1607; } void EdenGame::phase384() { @@ -8125,10 +8125,10 @@ void EdenGame::phase384() { void EdenGame::phase400() { dialonfollow(); - kPersons[PER_KING]._roomNum = 0; - kPersons[PER_MONK]._roomNum = 259; + _persons[PER_KING]._roomNum = 0; + _persons[PER_MONK]._roomNum = 259; _globals->_eloiHaveNews = 0; - kObjectLocations[20] = 259; + _objectLocations[20] = 259; } void EdenGame::phase416() { @@ -8140,9 +8140,9 @@ void EdenGame::phase416() { void EdenGame::phase432() { _globals->_narratorSequence = 3; - kPersons[PER_MAMMI_4]._flags |= PersonFlags::pf80; - kPersons[PER_JABBER]._flags |= PersonFlags::pf80; - kPersons[PER_ELOI]._roomNum = 257; + _persons[PER_MAMMI_4]._flags |= PersonFlags::pf80; + _persons[PER_JABBER]._flags |= PersonFlags::pf80; + _persons[PER_ELOI]._roomNum = 257; _gameRooms[0]._exits[0] = 0xFF; _globals->_drawFlags |= DrawFlags::drDrawTopScreen; } @@ -8155,7 +8155,7 @@ void EdenGame::phase448() { void EdenGame::phase464() { _globals->_areaPtr->_flags |= AreaFlags::afFlag1; _globals->_curAreaFlags |= AreaFlags::afFlag1; - kPersons[PER_MAMMI_6]._flags |= PersonFlags::pf10; + _persons[PER_MAMMI_6]._flags |= PersonFlags::pf10; addToParty(PER_SHAZIA); _globals->_citadelAreaNum = _globals->_areaNum; naitredino(8); @@ -8165,7 +8165,7 @@ void EdenGame::phase480() { giveObject(); newValley(); handleEloiReturn(); - kTabletView[1] = 94; + _tabletView[1] = 94; } void EdenGame::phase496() { @@ -8198,7 +8198,7 @@ void EdenGame::phase544() { } void EdenGame::phase560() { - kPersons[PER_ELOI]._roomNum = 3073; + _persons[PER_ELOI]._roomNum = 3073; _gameRooms[127]._exits[1] = 0; } @@ -8226,23 +8226,23 @@ h->write(ptr, *size); size = (char *)(&_gameIcons[134]) - (char *)(&_gameIcons[123]); CLFile_Write(handle, &_gameIcons[123], &size); lieuoffsetout(); - size = (char *)(&kAreasTable[12]) - (char *)(&kAreasTable[0]); - CLFile_Write(handle, &kAreasTable[0], &size); + size = (char *)(&_areasTable[12]) - (char *)(&_areasTable[0]); + CLFile_Write(handle, &_areasTable[0], &size); size = (char *)(&_gameRooms[423]) - (char *)(&_gameRooms[0]); CLFile_Write(handle, &_gameRooms[0], &size); size = (char *)(&_objects[42]) - (char *)(&_objects[0]); CLFile_Write(handle, &_objects[0], &size); - size = (char *)(&kObjectLocations[45]) - (char *)(&kObjectLocations[0]); - CLFile_Write(handle, &kObjectLocations[0], &size); + size = (char *)(&_objectLocations[45]) - (char *)(&_objectLocations[0]); + CLFile_Write(handle, &_objectLocations[0], &size); size = (char *)(&followerList[14]) - (char *)(&followerList[13]); CLFile_Write(handle, &followerList[13], &size); - size = (char *)(&kPersons[PER_UNKN_3DE]) - (char *)(&kPersons[PER_KING]); - CLFile_Write(handle, &kPersons[PER_KING], &size); + size = (char *)(&_persons[PER_UNKN_3DE]) - (char *)(&_persons[PER_KING]); + CLFile_Write(handle, &_persons[PER_KING], &size); bandeoffsetout(); size = (char *)(&_tapes[16]) - (char *)(&_tapes[0]); CLFile_Write(handle, &_tapes[0], &size); - size = (char *)(&kTabletView[6]) - (char *)(&kTabletView[0]); - CLFile_Write(handle, &kTabletView[0], &size); + size = (char *)(&_tabletView[6]) - (char *)(&_tabletView[0]); + CLFile_Write(handle, &_tabletView[0], &size); size = (char *)(&_gameDialogs[10240]) - (char *)(&_gameDialogs[0]); //TODO: const size 10240 CLFile_Write(handle, &_gameDialogs[0], &size); @@ -8270,8 +8270,8 @@ void EdenGame::loadrestart() { size = (char *)(&_gameIcons[134]) - (char *)(&_gameIcons[123]); loadpartoffile(2495, &_gameIcons[123], offs, size); offs += size; - size = (char *)(&kAreasTable[12]) - (char *)(&kAreasTable[0]); - loadpartoffile(2495, &kAreasTable[0], offs, size); + size = (char *)(&_areasTable[12]) - (char *)(&_areasTable[0]); + loadpartoffile(2495, &_areasTable[0], offs, size); offs += size; lieuoffsetin(); size = (char *)(&_gameRooms[423]) - (char *)(&_gameRooms[0]); @@ -8280,21 +8280,21 @@ void EdenGame::loadrestart() { size = (char *)(&_objects[42]) - (char *)(&_objects[0]); loadpartoffile(2495, &_objects[0], offs, size); offs += size; - size = (char *)(&kObjectLocations[45]) - (char *)(&kObjectLocations[0]); - loadpartoffile(2495, &kObjectLocations[0], offs, size); + size = (char *)(&_objectLocations[45]) - (char *)(&_objectLocations[0]); + loadpartoffile(2495, &_objectLocations[0], offs, size); offs += size; size = (char *)(&followerList[14]) - (char *)(&followerList[13]); loadpartoffile(2495, &followerList[13], offs, size); offs += size; - size = (char *)(&kPersons[PER_UNKN_3DE]) - (char *)(&kPersons[PER_KING]); - loadpartoffile(2495, &kPersons[PER_KING], offs, size); + size = (char *)(&_persons[PER_UNKN_3DE]) - (char *)(&_persons[PER_KING]); + loadpartoffile(2495, &_persons[PER_KING], offs, size); offs += size; size = (char *)(&_tapes[16]) - (char *)(&_tapes[0]); loadpartoffile(2495, &_tapes[0], offs, size); offs += size; bandeoffsetin(); - size = (char *)(&kTabletView[6]) - (char *)(&kTabletView[0]); - loadpartoffile(2495, &kTabletView[0], offs, size); + size = (char *)(&_tabletView[6]) - (char *)(&_tabletView[0]); + loadpartoffile(2495, &_tabletView[0], offs, size); offs += size; size = (char *)(&_gameDialogs[10240]) - (char *)(&_gameDialogs[0]); //TODO: const size 10240 loadpartoffile(2495, &_gameDialogs[0], offs, size); @@ -8319,24 +8319,24 @@ void EdenGame::loadgame(char *name) { vavaoffsetin(); size = (char *)(&_gameIcons[134]) - (char *)(&_gameIcons[123]); CLFile_Read(handle, &_gameIcons[123], &size); - size = (char *)(&kAreasTable[12]) - (char *)(&kAreasTable[0]); - CLFile_Read(handle, &kAreasTable[0], &size); + size = (char *)(&_areasTable[12]) - (char *)(&_areasTable[0]); + CLFile_Read(handle, &_areasTable[0], &size); lieuoffsetin(); size = (char *)(&_gameRooms[423]) - (char *)(&_gameRooms[0]); CLFile_Read(handle, &_gameRooms[0], &size); size = (char *)(&_objects[42]) - (char *)(&_objects[0]); CLFile_Read(handle, &_objects[0], &size); - size = (char *)(&kObjectLocations[45]) - (char *)(&kObjectLocations[0]); - CLFile_Read(handle, &kObjectLocations[0], &size); + size = (char *)(&_objectLocations[45]) - (char *)(&_objectLocations[0]); + CLFile_Read(handle, &_objectLocations[0], &size); size = (char *)(&followerList[14]) - (char *)(&followerList[13]); CLFile_Read(handle, &followerList[13], &size); - size = (char *)(&kPersons[55]) - (char *)(&kPersons[0]); - CLFile_Read(handle, &kPersons[0], &size); + size = (char *)(&_persons[55]) - (char *)(&_persons[0]); + CLFile_Read(handle, &_persons[0], &size); size = (char *)(&_tapes[16]) - (char *)(&_tapes[0]); CLFile_Read(handle, &_tapes[0], &size); bandeoffsetin(); - size = (char *)(&kTabletView[6]) - (char *)(&kTabletView[0]); - CLFile_Read(handle, &kTabletView[0], &size); + size = (char *)(&_tabletView[6]) - (char *)(&_tabletView[0]); + CLFile_Read(handle, &_tabletView[0], &size); size = (char *)(&_gameDialogs[10240]) - (char *)(&_gameDialogs[0]); //TODO: const size 10240 CLFile_Read(handle, &_gameDialogs[0], &size); @@ -8361,11 +8361,11 @@ void EdenGame::vavaoffsetout() { OFSOUT(_globals->_nextRoomIcon, _gameIcons, Icon); OFSOUT(_globals->_roomPtr, _gameRooms, Room); OFSOUT(_globals->_citaAreaFirstRoom, _gameRooms, Room); - OFSOUT(_globals->_areaPtr, kAreasTable, Area); - OFSOUT(_globals->_lastAreaPtr, kAreasTable, Area); - OFSOUT(_globals->_curAreaPtr, kAreasTable, Area); - OFSOUT(_globals->_characterPtr, kPersons, perso_t); - OFSOUT(_globals->_roomCharacterPtr, kPersons, perso_t); + OFSOUT(_globals->_areaPtr, _areasTable, Area); + OFSOUT(_globals->_lastAreaPtr, _areasTable, Area); + OFSOUT(_globals->_curAreaPtr, _areasTable, Area); + OFSOUT(_globals->_characterPtr, _persons, perso_t); + OFSOUT(_globals->_roomCharacterPtr, _persons, perso_t); } void EdenGame::vavaoffsetin() { @@ -8377,33 +8377,33 @@ void EdenGame::vavaoffsetin() { OFSIN(_globals->_nextRoomIcon, _gameIcons, Icon); OFSIN(_globals->_roomPtr, _gameRooms, Room); OFSIN(_globals->_citaAreaFirstRoom, _gameRooms, Room); - OFSIN(_globals->_areaPtr, kAreasTable, Area); - OFSIN(_globals->_lastAreaPtr, kAreasTable, Area); - OFSIN(_globals->_curAreaPtr, kAreasTable, Area); - OFSIN(_globals->_characterPtr, kPersons, perso_t); - OFSIN(_globals->_roomCharacterPtr, kPersons, perso_t); + OFSIN(_globals->_areaPtr, _areasTable, Area); + OFSIN(_globals->_lastAreaPtr, _areasTable, Area); + OFSIN(_globals->_curAreaPtr, _areasTable, Area); + OFSIN(_globals->_characterPtr, _persons, perso_t); + OFSIN(_globals->_roomCharacterPtr, _persons, perso_t); } void EdenGame::lieuoffsetout() { for (int i = 0; i < 12; i++) - OFSOUT(kAreasTable[i]._citadelRoomPtr, _gameRooms, Room); + OFSOUT(_areasTable[i]._citadelRoomPtr, _gameRooms, Room); } void EdenGame::lieuoffsetin() { for (int i = 0; i < 12; i++) - OFSIN(kAreasTable[i]._citadelRoomPtr, _gameRooms, Room); + OFSIN(_areasTable[i]._citadelRoomPtr, _gameRooms, Room); } void EdenGame::bandeoffsetout() { for (int i = 0; i < 16; i++) { - OFSOUT(_tapes[i]._perso, kPersons, perso_t); + OFSOUT(_tapes[i]._perso, _persons, perso_t); OFSOUT(_tapes[i]._dialog, _gameDialogs, Dialog); } } void EdenGame::bandeoffsetin() { for (int i = 0; i < 16; i++) { - OFSIN(_tapes[i]._perso, kPersons, perso_t); + OFSIN(_tapes[i]._perso, _persons, perso_t); OFSIN(_tapes[i]._dialog, _gameDialogs, Dialog); } } diff --git a/engines/cryo/eden.h b/engines/cryo/eden.h index 79ea63a43c..9b0b75b806 100644 --- a/engines/cryo/eden.h +++ b/engines/cryo/eden.h @@ -740,25 +740,25 @@ private: // Loaded from cryo.dat Follower followerList[15]; - byte kLabyrinthPath[70]; - char kDinoSpeedForCitaLevel[16]; - char kTabletView[12]; - char kPersoRoomBankTable[84]; // special character backgrounds for specific rooms + byte _labyrinthPath[70]; + char _dinoSpeedForCitadelLevel[16]; + char _tabletView[12]; + char _personRoomBankTable[84]; // special character backgrounds for specific rooms // Loaded from cryo.dat - Area transition descriptors - Goto gotos[130]; + Goto _gotos[130]; object_t _objects[42]; - uint16 kObjectLocations[45]; - perso_t kPersons[58]; + uint16 _objectLocations[45]; + perso_t _persons[58]; Citadel _citadelList[7]; // Loaded from cryo.dat Common::Rect _characterRects[19]; byte _characterArray[20][5]; - Area kAreasTable[12]; + Area _areasTable[12]; int16 tab_2CEF0[64]; int16 tab_2CF70[64]; - byte kActionCursors[299]; + byte _actionCursors[299]; byte _mapMode[12]; byte _cubeTextureCoords[3][6 * 2 * 3 * 2]; float _translationZ = -3400; -- 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(-) 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(-) 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 From deb0857f6822274947c4e63aa801efc992748e44 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 11 Feb 2017 18:05:07 +0200 Subject: CRYO: Change the version of cryo.dat to be a 32-bit integer (2/2) Though it's unlikely that we'll ever have that many changes, it's better to provision for more space now, for versioning --- engines/cryo/eden.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp index b6064c70b9..4807a942bb 100644 --- a/engines/cryo/eden.cpp +++ b/engines/cryo/eden.cpp @@ -4778,7 +4778,7 @@ void EdenGame::loadpermfiles() { if (strcmp(headerId, "CRYODATA")) error("Invalid aux data file"); - if (f.readByte() != CRYO_DAT_VER) + if (f.readUint32LE() != CRYO_DAT_VER) error("Incorrect aux data version"); if (dataSize != expectedDataSize) -- cgit v1.2.3 From fffe7c786752fdad7098e21bcf2e4a412c9df283 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 11 Feb 2017 18:15:41 +0200 Subject: CRYO: Add missing int32 typedef to create_cryo --- devtools/create_cryo/eden.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/devtools/create_cryo/eden.h b/devtools/create_cryo/eden.h index dac0766a6f..91ad3940b1 100644 --- a/devtools/create_cryo/eden.h +++ b/devtools/create_cryo/eden.h @@ -25,6 +25,8 @@ typedef unsigned char byte; typedef short int16; typedef unsigned short uint16; +typedef int uint32; +typedef unsigned int uint32; struct icon_t { int16 sx; -- cgit v1.2.3 From 01e7b4edcf1ac22e1e3ad8889d42fe3469468b12 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 11 Feb 2017 20:42:07 +0200 Subject: CRYO: Fix typos in some sizeof() values --- engines/cryo/eden.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp index 4807a942bb..18d8be2ace 100644 --- a/engines/cryo/eden.cpp +++ b/engines/cryo/eden.cpp @@ -4603,7 +4603,7 @@ void EdenGame::loadIconFile(uint16 num, Icon *buffer) { debug("* Loading icon - Resource %d (%s) at 0x%X, %d bytes", num, file->_name.c_str(), offs, size); _bigfile.seek(offs, SEEK_SET); - int count = size / 14; // sizeof(Icon) + int count = size / 18; // sizeof(Icon) for (int i = 0; i < count; i++) { if (_vm->getPlatform() == Common::kPlatformMacintosh) { buffer[i].sx = _bigfile.readSint16BE(); @@ -4638,7 +4638,7 @@ void EdenGame::loadRoomFile(uint16 num, Room *buffer) { debug("* Loading room - Resource %d (%s) at 0x%X, %d bytes", num, file->_name.c_str(), offs, size); _bigfile.seek(offs, SEEK_SET); - int count = size / 11; // sizeof(Room) + int count = size / 14; // sizeof(Room) for (int i = 0; i < count; i++) { buffer[i]._id = _bigfile.readByte(); for (int j = 0; j < 4; j++) @@ -4750,27 +4750,29 @@ void EdenGame::loadpermfiles() { const int kNumActionCursors = 299; const int expectedDataSize = - kNumIcons * 14 + // sizeof(Icon) - kNumRooms * 11 + // sizeof(Room) + kNumIcons * 18 + // sizeof(Icon) + kNumRooms * 14 + // sizeof(Room) kNumFollowers * 16 + // sizeof(Follower) kNumLabyrinthPath + kNumDinoSpeedForCitaLevel + kNumTabletView + kNumPersoRoomBankTable + kNumGotos * 5 + // sizeof(Goto) - kNumObjects * 10 + // sizeof(object_t) + kNumObjects * 12 + // sizeof(object_t) kNumObjectLocations * 2 + kNumPersons * 18 + // sizeof(perso_t) - kNumCitadel * 6 + // sizeof(Citadel) + kNumCitadel * 34 + // sizeof(Citadel) kNumCharacterRects * 8 + kNumCharacters * 5 + kNumAreas * 10 + // (sizeof(Area) - 4) 64 * 2 + 64 * 2 + - kNumActionCursors; + kNumActionCursors + + 12 + + 3 * 6 * 2 * 3 * 2; if (f.open("cryo.dat")) { - const int dataSize = f.size() - 8 - 1; // CRYODATA + version + const int dataSize = f.size() - 8 - 4; // CRYODATA + version char headerId[9]; f.read(headerId, 8); -- cgit v1.2.3 From c0d9752730b3f02ed5dc968643a3c5e9a09f1880 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 11 Feb 2017 20:47:15 +0200 Subject: CRYO: Add cryo.dat to engine-data --- dists/engine-data/README | 3 +++ dists/engine-data/cryo.dat | Bin 0 -> 12499 bytes 2 files changed, 3 insertions(+) create mode 100644 dists/engine-data/cryo.dat diff --git a/dists/engine-data/README b/dists/engine-data/README index 06939dba42..e564b18fa5 100644 --- a/dists/engine-data/README +++ b/dists/engine-data/README @@ -4,6 +4,9 @@ engine-data README access.dat TODO +cryo.dat +This file contains a lot of hardcoded tables used by the Cryo engine. + drascula.dat TODO diff --git a/dists/engine-data/cryo.dat b/dists/engine-data/cryo.dat new file mode 100644 index 0000000000..4f23480560 Binary files /dev/null and b/dists/engine-data/cryo.dat differ -- cgit v1.2.3 From 5d119b603819add698ad852c6136083e26e64309 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 11 Feb 2017 20:48:52 +0200 Subject: CRYO: Add cryo.dat to all messages related to it --- engines/cryo/eden.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp index 18d8be2ace..f1d0f185e7 100644 --- a/engines/cryo/eden.cpp +++ b/engines/cryo/eden.cpp @@ -4778,15 +4778,15 @@ void EdenGame::loadpermfiles() { f.read(headerId, 8); headerId[8] = '\0'; if (strcmp(headerId, "CRYODATA")) - error("Invalid aux data file"); + error("Invalid cryo.dat aux data file"); if (f.readUint32LE() != CRYO_DAT_VER) - error("Incorrect aux data version"); + error("Incorrect data version for cryo.dat"); if (dataSize != expectedDataSize) - error("Mismatching data in aux data file (got %d, expected %d)", dataSize, expectedDataSize); + error("Mismatching data in cryo.dat aux data file (got %d, expected %d)", dataSize, expectedDataSize); } else - error("Can not load aux data"); + error("Can not load cryo.dat"); switch (_vm->getPlatform()) { case Common::kPlatformDOS: -- cgit v1.2.3 From 724730dbcc0c897a2b4a5e4daec3a81865c9aec1 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 11 Feb 2017 21:02:19 +0200 Subject: CRYO: Fix typo in create_cryo --- devtools/create_cryo/eden.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devtools/create_cryo/eden.h b/devtools/create_cryo/eden.h index 91ad3940b1..771c8309a2 100644 --- a/devtools/create_cryo/eden.h +++ b/devtools/create_cryo/eden.h @@ -25,7 +25,7 @@ typedef unsigned char byte; typedef short int16; typedef unsigned short uint16; -typedef int uint32; +typedef int int32; typedef unsigned int uint32; struct icon_t { -- cgit v1.2.3 From e95ed8eb9053d4b772429fec99f05d3fbede1472 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 11 Feb 2017 21:51:36 +0200 Subject: CRYO: Clean up and document some variables --- engines/cryo/defs.h | 4 --- engines/cryo/eden.cpp | 84 +++++++++++++++++++++++++++------------------------ engines/cryo/eden.h | 13 ++++++-- 3 files changed, 54 insertions(+), 47 deletions(-) diff --git a/engines/cryo/defs.h b/engines/cryo/defs.h index 7952fef9ac..c69600c5f4 100644 --- a/engines/cryo/defs.h +++ b/engines/cryo/defs.h @@ -806,10 +806,6 @@ struct Cube { Point3D *_vertices; }; -extern float _translationZ; -extern float flt_2DF80; -extern float flt_2DF84; - struct XYZ { signed short x, y, z; }; diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp index f1d0f185e7..05dac787cb 100644 --- a/engines/cryo/eden.cpp +++ b/engines/cryo/eden.cpp @@ -49,13 +49,10 @@ namespace Cryo { #define CRYO_DAT_VER 1 // 1 byte - -int16 _torchTick = 0; -int16 _glowIndex = 0; -int16 _torchCurIndex = 0; - -bool _allowDoubled = true; -int _cursCenter = 11; +#define Z_RESET -3400 +#define Z_STEP 200 +#define Z_UP 1 +#define Z_DOWN -1 EdenGame::EdenGame(CryoEngine *vm) : _vm(vm), kMaxMusicSize(2200000) { static uint8 statTab2CB1E[8][4] = { @@ -170,6 +167,14 @@ EdenGame::EdenGame(CryoEngine *vm) : _vm(vm), kMaxMusicSize(2200000) { for (int j = 0; j < 4; j++) tab_2CB1E[i][j] = statTab2CB1E[i][j]; } + + _translationZ = Z_RESET; + _zDirection = Z_UP; + + _torchTick = 0; + _glowIndex = 0; + _torchCurIndex = 0; + _cursCenter = 11; } void EdenGame::removeConsole() { @@ -5875,19 +5880,18 @@ void EdenGame::signon(const char *s) { void EdenGame::FRDevents() { _vm->pollEvents(); - if (_allowDoubled) { + #if 0 // CLKeyboard_IsScanCodeDown currently always returns false - if (_vm->isScanCodeDown(0x30)) { //TODO: const - if (!_keyboardHeld) { - _doubledScreen = !_doubledScreen; - _mainView->_doubled = _doubledScreen; - CLBlitter_FillScreenView(0); - _keyboardHeld = true; - } - } else + if (_vm->isScanCodeDown(0x30)) { //TODO: const + if (!_keyboardHeld) { + _doubledScreen = !_doubledScreen; + _mainView->_doubled = _doubledScreen; + CLBlitter_FillScreenView(0); + _keyboardHeld = true; + } + } else #endif - _keyboardHeld = false; - } + _keyboardHeld = false; int16 mouseY; int16 mouseX; @@ -6361,19 +6365,19 @@ void EdenGame::showMovie(char arg1) { CLBlitter_CopyView2Screen(_hnmView); assert(_vm->_screenView->_pitch == 320); _vm->pollEvents(); - if (_allowDoubled) { + #if 0 // CLKeyboard_IsScanCodeDown currently always returns false - if (_vm->isScanCodeDown(0x30)) { //TODO: const - if (!_keyboardHeld) { - _doubledScreen = !_doubledScreen; - _hnmView->_doubled = _doubledScreen; //TODO: but mainview ? - CLBlitter_FillScreenView(0); - _keyboardHeld = true; - } - } else + if (_vm->isScanCodeDown(0x30)) { //TODO: const + if (!_keyboardHeld) { + _doubledScreen = !_doubledScreen; + _hnmView->_doubled = _doubledScreen; //TODO: but mainview ? + CLBlitter_FillScreenView(0); + _keyboardHeld = true; + } + } else #endif - _keyboardHeld = false; - } + _keyboardHeld = false; + if (arg1) { if (_vm->isMouseButtonDown()) { if (!_mouseHeld) { @@ -8889,14 +8893,14 @@ void EdenGame::Eden_dep_and_rot() { case 5: _rotationAngleZ = 0; _rotationAngleX = 0; - _translationZ += flt_2DF84; - if ((_translationZ < -3600.0 + flt_2DF80) || _translationZ > flt_2DF80) - flt_2DF84 = -flt_2DF84; + _translationZ += _zDirection * Z_STEP; + if ((_translationZ < -3600 + Z_RESET) || _translationZ > Z_RESET) + _zDirection = -_zDirection; break; case 6: _rotationAngleZ = 0; _rotationAngleX = 0; - _translationZ = flt_2DF80; + _translationZ = Z_RESET; break; case 7: _rotationAngleZ -= 2; @@ -8908,22 +8912,22 @@ void EdenGame::Eden_dep_and_rot() { case 8: _rotationAngleZ = 0; _rotationAngleX = 0; - _translationZ = flt_2DF80; + _translationZ = Z_RESET; break; case 9: _rotationAngleZ = 0; _rotationAngleX = 0; - _translationZ = flt_2DF80; + _translationZ = Z_RESET; break; } } void EdenGame::restoreZDEP() { - flt_2DF84 = 200.0; - if (_translationZ < flt_2DF80) - _translationZ += flt_2DF84; - if (_translationZ > flt_2DF80) - _translationZ -= flt_2DF84; + _zDirection = Z_UP; + if (_translationZ < Z_RESET) + _translationZ += _zDirection * Z_STEP; + if (_translationZ > Z_RESET) + _translationZ -= _zDirection * Z_STEP; } // Original name: affiche_polygone_mapping diff --git a/engines/cryo/eden.h b/engines/cryo/eden.h index 9b0b75b806..8133ff7765 100644 --- a/engines/cryo/eden.h +++ b/engines/cryo/eden.h @@ -761,9 +761,16 @@ private: byte _actionCursors[299]; byte _mapMode[12]; byte _cubeTextureCoords[3][6 * 2 * 3 * 2]; - float _translationZ = -3400; - float flt_2DF80 = -3400; - float flt_2DF84 = 200; + + int32 _translationZ; + int8 _zDirection; // 1 (up) or -1 (down) + + // Torch/glow related + int16 _torchTick; + int16 _glowIndex; + int16 _torchCurIndex; + + int _cursCenter; }; } -- cgit v1.2.3 From 8eb38c09330159b66eca4dee1889f120cb844923 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 11 Feb 2017 21:53:10 +0200 Subject: CRYO: Rename variables to conform to our code formatting guidelines --- engines/cryo/defs.h | 5 ----- engines/cryo/eden.cpp | 36 ++++++++++++++++++------------------ engines/cryo/eden.h | 2 +- 3 files changed, 19 insertions(+), 24 deletions(-) diff --git a/engines/cryo/defs.h b/engines/cryo/defs.h index c69600c5f4..617172d6e6 100644 --- a/engines/cryo/defs.h +++ b/engines/cryo/defs.h @@ -764,11 +764,6 @@ struct Citadel { int16 _video[8]; }; -/////////////// vars - -extern Follower followerList[]; - - /* Labyrinth of Mo diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp index 05dac787cb..9bd2e8db3b 100644 --- a/engines/cryo/eden.cpp +++ b/engines/cryo/eden.cpp @@ -287,7 +287,7 @@ void EdenGame::displayFollower(Follower *follower, int16 x, int16 y) { void EdenGame::characterInMirror() { Icon *icon1 = &_gameIcons[3]; Icon *icon = &_gameIcons[_roomIconsBase]; - Follower *suiveur = followerList; + Follower *suiveur = _followerList; int16 num = 1; for (int i = 0; i < 16; i++) { if (_globals->_party & (1 << i)) @@ -2661,7 +2661,7 @@ void EdenGame::closeCharacterScreen() { // Original name: af_fondsuiveur void EdenGame::displayBackgroundFollower() { char id = _globals->_characterPtr->_id; - for (Follower *follower = followerList; follower->_id != -1; follower++) { + for (Follower *follower = _followerList; follower->_id != -1; follower++) { if (follower->_id == id) { int bank = 326; if (follower->sx >= 320) @@ -4835,15 +4835,15 @@ void EdenGame::loadpermfiles() { // Read the common static data for (int i = 0; i < kNumFollowers; i++) { - followerList[i]._id = f.readSByte(); - followerList[i]._spriteNum = f.readSByte(); - followerList[i].sx = f.readSint16LE(); - followerList[i].sy = f.readSint16LE(); - followerList[i].ex = f.readSint16LE(); - followerList[i].ey = f.readSint16LE(); - followerList[i]._spriteBank = f.readSint16LE(); - followerList[i].ff_C = f.readSint16LE(); - followerList[i].ff_E = f.readSint16LE(); + _followerList[i]._id = f.readSByte(); + _followerList[i]._spriteNum = f.readSByte(); + _followerList[i].sx = f.readSint16LE(); + _followerList[i].sy = f.readSint16LE(); + _followerList[i].ex = f.readSint16LE(); + _followerList[i].ey = f.readSint16LE(); + _followerList[i]._spriteBank = f.readSint16LE(); + _followerList[i].ff_C = f.readSint16LE(); + _followerList[i].ff_E = f.readSint16LE(); } f.read(_labyrinthPath, kNumLabyrinthPath); @@ -8104,7 +8104,7 @@ void EdenGame::phase352() { _personRoomBankTable[30] = 26; _persons[PER_EVE]._spriteBank = 9; _persons[PER_EVE]._targetLoc = 8; - followerList[13]._spriteNum = 2; + _followerList[13]._spriteNum = 2; dialautoon(); _gameRooms[288]._exits[0] = 0xFF; _gameRooms[289]._exits[0] = 0xFF; @@ -8240,8 +8240,8 @@ h->write(ptr, *size); CLFile_Write(handle, &_objects[0], &size); size = (char *)(&_objectLocations[45]) - (char *)(&_objectLocations[0]); CLFile_Write(handle, &_objectLocations[0], &size); - size = (char *)(&followerList[14]) - (char *)(&followerList[13]); - CLFile_Write(handle, &followerList[13], &size); + size = (char *)(&_followerList[14]) - (char *)(&_followerList[13]); + CLFile_Write(handle, &_followerList[13], &size); size = (char *)(&_persons[PER_UNKN_3DE]) - (char *)(&_persons[PER_KING]); CLFile_Write(handle, &_persons[PER_KING], &size); bandeoffsetout(); @@ -8289,8 +8289,8 @@ void EdenGame::loadrestart() { size = (char *)(&_objectLocations[45]) - (char *)(&_objectLocations[0]); loadpartoffile(2495, &_objectLocations[0], offs, size); offs += size; - size = (char *)(&followerList[14]) - (char *)(&followerList[13]); - loadpartoffile(2495, &followerList[13], offs, size); + size = (char *)(&_followerList[14]) - (char *)(&_followerList[13]); + loadpartoffile(2495, &_followerList[13], offs, size); offs += size; size = (char *)(&_persons[PER_UNKN_3DE]) - (char *)(&_persons[PER_KING]); loadpartoffile(2495, &_persons[PER_KING], offs, size); @@ -8334,8 +8334,8 @@ void EdenGame::loadgame(char *name) { CLFile_Read(handle, &_objects[0], &size); size = (char *)(&_objectLocations[45]) - (char *)(&_objectLocations[0]); CLFile_Read(handle, &_objectLocations[0], &size); - size = (char *)(&followerList[14]) - (char *)(&followerList[13]); - CLFile_Read(handle, &followerList[13], &size); + size = (char *)(&_followerList[14]) - (char *)(&_followerList[13]); + CLFile_Read(handle, &_followerList[13], &size); size = (char *)(&_persons[55]) - (char *)(&_persons[0]); CLFile_Read(handle, &_persons[0], &size); size = (char *)(&_tapes[16]) - (char *)(&_tapes[0]); diff --git a/engines/cryo/eden.h b/engines/cryo/eden.h index 8133ff7765..e3078b1d5b 100644 --- a/engines/cryo/eden.h +++ b/engines/cryo/eden.h @@ -739,7 +739,7 @@ private: const unsigned int kMaxMusicSize; // largest .mus file size // Loaded from cryo.dat - Follower followerList[15]; + Follower _followerList[15]; byte _labyrinthPath[70]; char _dinoSpeedForCitadelLevel[16]; char _tabletView[12]; -- cgit v1.2.3