diff options
-rw-r--r-- | devtools/create_cryo/create_cryo_dat.cpp | 216 | ||||
-rw-r--r-- | devtools/create_cryo/create_led_dat.cpp | 105 | ||||
-rw-r--r-- | devtools/create_cryo/eden.h | 249 | ||||
-rw-r--r-- | devtools/create_cryo/eden_static.h (renamed from engines/cryo/staticdata.cpp) | 144 | ||||
-rw-r--r-- | devtools/create_cryo/module.mk | 4 | ||||
-rw-r--r-- | dists/engine-data/README | 3 | ||||
-rw-r--r-- | dists/engine-data/cryo.dat | bin | 0 -> 12499 bytes | |||
-rw-r--r-- | engines/cryo/defs.h | 40 | ||||
-rw-r--r-- | engines/cryo/eden.cpp | 728 | ||||
-rw-r--r-- | engines/cryo/eden.h | 36 | ||||
-rw-r--r-- | engines/cryo/module.mk | 1 |
11 files changed, 1008 insertions, 518 deletions
diff --git a/devtools/create_cryo/create_cryo_dat.cpp b/devtools/create_cryo/create_cryo_dat.cpp new file mode 100644 index 0000000000..ca6d4bf790 --- /dev/null +++ b/devtools/create_cryo/create_cryo_dat.cpp @@ -0,0 +1,216 @@ +/* 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 <stdio.h> + +#include "eden.h" +#include "eden_icons.h" +#include "eden_rooms.h" +#include "eden_static.h" + +#define CRYO_DAT_VER 1 // 32-bit integer + +template <typename T> +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<int16>(f, sx); + writeLE<int16>(f, sy); + writeLE<int16>(f, ex); + writeLE<int16>(f, ey); + writeLE<uint16>(f, cursor_id); + writeLE<unsigned int>(f, action_id); + writeLE<unsigned int>(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<byte>(f, ff_0); + writeLE<byte>(f, exits[0]); + writeLE<byte>(f, exits[1]); + writeLE<byte>(f, exits[2]); + writeLE<byte>(f, exits[3]); + writeLE<byte>(f, flags); + writeLE<uint16>(f, bank); + writeLE<uint16>(f, party); + writeLE<byte>(f, level); + writeLE<byte>(f, video); + writeLE<byte>(f, location); + writeLE<byte>(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 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<char>(f, followerList[i]._id); + writeLE<char>(f, followerList[i]._spriteNum); + writeLE<int16>(f, followerList[i].sx); + writeLE<int16>(f, followerList[i].sy); + writeLE<int16>(f, followerList[i].ex); + writeLE<int16>(f, followerList[i].ey); + writeLE<int16>(f, followerList[i]._spriteBank); + writeLE<int16>(f, followerList[i].ff_C); + writeLE<int16>(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, 5, kNumGotos, f); // sizeof(Goto) + + for (int i = 0; i < kNumObjects; i++) { + writeLE<byte>(f, _objects[i]._id); + writeLE<byte>(f, _objects[i]._flags); + writeLE<int>(f, _objects[i]._locations); + writeLE<uint16>(f, _objects[i]._itemMask); + writeLE<uint16>(f, _objects[i]._powerMask); + writeLE<int16>(f, _objects[i]._count); + } + + for (int i = 0; i < kNumObjectLocations; i++) { + writeLE<uint16>(f, kObjectLocations[i]); + } + + for (int i = 0; i < kNumPersons; i++) { + writeLE<uint16>(f, kPersons[i]._roomNum); + writeLE<uint16>(f, kPersons[i]._actionId); + writeLE<uint16>(f, kPersons[i]._partyMask); + writeLE<byte>(f, kPersons[i]._id); + writeLE<byte>(f, kPersons[i]._flags); + writeLE<byte>(f, kPersons[i]._roomBankId); + writeLE<byte>(f, kPersons[i]._spriteBank); + writeLE<uint16>(f, kPersons[i]._items); + writeLE<uint16>(f, kPersons[i]._powers); + writeLE<byte>(f, kPersons[i]._targetLoc); + writeLE<byte>(f, kPersons[i]._lastLoc); + writeLE<byte>(f, kPersons[i]._speed); + writeLE<byte>(f, kPersons[i]._steps); + } + + for (int i = 0; i < kNumCitadel; i++) { + writeLE<int16>(f, _citadelList[i]._id); + for (int j = 0; j < 8; j++) + writeLE<int16>(f, _citadelList[i]._bank[j]); + for (int j = 0; j < 8; j++) + writeLE<int16>(f, _citadelList[i]._video[j]); + } + + for (int i = 0; i < kNumCharacterRects; i++) { + writeLE<int16>(f, _characterRects[i].left); + writeLE<int16>(f, _characterRects[i].top); + writeLE<int16>(f, _characterRects[i].right); + writeLE<int16>(f, _characterRects[i].bottom); + } + + fwrite(_characterArray, 5, kNumCharacters, f); + + for (int i = 0; i < kNumAreas; i++) { + writeLE<byte>(f, kAreasTable[i]._num); + writeLE<byte>(f, kAreasTable[i]._type); + writeLE<uint16>(f, kAreasTable[i]._flags); + writeLE<uint16>(f, kAreasTable[i]._firstRoomIdx); + writeLE<byte>(f, kAreasTable[i]._citadelLevel); + writeLE<byte>(f, kAreasTable[i]._placeNum); + // pointer to _citadelRoomPtr is always initialized to null + writeLE<int16>(f, kAreasTable[i]._visitCount); + } + + for (int i = 0; i < 64; i++) { + writeLE<uint16>(f, tab_2CEF0[i]); + } + + for (int i = 0; i < 64; i++) { + writeLE<uint16>(f, tab_2CF70[i]); + } + + fwrite(kActionCursors, 1, kNumActionCursors, f); + fwrite(mapMode, 1, 12, f); + fwrite(cubeTextureCoords, 6 * 2 * 3 * 2, 3, 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<uint32>(f, CRYO_DAT_VER); + + emitIcons(f); + emitRooms(f); + emitStatic(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 <output.dat>\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 e58ee7512d..0000000000 --- a/devtools/create_cryo/create_led_dat.cpp +++ /dev/null @@ -1,105 +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 <stdio.h> - -#include "eden.h" -#include "eden_icons.h" -#include "eden_rooms.h" - -template <typename T> -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<int16>(f, sx); - writeLE<int16>(f, sy); - writeLE<int16>(f, ex); - writeLE<int16>(f, ey); - writeLE<uint16>(f, cursor_id); - writeLE<unsigned int>(f, action_id); - writeLE<unsigned int>(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<byte>(f, ff_0); - writeLE<byte>(f, exits[0]); - writeLE<byte>(f, exits[1]); - writeLE<byte>(f, exits[2]); - writeLE<byte>(f, exits[3]); - writeLE<byte>(f, flags); - writeLE<uint16>(f, bank); - writeLE<uint16>(f, party); - writeLE<byte>(f, level); - writeLE<byte>(f, video); - writeLE<byte>(f, location); - writeLE<byte>(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); - - 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 <output.dat>\n", argv[0]); - - return 0; -} diff --git a/devtools/create_cryo/eden.h b/devtools/create_cryo/eden.h index dfbe7cae52..771c8309a2 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 int32; +typedef unsigned int uint32; struct icon_t { int16 sx; @@ -49,3 +51,250 @@ 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; +}; + +namespace PersonId { +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 +}; +} + +namespace PersonMask { +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 +}; +} + +namespace PersonFlags { +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 +}; +} + +namespace Objects { +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; +}; + +namespace Areas { +enum Areas { + arMo = 1, + arTausCave, + arChamaar, + arUluru, + arKoto, + arTamara, + arCantura, + arShandovra, + arNarimsCave, + arEmbalmersCave, + arWhiteArch, + arMoorkusLair +}; +} + +namespace AreaFlags { +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; +}; + +namespace AreaType { +enum AreaType { + atCitadel = 1, + atValley = 2, + atCave = 3 +}; +} diff --git a/engines/cryo/staticdata.cpp b/devtools/create_cryo/eden_static.h index 1184791850..4bff896869 100644 --- a/engines/cryo/staticdata.cpp +++ b/devtools/create_cryo/eden_static.h @@ -20,12 +20,10 @@ * */ -#include "cryo/defs.h" -#include "cryo/cryolib.h" +#pragma once +#include "eden.h" -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 +42,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 +54,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 +65,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 +92,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 +226,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 @@ -286,7 +276,7 @@ object_t _objects[] = { { 42, 0, 3, 0x8000, 0, 0} // Tablet #6 (Castra) }; -uint16 kObjectLocations[100] = { +uint16 kObjectLocations[45] = { 0x112, 0xFFFF, 0x202, 0xFFFF, 0x120, 0xFFFF, @@ -301,7 +291,7 @@ uint16 kObjectLocations[100] = { 0xFFFF }; -perso_t kPersons[] = { +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 }, @@ -371,7 +361,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 +371,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? +Rect _characterRects[19] = { // TODO: just an array of int16s? { 93, 69, 223, 176}, { 102, 86, 162, 126}, { 88, 103, 168, 163}, @@ -403,30 +393,30 @@ prect_t _characterRects[] = { //TODO: just an array of int16s? { 188, 83, 251, 158} }; -byte _characterArray[][5] = { //TODO: struc? - { 8, 15, 23, 25, 0xFF}, - { 0, 9, 0xFF }, - { 0, 9, 0xFF }, - { 0, 9, 0xFF }, - { 0, 13, 0xFF }, - { 16, 21, 0xFF }, - { 11, 20, 0xFF }, - { 0, 12, 0xFF }, - { 0, 9, 0xFF }, - { 0, 9, 0xFF }, - { 5, 13, 0xFF }, - { 0xFF }, - { 0, 8, 0xFF }, - { 0xFF }, - { 0, 7, 0xFF }, - { 0, 8, 0xFF }, - { 8, 12, 0xFF }, - { 0, 5, 0xFF }, - { 0, 4, 0xFF }, - { 0xFF } +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[] = { +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}, @@ -455,7 +445,7 @@ int16 tab_2CF70[64] = { 18, 275, 0, 0, 35, 254, 36, 255, 19, 318, 23, 256, 0, 0, 0, 0, }; -int16 kActionCursors[299] = { +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, @@ -488,8 +478,64 @@ int16 kActionCursors[299] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -float _translationZ = -3400; -float flt_2DF80 = -3400; -float flt_2DF84 = 200; +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, -} // End of namespace Cryo + 2, 30, 2, 2, 30, 2, + 2, 30, 30, 2, 30, 30 + } +};
\ No newline at end of file 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 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 Binary files differnew file mode 100644 index 0000000000..4f23480560 --- /dev/null +++ b/dists/engine-data/cryo.dat diff --git a/engines/cryo/defs.h b/engines/cryo/defs.h index b7206dc7e4..617172d6e6 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; @@ -764,11 +764,6 @@ struct Citadel { int16 _video[8]; }; -/////////////// vars - -extern Follower followerList[]; - - /* Labyrinth of Mo @@ -783,33 +778,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; @@ -833,10 +801,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 b8e191c50b..9bd2e8db3b 100644 --- a/engines/cryo/eden.cpp +++ b/engines/cryo/eden.cpp @@ -48,12 +48,11 @@ namespace Cryo { -int16 _torchTick = 0; -int16 _glowIndex = 0; -int16 _torchCurIndex = 0; - -bool _allowDoubled = true; -int _cursCenter = 11; +#define CRYO_DAT_VER 1 // 1 byte +#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] = { @@ -168,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() { @@ -280,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)) @@ -300,7 +307,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; @@ -356,7 +363,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(); @@ -508,7 +515,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; } @@ -524,9 +531,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; @@ -705,7 +712,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; @@ -871,7 +878,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; @@ -1608,7 +1615,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); } @@ -1622,7 +1629,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); @@ -1714,7 +1721,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))) @@ -1733,7 +1740,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; @@ -1755,7 +1762,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; @@ -1806,7 +1813,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) @@ -1847,7 +1854,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; @@ -1877,7 +1884,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; @@ -1897,7 +1904,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; @@ -1908,7 +1915,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; @@ -1972,7 +1979,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); @@ -2039,7 +2046,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) @@ -2058,7 +2065,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) { @@ -2069,7 +2076,7 @@ void EdenGame::newValley() { roomNum = *ptr++; } perso->_roomNum = 0xFFFF; - kAreasTable[7]._flags |= AreaFlags::HasTyrann; + _areasTable[7]._flags |= AreaFlags::HasTyrann; _globals->_worldHasTyran = 32; } @@ -2138,7 +2145,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) @@ -2173,7 +2180,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)) { @@ -2188,7 +2195,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; @@ -2228,7 +2235,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(); @@ -2357,7 +2364,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; @@ -2654,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) @@ -2669,7 +2676,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); @@ -2680,7 +2687,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; @@ -2692,14 +2699,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) { @@ -2710,7 +2717,7 @@ void EdenGame::displayCharacterBackground1() { ptab++; } if (bank == 0xFF) { - ptab = kPersoRoomBankTable + _globals->_characterPtr->_roomBankId; + ptab = _personRoomBankTable + _globals->_characterPtr->_roomBankId; bank = *ptab++; } } @@ -2731,7 +2738,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; } @@ -2756,7 +2763,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; @@ -2773,10 +2780,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 { @@ -2799,10 +2806,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; @@ -3247,7 +3254,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(); @@ -3276,7 +3283,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); @@ -3292,7 +3299,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; @@ -3306,53 +3313,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; @@ -3362,23 +3369,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(); } @@ -3403,13 +3410,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]; } } } @@ -3434,13 +3441,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]; } } } @@ -3452,15 +3459,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; } @@ -3501,12 +3508,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: @@ -3526,7 +3533,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) @@ -3548,7 +3555,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: @@ -3585,7 +3592,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; @@ -3599,7 +3606,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(); } @@ -3628,7 +3635,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; } @@ -3636,13 +3643,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; } @@ -3652,7 +3659,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); } @@ -3680,14 +3687,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; @@ -3776,7 +3783,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; @@ -3797,7 +3804,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; @@ -3829,11 +3836,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; @@ -3899,7 +3906,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; @@ -3933,7 +3940,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) @@ -3956,9 +3963,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; @@ -4016,7 +4023,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; @@ -4087,7 +4094,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(); } @@ -4160,9 +4167,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; @@ -4601,7 +4608,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 / 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(); @@ -4636,7 +4643,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 / 14; // sizeof(Room) for (int i = 0; i < count; i++) { buffer[i]._id = _bigfile.readByte(); for (int j = 0; j < 4; j++) @@ -4727,17 +4734,68 @@ void EdenGame::convertMacToPC() { } 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 * 18 + // sizeof(Icon) + kNumRooms * 14 + // sizeof(Room) + kNumFollowers * 16 + // sizeof(Follower) + kNumLabyrinthPath + + kNumDinoSpeedForCitaLevel + + kNumTabletView + + kNumPersoRoomBankTable + + kNumGotos * 5 + // sizeof(Goto) + kNumObjects * 12 + // sizeof(object_t) + kNumObjectLocations * 2 + + kNumPersons * 18 + // sizeof(perso_t) + kNumCitadel * 34 + // sizeof(Citadel) + kNumCharacterRects * 8 + + kNumCharacters * 5 + + kNumAreas * 10 + // (sizeof(Area) - 4) + 64 * 2 + + 64 * 2 + + kNumActionCursors + + 12 + + 3 * 6 * 2 * 3 * 2; + + if (f.open("cryo.dat")) { + const int dataSize = f.size() - 8 - 4; // CRYODATA + version + char headerId[9]; + + f.read(headerId, 8); + headerId[8] = '\0'; + if (strcmp(headerId, "CRYODATA")) + error("Invalid cryo.dat aux data file"); + + if (f.readUint32LE() != CRYO_DAT_VER) + error("Incorrect data version for cryo.dat"); + + if (dataSize != expectedDataSize) + error("Mismatching data in cryo.dat aux data file (got %d, expected %d)", dataSize, expectedDataSize); + } else + error("Can not load cryo.dat"); + 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; - - if (f.open("led.dat")) { - const int kNumIcons = 136; - const int kNumRooms = 424; - if (f.size() != kNumIcons * sizeof(Icon) + kNumRooms * sizeof(Room)) - error("Mismatching aux data"); for (int i = 0; i < kNumIcons; i++) { _gameIcons[i].sx = f.readSint16LE(); _gameIcons[i].sy = f.readSint16LE(); @@ -4748,7 +4806,7 @@ void EdenGame::loadpermfiles() { _gameIcons[i]._objectId = f.readUint32LE(); } - for (int i = 0; i <kNumRooms; i++) { + for (int i = 0; i < kNumRooms; i++) { _gameRooms[i]._id = f.readByte(); for (int j = 0; j < 4; j++) _gameRooms[i]._exits[j] = f.readByte(); @@ -4760,22 +4818,111 @@ 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 * 14 + kNumRooms * 11); break; default: error("Unsupported platform"); } + // 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(); + } + + 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(); + _objects[i]._flags = f.readByte(); + _objects[i]._locations = f.readUint32LE(); + _objects[i]._itemMask = f.readUint16LE(); + _objects[i]._powerMask = f.readUint16LE(); + _objects[i]._count = f.readSint16LE(); + } + + for (int i = 0; i < kNumObjectLocations; i++) { + _objectLocations[i] = f.readUint16LE(); + } + + for (int i = 0; i < kNumPersons; i++) { + _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++) { + _citadelList[i]._id = f.readSint16LE(); + for (int j = 0; j < 8; j++) + _citadelList[i]._bank[j] = f.readSint16LE(); + for (int j = 0; j < 8; j++) + _citadelList[i]._video[j] = f.readSint16LE(); + } + + for (int i = 0; i < kNumCharacterRects; i++) { + _characterRects[i].left = f.readSint16LE(); + _characterRects[i].top = f.readSint16LE(); + _characterRects[i].right = f.readSint16LE(); + _characterRects[i].bottom = f.readSint16LE(); + } + + f.read(_characterArray, kNumCharacters * 5); + + for (int i = 0; i < kNumAreas; i++) { + _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++) { + tab_2CEF0[i] = f.readSint16LE(); + } + + for (int i = 0; i < 64; i++) { + tab_2CF70[i] = f.readSint16LE(); + } + + f.read(_actionCursors, kNumActionCursors); + f.read(_mapMode, 12); + f.read(_cubeTextureCoords, 3 * 6 * 2 * 3 * 2); + + f.close(); + loadRawFile(0, _mainBankBuf); loadRawFile(402, _gameFont); loadRawFile(404, _gameDialogs); @@ -4878,7 +5025,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) @@ -5146,7 +5293,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); @@ -5246,14 +5393,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; } @@ -5285,7 +5432,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; @@ -5297,7 +5444,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) @@ -5334,7 +5481,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) @@ -5408,7 +5555,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; @@ -5733,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; @@ -6219,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) { @@ -6366,23 +6512,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; @@ -6685,7 +6831,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; } @@ -6736,7 +6882,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) @@ -6747,7 +6893,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) { @@ -6802,7 +6948,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; @@ -6826,7 +6972,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; @@ -6934,9 +7080,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(); @@ -7002,9 +7148,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; @@ -7059,9 +7205,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; @@ -7372,9 +7518,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; @@ -7450,7 +7596,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)) @@ -7493,7 +7639,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: @@ -7512,7 +7658,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) { @@ -7539,7 +7685,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; @@ -7565,7 +7711,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; @@ -7575,14 +7721,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; @@ -7592,7 +7738,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; } @@ -7601,8 +7747,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; @@ -7625,8 +7771,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() { @@ -7670,7 +7816,7 @@ void EdenGame::incPhase() { void EdenGame::phase113() { removeFromParty(PER_DINA); - kPersons[PER_DINA]._roomNum = 274; + _persons[PER_DINA]._roomNum = 274; } void EdenGame::phase130() { @@ -7681,7 +7827,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; } @@ -7700,8 +7846,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() { @@ -7742,8 +7888,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; @@ -7857,11 +8003,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() { @@ -7892,7 +8038,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; @@ -7911,7 +8057,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; } @@ -7927,7 +8073,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; @@ -7937,7 +8083,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; @@ -7955,10 +8101,10 @@ void EdenGame::phase336() { } void EdenGame::phase352() { - kPersoRoomBankTable[30] = 26; - kPersons[PER_EVE]._spriteBank = 9; - kPersons[PER_EVE]._targetLoc = 8; - followerList[13]._spriteNum = 2; + _personRoomBankTable[30] = 26; + _persons[PER_EVE]._spriteBank = 9; + _persons[PER_EVE]._targetLoc = 8; + _followerList[13]._spriteNum = 2; dialautoon(); _gameRooms[288]._exits[0] = 0xFF; _gameRooms[289]._exits[0] = 0xFF; @@ -7969,8 +8115,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() { @@ -7985,10 +8131,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() { @@ -8000,9 +8146,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; } @@ -8015,7 +8161,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); @@ -8025,7 +8171,7 @@ void EdenGame::phase480() { giveObject(); newValley(); handleEloiReturn(); - kTabletView[1] = 94; + _tabletView[1] = 94; } void EdenGame::phase496() { @@ -8058,7 +8204,7 @@ void EdenGame::phase544() { } void EdenGame::phase560() { - kPersons[PER_ELOI]._roomNum = 3073; + _persons[PER_ELOI]._roomNum = 3073; _gameRooms[127]._exits[1] = 0; } @@ -8086,23 +8232,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 *)(&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 *)(&_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 *)(&_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); @@ -8130,8 +8276,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]); @@ -8140,21 +8286,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); + 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); @@ -8179,24 +8325,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 *)(&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 *)(&_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 *)(&_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); @@ -8221,11 +8367,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() { @@ -8237,33 +8383,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); } } @@ -8691,77 +8837,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++]; } } } @@ -8809,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; @@ -8828,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 b6d8f25485..e3078b1d5b 100644 --- a/engines/cryo/eden.h +++ b/engines/cryo/eden.h @@ -576,7 +576,7 @@ private: int _lastAnimFrameNumb; int _curAnimFrameNumb; int _lastAnimTicks; - prect_t *_curCharacterRect; + Common::Rect *_curCharacterRect; int16 _numAnimFrames; int16 _maxPersoDesc; int16 _numImgDesc; @@ -737,6 +737,40 @@ private: uint8 tab_2CB1E[8][4]; const unsigned int kMaxMusicSize; // largest .mus file size + + // Loaded from cryo.dat + Follower _followerList[15]; + 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]; + object_t _objects[42]; + uint16 _objectLocations[45]; + perso_t _persons[58]; + Citadel _citadelList[7]; + + // Loaded from cryo.dat + Common::Rect _characterRects[19]; + byte _characterArray[20][5]; + Area _areasTable[12]; + int16 tab_2CEF0[64]; + int16 tab_2CF70[64]; + byte _actionCursors[299]; + byte _mapMode[12]; + byte _cubeTextureCoords[3][6 * 2 * 3 * 2]; + + int32 _translationZ; + int8 _zDirection; // 1 (up) or -1 (down) + + // Torch/glow related + int16 _torchTick; + int16 _glowIndex; + int16 _torchCurIndex; + + int _cursCenter; }; } diff --git a/engines/cryo/module.mk b/engines/cryo/module.mk index d0eae378b7..aa9649ff82 100644 --- a/engines/cryo/module.mk +++ b/engines/cryo/module.mk @@ -7,7 +7,6 @@ MODULE_OBJS = \ detection.o \ eden.o \ sound.o \ - staticdata.o \ video.o # This module can be built as a plugin |