PageRenderTime 55ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/engines/kyra/staticres.cpp

http://github.com/scummvm/scummvm
C++ | 2046 lines | 1692 code | 313 blank | 41 comment | 211 complexity | 9427d0ae5f53985cb4f8e00ec03712b6 MD5 | raw file
Possible License(s): GPL-3.0, LGPL-2.1, GPL-2.0

Large files files are truncated, but you can click here to view the full file

  1. /* ScummVM - Graphic Adventure Engine
  2. *
  3. * ScummVM is the legal property of its developers, whose names
  4. * are too numerous to list here. Please refer to the COPYRIGHT
  5. * file distributed with this source distribution.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  20. *
  21. */
  22. #include "kyra/resource.h"
  23. #include "kyra/kyra_lok.h"
  24. #include "kyra/kyra_hof.h"
  25. #include "kyra/kyra_mr.h"
  26. #include "kyra/screen.h"
  27. #include "kyra/screen_lok.h"
  28. #include "kyra/screen_hof.h"
  29. #include "kyra/screen_mr.h"
  30. #include "kyra/gui_lok.h"
  31. #include "kyra/gui_hof.h"
  32. #include "kyra/gui_mr.h"
  33. #include "kyra/sequences_hof.h"
  34. #include "kyra/sound_intern.h"
  35. #include "common/endian.h"
  36. #include "common/md5.h"
  37. namespace Kyra {
  38. #define RESFILE_VERSION 89
  39. namespace {
  40. bool checkKyraDat(Common::SeekableReadStream *file) {
  41. if (!file)
  42. return false;
  43. uint32 size = file->size() - 16;
  44. uint8 digest[16];
  45. file->seek(size, SEEK_SET);
  46. if (file->read(digest, 16) != 16)
  47. return false;
  48. uint8 digestCalc[16];
  49. file->seek(0, SEEK_SET);
  50. if (!Common::computeStreamMD5(*file, digestCalc, size))
  51. return false;
  52. for (int i = 0; i < 16; ++i)
  53. if (digest[i] != digestCalc[i])
  54. return false;
  55. return true;
  56. }
  57. struct IndexTable {
  58. int type;
  59. int value;
  60. bool operator==(int t) const {
  61. return (type == t);
  62. }
  63. };
  64. const IndexTable iGameTable[] = {
  65. { GI_KYRA1, 0 },
  66. { GI_KYRA2, 1 },
  67. { GI_KYRA3, 2 },
  68. { GI_EOB1, 3 },
  69. { GI_EOB2, 4 },
  70. { GI_LOL, 5 },
  71. { -1, -1 }
  72. };
  73. byte getGameID(const GameFlags &flags) {
  74. return Common::find(iGameTable, ARRAYEND(iGameTable) - 1, flags.gameID)->value;
  75. }
  76. const IndexTable iLanguageTable[] = {
  77. { Common::EN_ANY, 1 },
  78. { Common::FR_FRA, 2 },
  79. { Common::DE_DEU, 3 },
  80. { Common::ES_ESP, 4 },
  81. { Common::IT_ITA, 5 },
  82. { Common::JA_JPN, 6 },
  83. { Common::RU_RUS, 7 },
  84. { -1, -1 }
  85. };
  86. byte getLanguageID(const GameFlags &flags) {
  87. return Common::find(iLanguageTable, ARRAYEND(iLanguageTable) - 1, flags.lang)->value;
  88. }
  89. const IndexTable iPlatformTable[] = {
  90. { Common::kPlatformDOS, 0 },
  91. { Common::kPlatformAmiga, 1 },
  92. { Common::kPlatformFMTowns, 2 },
  93. { Common::kPlatformPC98, 3 },
  94. { Common::kPlatformMacintosh, 0 }, // HACK: Should be type "4", but as long as we can't extract Macintosh data, we need to use DOS data.
  95. { -1, -1 }
  96. };
  97. byte getPlatformID(const GameFlags &flags) {
  98. return Common::find(iPlatformTable, ARRAYEND(iPlatformTable) - 1, flags.platform)->value;
  99. }
  100. byte getSpecialID(const GameFlags &flags) {
  101. if (flags.isOldFloppy)
  102. return 4;
  103. else if (flags.isDemo && flags.isTalkie)
  104. return 3;
  105. else if (flags.isDemo)
  106. return 2;
  107. else if (flags.isTalkie)
  108. return 1;
  109. else
  110. return 0;
  111. }
  112. } // end of anonymous namespace
  113. bool StaticResource::loadStaticResourceFile() {
  114. Resource *res = _vm->resource();
  115. if (res->isInCacheList(staticDataFilename()))
  116. return true;
  117. Common::ArchiveMemberList kyraDatFiles;
  118. res->listFiles(staticDataFilename(), kyraDatFiles);
  119. bool foundWorkingKyraDat = false;
  120. for (Common::ArchiveMemberList::iterator i = kyraDatFiles.begin(); i != kyraDatFiles.end(); ++i) {
  121. Common::SeekableReadStream *file = (*i)->createReadStream();
  122. if (!checkKyraDat(file)) {
  123. delete file;
  124. continue;
  125. }
  126. delete file; file = 0;
  127. if (!res->loadPakFile(staticDataFilename(), *i))
  128. continue;
  129. if (tryKyraDatLoad()) {
  130. foundWorkingKyraDat = true;
  131. break;
  132. }
  133. res->unloadPakFile(staticDataFilename(), true);
  134. unloadId(-1);
  135. }
  136. if (!foundWorkingKyraDat) {
  137. Common::String errorMessage = "You're missing the '" + StaticResource::staticDataFilename() + "' file or it got corrupted, (re)get it from the ScummVM website";
  138. GUIErrorMessage(errorMessage);
  139. error("%s", errorMessage.c_str());
  140. }
  141. return true;
  142. }
  143. bool StaticResource::tryKyraDatLoad() {
  144. Common::SeekableReadStream *index = _vm->resource()->createReadStream("INDEX");
  145. if (!index)
  146. return false;
  147. const uint32 version = index->readUint32BE();
  148. if (version != RESFILE_VERSION) {
  149. delete index;
  150. return false;
  151. }
  152. const uint32 includedGames = index->readUint32BE();
  153. if (includedGames * 2 + 8 != (uint32)index->size()) {
  154. delete index;
  155. return false;
  156. }
  157. const GameFlags &flags = _vm->gameFlags();
  158. const byte game = getGameID(flags) & 0xF;
  159. const byte platform = getPlatformID(flags) & 0xF;
  160. const byte special = getSpecialID(flags) & 0xF;
  161. const byte lang = getLanguageID(flags) & 0xF;
  162. const uint16 gameDef = (game << 12) | (platform << 8) | (special << 4) | (lang << 0);
  163. bool found = false;
  164. for (uint32 i = 0; i < includedGames; ++i) {
  165. if (index->readUint16BE() == gameDef) {
  166. found = true;
  167. break;
  168. }
  169. }
  170. delete index;
  171. index = 0;
  172. if (!found)
  173. return false;
  174. // load the ID map for our game
  175. const Common::String filenamePattern = Common::String::format("0%01X%01X%01X000%01X", game, platform, special, lang);
  176. Common::SeekableReadStream *idMap = _vm->resource()->createReadStream(filenamePattern);
  177. if (!idMap)
  178. return false;
  179. uint16 numIDs = idMap->readUint16BE();
  180. while (numIDs--) {
  181. uint16 id = idMap->readUint16BE();
  182. uint8 type = idMap->readByte();
  183. uint32 filename = idMap->readUint32BE();
  184. _dataTable[id] = DataDescriptor(filename, type);
  185. }
  186. const bool fileError = idMap->err();
  187. delete idMap;
  188. if (fileError)
  189. return false;
  190. // load all tables for now
  191. if (!prefetchId(-1))
  192. return false;
  193. return true;
  194. }
  195. bool StaticResource::init() {
  196. #define proc(x) &StaticResource::x
  197. static const FileType fileTypeTable[] = {
  198. { kStringList, proc(loadStringTable), proc(freeStringTable) },
  199. { StaticResource::kRoomList, proc(loadRoomTable), proc(freeRoomTable) },
  200. { kShapeList, proc(loadShapeTable), proc(freeShapeTable) },
  201. { kAmigaSfxTable, proc(loadAmigaSfxTable), proc(freeAmigaSfxTable) },
  202. { kRawData, proc(loadRawData), proc(freeRawData) },
  203. { k2SeqData, proc(loadHoFSequenceData), proc(freeHoFSequenceData) },
  204. { k2SeqItemAnimData, proc(loadHoFSeqItemAnimData), proc(freeHoFSeqItemAnimData) },
  205. { k2ItemAnimDefinition, proc(loadItemAnimDefinition), proc(freeItemAnimDefinition) },
  206. #ifdef ENABLE_LOL
  207. { kLoLCharData, proc(loadCharData), proc(freeCharData) },
  208. { kLoLSpellData, proc(loadSpellData), proc(freeSpellData) },
  209. { kLoLCompassData, proc(loadCompassData), proc(freeCompassData) },
  210. { kLoLFlightShpData, proc(loadFlyingObjectData), proc(freeFlyingObjectData) },
  211. #else
  212. { kLoLCharData, proc(loadDummy), proc(freeDummy) },
  213. { kLoLSpellData, proc(loadDummy), proc(freeDummy) },
  214. { kLoLCompassData, proc(loadDummy), proc(freeDummy) },
  215. { kLoLFlightShpData, proc(loadDummy), proc(freeDummy) },
  216. #endif
  217. #if defined(ENABLE_EOB) || defined(ENABLE_LOL)
  218. { kRawDataBe16, proc(loadRawDataBe16), proc(freeRawDataBe16) },
  219. { kRawDataBe32, proc(loadRawDataBe32), proc(freeRawDataBe32) },
  220. #endif
  221. #ifdef ENABLE_LOL
  222. { kLoLButtonData, proc(loadButtonDefs), proc(freeButtonDefs) },
  223. #else
  224. { kLoLButtonData, proc(loadDummy), proc(freeDummy) },
  225. #endif
  226. #ifdef ENABLE_EOB
  227. { kEoB2SequenceData, proc(loadEoB2SeqData), proc(freeEoB2SeqData) },
  228. { kEoB2ShapeData, proc(loadEoB2ShapeData), proc(freeEoB2ShapeData) },
  229. { kEoBNpcData, proc(loadEoBNpcData), proc(freeEoBNpcData) },
  230. #endif
  231. { 0, 0, 0 }
  232. };
  233. #undef proc
  234. _fileLoader = fileTypeTable;
  235. return loadStaticResourceFile();
  236. }
  237. void StaticResource::deinit() {
  238. unloadId(-1);
  239. }
  240. const char *const *StaticResource::loadStrings(int id, int &strings) {
  241. return (const char *const *)getData(id, kStringList, strings);
  242. }
  243. const uint8 *StaticResource::loadRawData(int id, int &size) {
  244. return (const uint8 *)getData(id, kRawData, size);
  245. }
  246. const Shape *StaticResource::loadShapeTable(int id, int &entries) {
  247. return (const Shape *)getData(id, kShapeList, entries);
  248. }
  249. const AmigaSfxTable *StaticResource::loadAmigaSfxTable(int id, int &entries) {
  250. return (const AmigaSfxTable *)getData(id, kAmigaSfxTable, entries);
  251. }
  252. const Room *StaticResource::loadRoomTable(int id, int &entries) {
  253. return (const Room *)getData(id, StaticResource::kRoomList, entries);
  254. }
  255. const HoFSeqData *StaticResource::loadHoFSequenceData(int id, int &entries) {
  256. return (const HoFSeqData *)getData(id, k2SeqData, entries);
  257. }
  258. const HoFSeqItemAnimData *StaticResource::loadHoFSeqItemAnimData(int id, int &entries) {
  259. return (const HoFSeqItemAnimData *)getData(id, k2SeqItemAnimData, entries);
  260. }
  261. const ItemAnimDefinition *StaticResource::loadItemAnimDefinition(int id, int &entries) {
  262. return (const ItemAnimDefinition *)getData(id, k2ItemAnimDefinition, entries);
  263. }
  264. bool StaticResource::prefetchId(int id) {
  265. if (id == -1) {
  266. for (DataMap::const_iterator i = _dataTable.begin(); i != _dataTable.end(); ++i) {
  267. if (!prefetchId(i->_key))
  268. return false;
  269. }
  270. return true;
  271. }
  272. const void *ptr = 0;
  273. int type = -1, size = -1;
  274. if (checkResList(id, type, ptr, size))
  275. return true;
  276. DataMap::const_iterator dDesc = _dataTable.find(id);
  277. if (dDesc == _dataTable.end())
  278. return false;
  279. const FileType *filetype = getFiletype(dDesc->_value.type);
  280. if (!filetype)
  281. return false;
  282. ResData data;
  283. data.id = id;
  284. data.type = dDesc->_value.type;
  285. Common::SeekableReadStream *fileStream = _vm->resource()->createReadStream(Common::String::format("%08X", dDesc->_value.filename));
  286. if (!fileStream)
  287. return false;
  288. if (!(this->*(filetype->load))(*fileStream, data.data, data.size)) {
  289. delete fileStream;
  290. return false;
  291. }
  292. delete fileStream;
  293. _resList.push_back(data);
  294. return true;
  295. }
  296. void StaticResource::unloadId(int id) {
  297. Common::List<ResData>::iterator pos = _resList.begin();
  298. for (; pos != _resList.end();) {
  299. if (pos->id == id || id == -1) {
  300. const FileType *filetype = getFiletype(pos->type);
  301. (this->*(filetype->free))(pos->data, pos->size);
  302. pos = _resList.erase(pos);
  303. if (id != -1)
  304. break;
  305. } else {
  306. ++pos;
  307. }
  308. }
  309. }
  310. bool StaticResource::checkResList(int id, int &type, const void *&ptr, int &size) {
  311. Common::List<ResData>::iterator pos = _resList.begin();
  312. for (; pos != _resList.end(); ++pos) {
  313. if (pos->id == id) {
  314. size = pos->size;
  315. type = pos->type;
  316. ptr = pos->data;
  317. return true;
  318. }
  319. }
  320. return false;
  321. }
  322. const StaticResource::FileType *StaticResource::getFiletype(int type) {
  323. if (!_fileLoader)
  324. return 0;
  325. for (int i = 0; _fileLoader[i].load; ++i) {
  326. if (_fileLoader[i].type == type)
  327. return &_fileLoader[i];
  328. }
  329. return 0;
  330. }
  331. const void *StaticResource::getData(int id, int requesttype, int &size) {
  332. const void *ptr = 0;
  333. int type = -1;
  334. size = 0;
  335. if (checkResList(id, type, ptr, size)) {
  336. if (type == requesttype)
  337. return ptr;
  338. return 0;
  339. }
  340. if (!prefetchId(id))
  341. return 0;
  342. if (checkResList(id, type, ptr, size)) {
  343. if (type == requesttype)
  344. return ptr;
  345. }
  346. return 0;
  347. }
  348. bool StaticResource::loadDummy(Common::SeekableReadStream &stream, void *&ptr, int &size) {
  349. return true;
  350. }
  351. bool StaticResource::loadStringTable(Common::SeekableReadStream &stream, void *&ptr, int &size) {
  352. uint32 count = stream.readUint32BE();
  353. size = count;
  354. char **output = new char *[count];
  355. assert(output);
  356. for (uint32 i = 0; i < count; ++i) {
  357. Common::String string;
  358. char c = 0;
  359. while ((c = (char)stream.readByte()) != 0)
  360. string += c;
  361. output[i] = new char[string.size() + 1];
  362. strcpy(output[i], string.c_str());
  363. }
  364. ptr = output;
  365. return true;
  366. }
  367. bool StaticResource::loadRawData(Common::SeekableReadStream &stream, void *&ptr, int &size) {
  368. ptr = new uint8[stream.size()];
  369. stream.read(ptr, stream.size());
  370. size = stream.size();
  371. return true;
  372. }
  373. bool StaticResource::loadShapeTable(Common::SeekableReadStream &stream, void *&ptr, int &size) {
  374. uint32 count = stream.readUint32BE();
  375. size = count;
  376. Shape *loadTo = new Shape[count];
  377. assert(loadTo);
  378. for (uint32 i = 0; i < count; ++i) {
  379. loadTo[i].imageIndex = stream.readByte();
  380. loadTo[i].x = stream.readByte();
  381. loadTo[i].y = stream.readByte();
  382. loadTo[i].w = stream.readByte();
  383. loadTo[i].h = stream.readByte();
  384. loadTo[i].xOffset = stream.readSByte();
  385. loadTo[i].yOffset = stream.readSByte();
  386. }
  387. ptr = loadTo;
  388. return true;
  389. }
  390. bool StaticResource::loadAmigaSfxTable(Common::SeekableReadStream &stream, void *&ptr, int &size) {
  391. size = stream.readUint32BE();
  392. AmigaSfxTable *loadTo = new AmigaSfxTable[size];
  393. assert(loadTo);
  394. for (int i = 0; i < size; ++i) {
  395. loadTo[i].note = stream.readByte();
  396. loadTo[i].patch = stream.readByte();
  397. loadTo[i].duration = stream.readUint16BE();
  398. loadTo[i].volume = stream.readByte();
  399. loadTo[i].pan = stream.readByte();
  400. }
  401. ptr = loadTo;
  402. return true;
  403. }
  404. bool StaticResource::loadRoomTable(Common::SeekableReadStream &stream, void *&ptr, int &size) {
  405. uint32 count = stream.readUint32BE();
  406. size = count;
  407. Room *loadTo = new Room[count];
  408. assert(loadTo);
  409. for (uint32 i = 0; i < count; ++i) {
  410. loadTo[i].nameIndex = stream.readByte();
  411. loadTo[i].northExit = stream.readUint16BE();
  412. loadTo[i].eastExit = stream.readUint16BE();
  413. loadTo[i].southExit = stream.readUint16BE();
  414. loadTo[i].westExit = stream.readUint16BE();
  415. memset(&loadTo[i].itemsTable[0], 0xFF, sizeof(byte) * 6);
  416. memset(&loadTo[i].itemsTable[6], 0, sizeof(byte) * 6);
  417. memset(loadTo[i].itemsXPos, 0, sizeof(uint16) * 12);
  418. memset(loadTo[i].itemsYPos, 0, sizeof(uint8) * 12);
  419. memset(loadTo[i].needInit, 0, sizeof(loadTo[i].needInit));
  420. }
  421. ptr = loadTo;
  422. return true;
  423. }
  424. bool StaticResource::loadHoFSequenceData(Common::SeekableReadStream &stream, void *&ptr, int &size) {
  425. int numSeq = stream.readUint16BE();
  426. uint32 offset = 2;
  427. HoFSequence *tmp_s = new HoFSequence[numSeq];
  428. size = sizeof(HoFSeqData) + numSeq * (sizeof(HoFSequence) + 28);
  429. for (int i = 0; i < numSeq; i++) {
  430. stream.seek(offset, SEEK_SET); offset += 2;
  431. stream.seek(stream.readUint16BE(), SEEK_SET);
  432. tmp_s[i].flags = stream.readUint16BE();
  433. tmp_s[i].wsaFile = new char[14];
  434. stream.read(const_cast<char *>(tmp_s[i].wsaFile), 14);
  435. tmp_s[i].cpsFile = new char[14];
  436. stream.read(const_cast<char *>(tmp_s[i].cpsFile), 14);
  437. tmp_s[i].fadeInTransitionType = stream.readByte();
  438. tmp_s[i].fadeOutTransitionType = stream.readByte();
  439. tmp_s[i].stringIndex1 = stream.readUint16BE();
  440. tmp_s[i].stringIndex2 = stream.readUint16BE();
  441. tmp_s[i].startFrame = stream.readUint16BE();
  442. tmp_s[i].numFrames = stream.readUint16BE();
  443. tmp_s[i].duration = stream.readUint16BE();
  444. tmp_s[i].xPos = stream.readUint16BE();
  445. tmp_s[i].yPos = stream.readUint16BE();
  446. tmp_s[i].timeout = stream.readUint16BE();
  447. }
  448. stream.seek(offset, SEEK_SET); offset += 2;
  449. int numSeqN = stream.readUint16BE();
  450. HoFNestedSequence *tmp_n = new HoFNestedSequence[numSeqN];
  451. size += (numSeqN * (sizeof(HoFNestedSequence) + 14));
  452. for (int i = 0; i < numSeqN; i++) {
  453. stream.seek(offset, SEEK_SET); offset += 2;
  454. stream.seek(stream.readUint16BE(), SEEK_SET);
  455. tmp_n[i].flags = stream.readUint16BE();
  456. tmp_n[i].wsaFile = new char[14];
  457. stream.read(const_cast<char *>(tmp_n[i].wsaFile), 14);
  458. tmp_n[i].startframe = stream.readUint16BE();
  459. tmp_n[i].endFrame = stream.readUint16BE();
  460. tmp_n[i].frameDelay = stream.readUint16BE();
  461. tmp_n[i].x = stream.readUint16BE();
  462. tmp_n[i].y = stream.readUint16BE();
  463. uint16 ctrlOffs = stream.readUint16BE();
  464. tmp_n[i].fadeInTransitionType = stream.readUint16BE();
  465. tmp_n[i].fadeOutTransitionType = stream.readUint16BE();
  466. if (ctrlOffs) {
  467. stream.seek(ctrlOffs, SEEK_SET);
  468. int num_c = stream.readByte();
  469. FrameControl *tmp_f = new FrameControl[num_c];
  470. for (int ii = 0; ii < num_c; ii++) {
  471. tmp_f[ii].index = stream.readUint16BE();
  472. tmp_f[ii].delay = stream.readUint16BE();
  473. }
  474. tmp_n[i].wsaControl = (const FrameControl *)tmp_f;
  475. size += (num_c * sizeof(FrameControl));
  476. } else {
  477. tmp_n[i].wsaControl = 0;
  478. }
  479. }
  480. HoFSeqData *loadTo = new HoFSeqData;
  481. assert(loadTo);
  482. loadTo->seq = tmp_s;
  483. loadTo->nestedSeq = tmp_n;
  484. loadTo->numSeq = numSeq;
  485. loadTo->numNestedSeq = numSeqN;
  486. ptr = loadTo;
  487. return true;
  488. }
  489. bool StaticResource::loadHoFSeqItemAnimData(Common::SeekableReadStream &stream, void *&ptr, int &size) {
  490. size = stream.readByte();
  491. HoFSeqItemAnimData *loadTo = new HoFSeqItemAnimData[size];
  492. assert(loadTo);
  493. for (int i = 0; i < size; i++) {
  494. loadTo[i].itemIndex = stream.readSint16BE();
  495. loadTo[i].y = stream.readUint16BE();
  496. uint16 *tmp_f = new uint16[20];
  497. for (int ii = 0; ii < 20; ii++)
  498. tmp_f[ii] = stream.readUint16BE();
  499. loadTo[i].frames = tmp_f;
  500. }
  501. ptr = loadTo;
  502. return true;
  503. }
  504. bool StaticResource::loadItemAnimDefinition(Common::SeekableReadStream &stream, void *&ptr, int &size) {
  505. size = stream.readByte();
  506. ItemAnimDefinition *loadTo = new ItemAnimDefinition[size];
  507. assert(loadTo);
  508. for (int i = 0; i < size; i++) {
  509. loadTo[i].itemIndex = stream.readSint16BE();
  510. loadTo[i].numFrames = stream.readByte();
  511. FrameControl *tmp_f = new FrameControl[loadTo[i].numFrames];
  512. for (int ii = 0; ii < loadTo[i].numFrames; ii++) {
  513. tmp_f[ii].index = stream.readUint16BE();
  514. tmp_f[ii].delay = stream.readUint16BE();
  515. }
  516. loadTo[i].frames = tmp_f;
  517. }
  518. ptr = loadTo;
  519. return true;
  520. }
  521. void StaticResource::freeDummy(void *&ptr, int &size) {
  522. }
  523. void StaticResource::freeRawData(void *&ptr, int &size) {
  524. uint8 *data = (uint8 *)ptr;
  525. delete[] data;
  526. ptr = 0;
  527. size = 0;
  528. }
  529. void StaticResource::freeStringTable(void *&ptr, int &size) {
  530. char **data = (char **)ptr;
  531. while (size--)
  532. delete[] data[size];
  533. delete[] data;
  534. ptr = 0;
  535. size = 0;
  536. }
  537. void StaticResource::freeShapeTable(void *&ptr, int &size) {
  538. Shape *data = (Shape *)ptr;
  539. delete[] data;
  540. ptr = 0;
  541. size = 0;
  542. }
  543. void StaticResource::freeAmigaSfxTable(void *&ptr, int &size) {
  544. AmigaSfxTable *data = (AmigaSfxTable *)ptr;
  545. delete[] data;
  546. ptr = 0;
  547. size = 0;
  548. }
  549. void StaticResource::freeRoomTable(void *&ptr, int &size) {
  550. Room *data = (Room *)ptr;
  551. delete[] data;
  552. ptr = 0;
  553. size = 0;
  554. }
  555. void StaticResource::freeHoFSequenceData(void *&ptr, int &size) {
  556. HoFSeqData *h = (HoFSeqData *)ptr;
  557. for (int i = 0; i < h->numSeq; i++) {
  558. delete[] h->seq[i].wsaFile;
  559. delete[] h->seq[i].cpsFile;
  560. }
  561. delete[] h->seq;
  562. for (int i = 0; i < h->numNestedSeq; i++) {
  563. delete[] h->nestedSeq[i].wsaFile;
  564. delete[] h->nestedSeq[i].wsaControl;
  565. }
  566. delete[] h->nestedSeq;
  567. delete h;
  568. ptr = 0;
  569. size = 0;
  570. }
  571. void StaticResource::freeHoFSeqItemAnimData(void *&ptr, int &size) {
  572. HoFSeqItemAnimData *d = (HoFSeqItemAnimData *)ptr;
  573. for (int i = 0; i < size; i++)
  574. delete[] d[i].frames;
  575. delete[] d;
  576. ptr = 0;
  577. size = 0;
  578. }
  579. void StaticResource::freeItemAnimDefinition(void *&ptr, int &size) {
  580. ItemAnimDefinition *d = (ItemAnimDefinition *)ptr;
  581. for (int i = 0; i < size; i++)
  582. delete[] d[i].frames;
  583. delete[] d;
  584. ptr = 0;
  585. size = 0;
  586. }
  587. #pragma mark -
  588. void KyraEngine_LoK::initStaticResource() {
  589. int temp = 0;
  590. _seq_Forest = _staticres->loadRawData(k1ForestSeq, temp);
  591. _seq_KallakWriting = _staticres->loadRawData(k1KallakWritingSeq, temp);
  592. _seq_KyrandiaLogo = _staticres->loadRawData(k1KyrandiaLogoSeq, temp);
  593. _seq_KallakMalcolm = _staticres->loadRawData(k1KallakMalcolmSeq, temp);
  594. _seq_MalcolmTree = _staticres->loadRawData(k1MalcolmTreeSeq, temp);
  595. _seq_WestwoodLogo = _staticres->loadRawData(k1WestwoodLogoSeq, temp);
  596. _seq_Demo1 = _staticres->loadRawData(k1Demo1Seq, temp);
  597. _seq_Demo2 = _staticres->loadRawData(k1Demo2Seq, temp);
  598. _seq_Demo3 = _staticres->loadRawData(k1Demo3Seq, temp);
  599. _seq_Demo4 = _staticres->loadRawData(k1Demo4Seq, temp);
  600. _seq_Reunion = _staticres->loadRawData(k1OutroReunionSeq, temp);
  601. _seq_WSATable = _staticres->loadStrings(k1IntroWSAStrings, _seq_WSATable_Size);
  602. _seq_CPSTable = _staticres->loadStrings(k1IntroCPSStrings, _seq_CPSTable_Size);
  603. _seq_COLTable = _staticres->loadStrings(k1IntroCOLStrings, _seq_COLTable_Size);
  604. _seq_textsTable = _staticres->loadStrings(k1IntroStrings, _seq_textsTable_Size);
  605. _itemList = _staticres->loadStrings(k1ItemNames, _itemList_Size);
  606. _takenList = _staticres->loadStrings(k1TakenStrings, _takenList_Size);
  607. _placedList = _staticres->loadStrings(k1PlacedStrings, _placedList_Size);
  608. _droppedList = _staticres->loadStrings(k1DroppedStrings, _droppedList_Size);
  609. _noDropList = _staticres->loadStrings(k1NoDropStrings, _noDropList_Size);
  610. _putDownFirst = _staticres->loadStrings(k1PutDownString, _putDownFirst_Size);
  611. _waitForAmulet = _staticres->loadStrings(k1WaitAmuletString, _waitForAmulet_Size);
  612. _blackJewel = _staticres->loadStrings(k1BlackJewelString, _blackJewel_Size);
  613. _poisonGone = _staticres->loadStrings(k1PoisonGoneString, _poisonGone_Size);
  614. _healingTip = _staticres->loadStrings(k1HealingTipString, _healingTip_Size);
  615. _thePoison = _staticres->loadStrings(k1ThePoisonStrings, _thePoison_Size);
  616. _fluteString = _staticres->loadStrings(k1FluteStrings, _fluteString_Size);
  617. _wispJewelStrings = _staticres->loadStrings(k1WispJewelStrings, _wispJewelStrings_Size);
  618. _magicJewelString = _staticres->loadStrings(k1MagicJewelStrings, _magicJewelString_Size);
  619. _flaskFull = _staticres->loadStrings(k1FlaskFullString, _flaskFull_Size);
  620. _fullFlask = _staticres->loadStrings(k1FullFlaskString, _fullFlask_Size);
  621. _veryClever = _staticres->loadStrings(k1VeryCleverString, _veryClever_Size);
  622. _homeString = _staticres->loadStrings(k1OutroHomeString, _homeString_Size);
  623. _newGameString = _staticres->loadStrings(k1NewGameString, _newGameString_Size);
  624. _healingShapeTable = _staticres->loadShapeTable(k1Healing1Shapes, _healingShapeTableSize);
  625. _healingShape2Table = _staticres->loadShapeTable(k1Healing2Shapes, _healingShape2TableSize);
  626. _posionDeathShapeTable = _staticres->loadShapeTable(k1PoisonDeathShapes, _posionDeathShapeTableSize);
  627. _fluteAnimShapeTable = _staticres->loadShapeTable(k1FluteShapes, _fluteAnimShapeTableSize);
  628. _winterScrollTable = _staticres->loadShapeTable(k1Winter1Shapes, _winterScrollTableSize);
  629. _winterScroll1Table = _staticres->loadShapeTable(k1Winter2Shapes, _winterScroll1TableSize);
  630. _winterScroll2Table = _staticres->loadShapeTable(k1Winter3Shapes, _winterScroll2TableSize);
  631. _drinkAnimationTable = _staticres->loadShapeTable(k1DrinkShapes, _drinkAnimationTableSize);
  632. _brandonToWispTable = _staticres->loadShapeTable(k1WispShapes, _brandonToWispTableSize);
  633. _magicAnimationTable = _staticres->loadShapeTable(k1MagicAnimShapes, _magicAnimationTableSize);
  634. _brandonStoneTable = _staticres->loadShapeTable(k1BranStoneShapes, _brandonStoneTableSize);
  635. _characterImageTable = _staticres->loadStrings(k1CharacterImageFilenames, _characterImageTableSize);
  636. _roomFilenameTable = _staticres->loadStrings(k1RoomFilenames, _roomFilenameTableSize);
  637. _amuleteAnim = _staticres->loadRawData(k1AmuleteAnimSeq, temp);
  638. const uint8 **palTable = new const uint8 *[k1SpecialPalette33 - k1SpecialPalette1 + 1];
  639. for (int i = k1SpecialPalette1; i <= k1SpecialPalette33; ++i)
  640. palTable[i - k1SpecialPalette1] = _staticres->loadRawData(i, temp);
  641. _specialPalettes = palTable;
  642. _guiStrings = _staticres->loadStrings(k1GUIStrings, _guiStringsSize);
  643. _configStrings = _staticres->loadStrings(k1ConfigStrings, _configStringsSize);
  644. _storyStrings = _staticres->loadStrings(k1PC98StoryStrings, _storyStringsSize);
  645. // room list
  646. const Room *tempRoomList = _staticres->loadRoomTable(k1RoomList, _roomTableSize);
  647. if (_roomTableSize > 0) {
  648. _roomTable = new Room[_roomTableSize];
  649. assert(_roomTable);
  650. memcpy(_roomTable, tempRoomList, _roomTableSize * sizeof(Room));
  651. tempRoomList = 0;
  652. _staticres->unloadId(k1RoomList);
  653. }
  654. // default shape table
  655. const Shape *tempShapeTable = _staticres->loadShapeTable(k1DefaultShapes, _defaultShapeTableSize);
  656. if (_defaultShapeTableSize > 0) {
  657. _defaultShapeTable = new Shape[_defaultShapeTableSize];
  658. assert(_defaultShapeTable);
  659. memcpy(_defaultShapeTable, tempShapeTable, _defaultShapeTableSize * sizeof(Shape));
  660. tempShapeTable = 0;
  661. _staticres->unloadId(k1DefaultShapes);
  662. }
  663. // audio resource assignment
  664. int soundFilesSize;
  665. const char *const *soundFiles = _staticres->loadStrings(k1AudioTracks, soundFilesSize);
  666. int soundFilesIntroSize = 0;
  667. int cdaTableSize = 0;
  668. const char *const *soundFilesIntro = _staticres->loadStrings(k1AudioTracksIntro, soundFilesIntroSize);
  669. const int32 *cdaTable = (const int32 *)_staticres->loadRawData(k1TownsCDATable, cdaTableSize);
  670. // FIXME: It seems Kyra1 MAC CD includes AdLib and MIDI music and sfx, thus we enable
  671. // support for those for now. (Based on patch #2767489 "Support for Mac Kyrandia 1 CD" by satz).
  672. if (_flags.platform == Common::kPlatformDOS || _flags.platform == Common::kPlatformMacintosh) {
  673. SoundResourceInfo_PC resInfoIntro(soundFilesIntro, soundFilesIntroSize);
  674. SoundResourceInfo_PC resInfoIngame(soundFiles, soundFilesSize);
  675. _sound->initAudioResourceInfo(kMusicIntro, &resInfoIntro);
  676. _sound->initAudioResourceInfo(kMusicIngame, &resInfoIngame);
  677. } else if (_flags.platform == Common::kPlatformFMTowns) {
  678. SoundResourceInfo_Towns resInfoIntro(soundFiles, soundFilesSize, cdaTable, cdaTableSize);
  679. SoundResourceInfo_Towns resInfoIngame(soundFiles, soundFilesSize, cdaTable, cdaTableSize);
  680. _sound->initAudioResourceInfo(kMusicIntro, &resInfoIntro);
  681. _sound->initAudioResourceInfo(kMusicIngame, &resInfoIngame);
  682. } else if (_flags.platform == Common::kPlatformPC98) {
  683. SoundResourceInfo_PC98 resInfoIntro("INTRO%d.DAT");
  684. SoundResourceInfo_PC98 resInfoIngame("KYRAM%d.DAT");
  685. _sound->initAudioResourceInfo(kMusicIntro, &resInfoIntro);
  686. _sound->initAudioResourceInfo(kMusicIngame, &resInfoIngame);
  687. }
  688. }
  689. void KyraEngine_LoK::loadMouseShapes() {
  690. _screen->loadBitmap("MOUSE.CPS", 3, 3, 0);
  691. _screen->_curPage = 2;
  692. _shapes[0] = _screen->encodeShape(0, 0, 8, 10, 0);
  693. _shapes[1] = _screen->encodeShape(0, 0x17, 0x20, 7, 0);
  694. _shapes[2] = _screen->encodeShape(0x50, 0x12, 0x10, 9, 0);
  695. _shapes[3] = _screen->encodeShape(0x60, 0x12, 0x10, 11, 0);
  696. _shapes[4] = _screen->encodeShape(0x70, 0x12, 0x10, 9, 0);
  697. _shapes[5] = _screen->encodeShape(0x80, 0x12, 0x10, 11, 0);
  698. _shapes[6] = _screen->encodeShape(0x90, 0x12, 0x10, 10, 0);
  699. _shapes[360] = _screen->encodeShape(0x28, 0, 0x10, 13, 0);
  700. _screen->setMouseCursor(1, 1, 0);
  701. _screen->setMouseCursor(1, 1, _shapes[0]);
  702. _screen->setShapePages(5, 3);
  703. }
  704. void KyraEngine_LoK::loadCharacterShapes() {
  705. int curImage = 0xFF;
  706. int videoPage = _screen->_curPage;
  707. _screen->_curPage = 2;
  708. for (int i = 0; i < 115; ++i) {
  709. assert(i < _defaultShapeTableSize);
  710. Shape *shape = &_defaultShapeTable[i];
  711. if (shape->imageIndex == 0xFF) {
  712. _shapes[i + 7] = 0;
  713. continue;
  714. }
  715. if (shape->imageIndex != curImage) {
  716. assert(shape->imageIndex < _characterImageTableSize);
  717. _screen->loadBitmap(_characterImageTable[shape->imageIndex], 3, 3, 0);
  718. curImage = shape->imageIndex;
  719. }
  720. _shapes[i + 7] = _screen->encodeShape(shape->x << 3, shape->y, shape->w << 3, shape->h, 1);
  721. }
  722. _screen->_curPage = videoPage;
  723. }
  724. void KyraEngine_LoK::loadSpecialEffectShapes() {
  725. _screen->loadBitmap("EFFECTS.CPS", 3, 3, 0);
  726. _screen->_curPage = 2;
  727. int currShape;
  728. for (currShape = 173; currShape < 183; currShape++)
  729. _shapes[currShape] = _screen->encodeShape((currShape - 173) * 24, 0, 24, 24, 1);
  730. for (currShape = 183; currShape < 190; currShape++)
  731. _shapes[currShape] = _screen->encodeShape((currShape - 183) * 24, 24, 24, 24, 1);
  732. for (currShape = 190; currShape < 201; currShape++)
  733. _shapes[currShape] = _screen->encodeShape((currShape - 190) * 24, 48, 24, 24, 1);
  734. for (currShape = 201; currShape < 206; currShape++)
  735. _shapes[currShape] = _screen->encodeShape((currShape - 201) * 16, 106, 16, 16, 1);
  736. }
  737. void KyraEngine_LoK::loadItems() {
  738. int shape;
  739. _screen->loadBitmap("JEWELS3.CPS", 3, 3, 0);
  740. _screen->_curPage = 2;
  741. _shapes[323] = 0;
  742. for (shape = 1; shape < 6; shape++)
  743. _shapes[323 + shape] = _screen->encodeShape((shape - 1) * 32, 0, 32, 17, 0);
  744. for (shape = 330; shape <= 334; shape++)
  745. _shapes[shape] = _screen->encodeShape((shape - 330) * 32, 102, 32, 17, 0);
  746. for (shape = 335; shape <= 339; shape++)
  747. _shapes[shape] = _screen->encodeShape((shape - 335) * 32, 17, 32, 17, 0);
  748. for (shape = 340; shape <= 344; shape++)
  749. _shapes[shape] = _screen->encodeShape((shape - 340) * 32, 34, 32, 17, 0);
  750. for (shape = 345; shape <= 349; shape++)
  751. _shapes[shape] = _screen->encodeShape((shape - 345) * 32, 51, 32, 17, 0);
  752. for (shape = 350; shape <= 354; shape++)
  753. _shapes[shape] = _screen->encodeShape((shape - 350) * 32, 68, 32, 17, 0);
  754. for (shape = 355; shape <= 359; shape++)
  755. _shapes[shape] = _screen->encodeShape((shape - 355) * 32, 85, 32, 17, 0);
  756. _screen->loadBitmap("ITEMS.CPS", 3, 3, 0);
  757. _screen->_curPage = 2;
  758. for (int i = 0; i < 107; i++) {
  759. shape = findDuplicateItemShape(i);
  760. if (shape != -1)
  761. _shapes[216 + i] = _shapes[216 + shape];
  762. else
  763. _shapes[216 + i] = _screen->encodeShape((i % 20) * 16, i / 20 * 16, 16, 16, 0);
  764. }
  765. _res->loadFileToBuf("_ITEM_HT.DAT", &_itemHtDat, sizeof(_itemHtDat));
  766. }
  767. void KyraEngine_LoK::loadButtonShapes() {
  768. _screen->loadBitmap("BUTTONS2.CPS", 3, 3, 0);
  769. _screen->_curPage = 2;
  770. _gui->_scrollUpButton.data0ShapePtr = _screen->encodeShape(0, 0, 24, 14, 1);
  771. _gui->_scrollUpButton.data1ShapePtr = _screen->encodeShape(24, 0, 24, 14, 1);
  772. _gui->_scrollUpButton.data2ShapePtr = _screen->encodeShape(48, 0, 24, 14, 1);
  773. _gui->_scrollDownButton.data0ShapePtr = _screen->encodeShape(0, 15, 24, 14, 1);
  774. _gui->_scrollDownButton.data1ShapePtr = _screen->encodeShape(24, 15, 24, 14, 1);
  775. _gui->_scrollDownButton.data2ShapePtr = _screen->encodeShape(48, 15, 24, 14, 1);
  776. _screen->_curPage = 0;
  777. }
  778. void KyraEngine_LoK::loadMainScreen(int page) {
  779. _screen->clearPage(page);
  780. if (((_flags.lang == Common::EN_ANY || _flags.lang == Common::RU_RUS) && !_flags.isTalkie && _flags.platform == Common::kPlatformDOS) || _flags.platform == Common::kPlatformAmiga)
  781. _screen->loadBitmap("MAIN15.CPS", page, page, &_screen->getPalette(0));
  782. else if (_flags.lang == Common::EN_ANY || _flags.lang == Common::JA_JPN || (_flags.isTalkie && _flags.lang == Common::IT_ITA))
  783. _screen->loadBitmap("MAIN_ENG.CPS", page, page, 0);
  784. else if (_flags.lang == Common::FR_FRA)
  785. _screen->loadBitmap("MAIN_FRE.CPS", page, page, 0);
  786. else if (_flags.lang == Common::DE_DEU)
  787. _screen->loadBitmap("MAIN_GER.CPS", page, page, 0);
  788. else if (_flags.lang == Common::ES_ESP)
  789. _screen->loadBitmap("MAIN_SPA.CPS", page, page, 0);
  790. else if (_flags.lang == Common::IT_ITA)
  791. _screen->loadBitmap("MAIN_ITA.CPS", page, page, 0);
  792. else
  793. warning("no main graphics file found");
  794. _screen->copyRegion(0, 0, 0, 0, 320, 200, page, 0, Screen::CR_NO_P_CHECK);
  795. if (_flags.platform == Common::kPlatformAmiga) {
  796. _screen->copyPalette(1, 0);
  797. _screen->setInterfacePalette(_screen->getPalette(1), 0x3F, 0x3F, 0x3F);
  798. // TODO: Move this to a better place
  799. _screen->enableInterfacePalette(true);
  800. }
  801. }
  802. void KyraEngine_HoF::initStaticResource() {
  803. _ingamePakList = _staticres->loadStrings(k2IngamePakFiles, _ingamePakListSize);
  804. _ingameSoundList = _staticres->loadStrings(k2IngameSfxFiles, _ingameSoundListSize);
  805. _ingameSoundIndex = (const uint16 *)_staticres->loadRawData(k2IngameSfxIndex, _ingameSoundIndexSize);
  806. _musicFileListIntro = _staticres->loadStrings(k2SeqplayIntroTracks, _musicFileListIntroSize);
  807. _musicFileListIngame = _staticres->loadStrings(k2IngameTracks, _musicFileListIngameSize);
  808. _musicFileListFinale = _staticres->loadStrings(k2SeqplayFinaleTracks, _musicFileListFinaleSize);
  809. _cdaTrackTableIntro = _staticres->loadRawData(k2SeqplayIntroCDA, _cdaTrackTableIntroSize);
  810. _cdaTrackTableIngame = _staticres->loadRawData(k2IngameCDA, _cdaTrackTableIngameSize);
  811. _cdaTrackTableFinale = _staticres->loadRawData(k2SeqplayFinaleCDA, _cdaTrackTableFinaleSize);
  812. _ingameTalkObjIndex = (const uint16 *)_staticres->loadRawData(k2IngameTalkObjIndex, _ingameTalkObjIndexSize);
  813. _ingameTimJpStr = _staticres->loadStrings(k2IngameTimJpStrings, _ingameTimJpStrSize);
  814. _itemAnimDefinition = _staticres->loadItemAnimDefinition(k2IngameShapeAnimData, _itemAnimDefinitionSize);
  815. // assign music data
  816. if (_flags.platform == Common::kPlatformDOS) {
  817. SoundResourceInfo_PC resInfoIntro(_musicFileListIntro, _musicFileListIntroSize);
  818. SoundResourceInfo_PC resInfoIngame(_musicFileListIngame, _musicFileListIngameSize);
  819. SoundResourceInfo_PC resInfoFinale(_musicFileListFinale, _musicFileListFinaleSize);
  820. _sound->initAudioResourceInfo(kMusicIntro, &resInfoIntro);
  821. _sound->initAudioResourceInfo(kMusicIngame, &resInfoIngame);
  822. _sound->initAudioResourceInfo(kMusicFinale, &resInfoFinale);
  823. } else if (_flags.platform == Common::kPlatformFMTowns) {
  824. SoundResourceInfo_TownsPC98V2 resInfoIntro(0, 0, "intro%d.twn", (const uint16*)_cdaTrackTableIntro, _cdaTrackTableIntroSize >> 1);
  825. SoundResourceInfo_TownsPC98V2 resInfoIngame(0, 0, "km%02d.twn", (const uint16*)_cdaTrackTableIngame, _cdaTrackTableIngameSize >> 1);
  826. SoundResourceInfo_TownsPC98V2 resInfoFinale(0, 0, "finale%d.twn", (const uint16*)_cdaTrackTableFinale, _cdaTrackTableFinaleSize >> 1);
  827. _sound->initAudioResourceInfo(kMusicIntro, &resInfoIntro);
  828. _sound->initAudioResourceInfo(kMusicIngame, &resInfoIngame);
  829. _sound->initAudioResourceInfo(kMusicFinale, &resInfoFinale);
  830. } else if (_flags.platform == Common::kPlatformPC98) {
  831. SoundResourceInfo_TownsPC98V2 resInfoIntro(0, 0, "intro%d.86", 0, 0);
  832. SoundResourceInfo_TownsPC98V2 resInfoIngame(0, 0, "km%02d.86", 0, 0);
  833. SoundResourceInfo_TownsPC98V2 resInfoFinale(0, 0, "finale%d.86", 0, 0);
  834. _sound->initAudioResourceInfo(kMusicIntro, &resInfoIntro);
  835. _sound->initAudioResourceInfo(kMusicIngame, &resInfoIngame);
  836. _sound->initAudioResourceInfo(kMusicFinale, &resInfoFinale);
  837. }
  838. }
  839. void KyraEngine_MR::initStaticResource() {
  840. int tmp = 0;
  841. _mainMenuStrings = _staticres->loadStrings(k3MainMenuStrings, _mainMenuStringsSize);
  842. _soundList = _staticres->loadStrings(k3MusicFiles, _soundListSize);
  843. _scoreTable = _staticres->loadRawData(k3ScoreTable, _scoreTableSize);
  844. _sfxFileList = _staticres->loadStrings(k3SfxFiles, _sfxFileListSize);
  845. _sfxFileMap = _staticres->loadRawData(k3SfxMap, _sfxFileMapSize);
  846. _itemAnimDefinition = _staticres->loadItemAnimDefinition(k3ItemAnimData, tmp);
  847. _itemMagicTable = _staticres->loadRawData(k3ItemMagicTable, tmp);
  848. _itemStringMap = _staticres->loadRawData(k3ItemStringMap, _itemStringMapSize);
  849. }
  850. const uint8 Screen_LoK_16::_palette16[48] = {
  851. 0x00, 0x00, 0x00, 0x02, 0x07, 0x0B, 0x0C, 0x06, 0x04,
  852. 0x0E, 0x09, 0x07, 0x00, 0x06, 0x03, 0x00, 0x0C, 0x07,
  853. 0x0A, 0x0A, 0x0A, 0x08, 0x03, 0x03, 0x02, 0x02, 0x02,
  854. 0x08, 0x0B, 0x0E, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x0A,
  855. 0x05, 0x05, 0x05, 0x00, 0x0F, 0x0F, 0x0F, 0x0D, 0x00,
  856. 0x0F, 0x0F, 0x0F
  857. };
  858. const ScreenDim Screen_LoK::_screenDimTable[] = {
  859. { 0x00, 0x00, 0x28, 0xC8, 0x0F, 0x0C, 0x00, 0x00 },
  860. { 0x08, 0x48, 0x18, 0x38, 0x0F, 0x0C, 0x00, 0x00 },
  861. { 0x01, 0x08, 0x26, 0x80, 0x0F, 0x0C, 0x00, 0x00 },
  862. { 0x00, 0xC2, 0x28, 0x06, 0x0F, 0x0C, 0x00, 0x00 },
  863. { 0x00, 0x90, 0x28, 0x38, 0x04, 0x0C, 0x00, 0x00 },
  864. { 0x01, 0x94, 0x26, 0x30, 0x04, 0x1B, 0x00, 0x00 },
  865. { 0x00, 0x90, 0x28, 0x38, 0x0F, 0x0D, 0x00, 0x00 },
  866. { 0x01, 0x96, 0x26, 0x32, 0x0F, 0x0D, 0x00, 0x00 },
  867. { 0x00, 0x00, 0x28, 0x88, 0x0F, 0x0C, 0x00, 0x00 },
  868. { 0x01, 0x20, 0x26, 0x80, 0x0F, 0x0C, 0x00, 0x00 },
  869. { 0x03, 0x28, 0x22, 0x46, 0x0F, 0x0D, 0x00, 0x00 }
  870. };
  871. const int Screen_LoK::_screenDimTableCount = ARRAYSIZE(Screen_LoK::_screenDimTable);
  872. const ScreenDim Screen_HoF::_screenDimTable[] = {
  873. { 0x00, 0x00, 0x28, 0xC8, 0xC7, 0xCF, 0x00, 0x00 },
  874. { 0x08, 0x48, 0x18, 0x38, 0xC7, 0xCF, 0x00, 0x00 },
  875. { 0x00, 0x00, 0x28, 0x90, 0xC7, 0xCF, 0x00, 0x00 },
  876. { 0x00, 0xC2, 0x28, 0x06, 0xC7, 0xCF, 0x00, 0x00 },
  877. { 0x00, 0x90, 0x28, 0x38, 0x96, 0xCF, 0x00, 0x00 },
  878. { 0x01, 0x94, 0x26, 0x30, 0x96, 0x1B, 0x00, 0x00 },
  879. { 0x00, 0x90, 0x28, 0x38, 0xC7, 0xCC, 0x00, 0x00 },
  880. { 0x01, 0x96, 0x26, 0x32, 0xC7, 0xCC, 0x00, 0x00 },
  881. { 0x00, 0x00, 0x28, 0x88, 0xC7, 0xCF, 0x00, 0x00 },
  882. { 0x00, 0x08, 0x28, 0xB8, 0xC7, 0xCF, 0x00, 0x00 },
  883. { 0x01, 0x28, 0x26, 0x46, 0xC7, 0xCC, 0x00, 0x00 },
  884. { 0x0A, 0x96, 0x14, 0x30, 0x19, 0xF0, 0x00, 0x00 } // menu, just present for current menu code
  885. };
  886. const int Screen_HoF::_screenDimTableCount = ARRAYSIZE(Screen_HoF::_screenDimTable);
  887. const ScreenDim Screen_MR::_screenDimTable[] = {
  888. { 0x00, 0x00, 0x28, 0xC8, 0xFF, 0xF0, 0x00, 0x00 },
  889. { 0x08, 0x48, 0x18, 0x38, 0xFF, 0xF0, 0x00, 0x00 },
  890. { 0x00, 0x00, 0x28, 0xBC, 0xFF, 0xF0, 0x00, 0x00 },
  891. { 0x0A, 0x96, 0x14, 0x30, 0x19, 0xF0, 0x00, 0x00 }
  892. };
  893. const int Screen_MR::_screenDimTableCount = ARRAYSIZE(Screen_MR::_screenDimTable);
  894. const int8 KyraEngine_v1::_addXPosTable[] = {
  895. 4, 4, 0, -4, -4, -4, 0, 4
  896. };
  897. const int8 KyraEngine_v1::_addYPosTable[] = {
  898. 0, -2, -2, -2, 0, 2, 2, 2
  899. };
  900. const int8 KyraEngine_v1::_charAddXPosTable[] = {
  901. 0, 4, 4, 4, 0, -4, -4, -4
  902. };
  903. const int8 KyraEngine_v1::_charAddYPosTable[] = {
  904. -2, -2, 0, 2, 2, 2, 0, -2
  905. };
  906. const uint16 KyraEngine_LoK::_itemPosX[] = {
  907. 95, 115, 135, 155, 175, 95, 115, 135, 155, 175
  908. };
  909. const uint8 KyraEngine_LoK::_itemPosY[] = {
  910. 160, 160, 160, 160, 160, 181, 181, 181, 181, 181
  911. };
  912. void GUI_LoK::initStaticResource() {
  913. GUI_V1_BUTTON(_scrollUpButton, 0x12, 1, 1, 1, 0x483, 0, 0, 0, 0x18, 0x0F, 0);
  914. GUI_V1_BUTTON(_scrollDownButton, 0x13, 1, 1, 1, 0x483, 0, 0, 0, 0x18, 0x0F, 0);
  915. GUI_V1_BUTTON(_menuButtonData[0], 0x0C, 1, 1, 1, 0x487, 0, 0, 0, 0, 0, 0);
  916. GUI_V1_BUTTON(_menuButtonData[1], 0x0D, 1, 1, 1, 0x487, 0, 0, 0, 0, 0, 0);
  917. GUI_V1_BUTTON(_menuButtonData[2], 0x0E, 1, 1, 1, 0x487, 0, 0, 0, 0, 0, 0);
  918. GUI_V1_BUTTON(_menuButtonData[3], 0x0F, 1, 1, 1, 0x487, 0, 0, 0, 0, 0, 0);
  919. GUI_V1_BUTTON(_menuButtonData[4], 0x10, 1, 1, 1, 0x487, 0, 0, 0, 0, 0, 0);
  920. GUI_V1_BUTTON(_menuButtonData[5], 0x11, 1, 1, 1, 0x487, 0, 0, 0, 0, 0, 0);
  921. delete[] _menu;
  922. _menu = new Menu[6];
  923. assert(_menu);
  924. Button::Callback quitPlayingFunctor = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::quitPlaying);
  925. Button::Callback loadGameMenuFunctor = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::loadGameMenu);
  926. Button::Callback cancelSubMenuFunctor = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::cancelSubMenu);
  927. GUI_V1_MENU(_menu[0], -1, -1, 0x100, 0x8B, 248, 249, 250, 0, 251, -1, 8, 0, 5, -1, -1, -1, -1);
  928. GUI_V1_MENU_ITEM(_menu[0].item[0], 1, 0, 0, 0, -1, -1, 0x1E, 0xDC, 0x0F, 252, 253, -1, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0);
  929. GUI_V1_MENU_ITEM(_menu[0].item[1], 1, 0, 0, 0, -1, -1, 0x2F, 0xDC, 0x0F, 252, 253, -1, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0);
  930. GUI_V1_MENU_ITEM(_menu[0].item[2], 1, 0, 0, 0, -1, -1, 0x40, 0xDC, 0x0F, 252, 253, -1, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0);
  931. GUI_V1_MENU_ITEM(_menu[0].item[3], 1, 0, 0, 0, -1, -1, 0x51, 0xDC, 0x0F, 252, 253, -1, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0);
  932. GUI_V1_MENU_ITEM(_menu[0].item[4], 1, 0, 0, 0, -1, 0, 0x6E, 0xDC, 0x0F, 252, 253, -1, 255, 248, 249, 250, -1, 0, 0, 0, 0, 0);
  933. _menu[0].item[0].callback = loadGameMenuFunctor;
  934. _menu[0].item[1].callback = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::saveGameMenu);
  935. _menu[0].item[2].callback = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::gameControlsMenu);
  936. _menu[0].item[3].callback = quitPlayingFunctor;
  937. _menu[0].item[4].callback = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::resumeGame);
  938. GUI_V1_MENU(_menu[1], -1, -1, 0x140, 0x38, 248, 249, 250, 0, 254, -1, 8, 0, 2, -1, -1, -1, -1);
  939. GUI_V1_MENU_ITEM(_menu[1].item[0], 1, 0, 0, 0, 0x18, 0, 0x1E, 0x48, 0x0F, 252, 253, -1, 255, 248, 249, 250, -1, 0, 0, 0, 0, 0);
  940. GUI_V1_MENU_ITEM(_menu[1].item[1], 1, 0, 0, 0, 0xD8, 0, 0x1E, 0x48, 0x0F, 252, 253, -1, 255, 248, 249, 250, -1, 0, 0, 0, 0, 0);
  941. _menu[1].item[0].callback = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::quitConfirmYes);
  942. _menu[1].item[1].callback = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::quitConfirmNo);
  943. GUI_V1_MENU(_menu[2], -1, -1, 0x120, 0xA0, 248, 249, 250, 0, 251, -1, 8, 0, 6, 132, 22, 132, 124);
  944. GUI_V1_MENU_ITEM(_menu[2].item[0], 1, 0, 0, 0, -1, 255, 0x27, 0x100, 0x0F, 252, 253, 5, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0);
  945. GUI_V1_MENU_ITEM(_menu[2].item[1], 1, 0, 0, 0, -1, 255, 0x38, 0x100, 0x0F, 252, 253, 5, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0);
  946. GUI_V1_MENU_ITEM(_menu[2].item[2], 1, 0, 0, 0, -1, 255, 0x49, 0x100, 0x0F, 252, 253, 5, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0);
  947. GUI_V1_MENU_ITEM(_menu[2].item[3], 1, 0, 0, 0, -1, 255, 0x5A, 0x100, 0x0F, 252, 253, 5, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0);
  948. GUI_V1_MENU_ITEM(_menu[2].item[4], 1, 0, 0, 0, -1, 255, 0x6B, 0x100, 0x0F, 252, 253, 5, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0);
  949. GUI_V1_MENU_ITEM(_menu[2].item[5], 1, 0, 0, 0, 0xB8, 0, 0x86, 0x58, 0x0F, 252, 253, -1, 255, 248, 249, 250, -1, 0, 0, 0, 0, 0);
  950. _menu[2].item[5].callback = cancelSubMenuFunctor;
  951. GUI_V1_MENU(_menu[3], -1, -1, 288, 67, 248, 249, 250, 0, 251, -1, 8, 0, 2, -1, -1, -1, -1);
  952. GUI_V1_MENU_ITEM(_menu[3].item[0], 1, 0, 0, 0, 24, 0, 44, 85, 15, 252, 253, -1, 255, 248, 249, 250, -1, 0, 0, 0, 0, 0);
  953. GUI_V1_MENU_ITEM(_menu[3].item[1], 1, 0, 0, 0, 179, 0, 44, 85, 15, 252, 253, -1, 255, 248, 249, 250, -1, 0, 0, 0, 0, 0);
  954. _menu[3].item[0].callback = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::savegameConfirm);
  955. _menu[3].item[1].callback = cancelSubMenuFunctor;
  956. GUI_V1_MENU(_menu[4], -1, -1, 0xD0, 0x4C, 248, 249, 250, 0, 251, -1, 8, 0, 2, -1, -1, -1, -1);
  957. GUI_V1_MENU_ITEM(_menu[4].item[0], 1, 0, 0, 0, -1, -1, 0x1E, 0xB4, 0x0F, 252, 253, -1, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0);
  958. GUI_V1_MENU_ITEM(_menu[4].item[1], 1, 0, 0, 0, -1, -1, 0x2F, 0xB4, 0x0F, 252, 253, -1, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0);
  959. _menu[4].item[0].callback = loadGameMenuFunctor;
  960. _menu[4].item[1].callback = quitPlayingFunctor;
  961. GUI_V1_MENU(_menu[5], -1, -1, 0x130, 0x99, 248, 249, 250, 0, 251, -1, 8, 0, 6, -1, -1, -1, -1);
  962. GUI_V1_MENU_ITEM(_menu[5].item[0], 1, 0, 0, 0, 0xA5, 0, 0x1E, 0x80, 0x0F, 252, 253, 5, 0, 248, 249, 250, -1, 0, 0x10, 0x20, 0, 0);
  963. GUI_V1_MENU_ITEM(_menu[5].item[1], 1, 0, 0, 0, 0xA5, 0, 0x2F, 0x80, 0x0F, 252, 253, 5, 0, 248, 249, 250, -1, 0, 0x10, 0x31, 0, 0);
  964. GUI_V1_MENU_ITEM(_menu[5].item[2], 1, 0, 0, 0, 0xA5, 0, 0x40, 0x80, 0x0F, 252, 253, 5, 0, 248, 249, 250, -1, 0, 0x10, 0x42, 0, 0);
  965. GUI_V1_MENU_ITEM(_menu[5].item[3], 1, 0, 0, 0, 0xA5, 0, 0x51, 0x80, 0x0F, 252, 253, 5, 0, 248, 249, 250, -1, 0, 0x10, 0x53, 0, 0);
  966. GUI_V1_MENU_ITEM(_menu[5].item[4], 1, 0, 0, 0, 0xA5, 0, 0x62, 0x80, 0x0F, 252, 253, 5, 0, 248, 249, 250, -1, 0, 0x10, 0x65, 0, 0);
  967. GUI_V1_MENU_ITEM(_menu[5].item[5], 1, 0, 0, 0, -1, 0, 0x7F, 0x6C, 0x0F, 252, 253, -1, 255, 248, 249, 250, -1, 0, 0, 0, 0, 0);
  968. _menu[5].item[0].callback = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::controlsChangeMusic);
  969. _menu[5].item[1].callback = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::controlsChangeSounds);
  970. _menu[5].item[2].callback = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::controlsChangeWalk);
  971. _menu[5].item[4].callback = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::controlsChangeText);
  972. _menu[5].item[5].callback = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::controlsApply);
  973. // The AMIGA version uses different colors, due to its 32 color nature. We did setup the 256 color version
  974. // colors above, so we need to overwrite those with the correct values over here.
  975. if (_vm->gameFlags().platform == Common::kPlatformAmiga) {
  976. for (int i = 0; i < 6; ++i) {
  977. _menu[i].bkgdColor = 17;
  978. _menu[i].color1 = 31;
  979. _menu[i].color2 = 18;
  980. for (int j = 0; j < _menu[i].numberOfItems; ++j) {
  981. _menu[i].item[j].bkgdColor = 17;
  982. _menu[i].item[j].color1 = 31;
  983. _menu[i].item[j].color2 = 18;
  984. }
  985. }
  986. }
  987. }
  988. void KyraEngine_LoK::setupButtonData() {
  989. delete[] _buttonData;
  990. delete[] _buttonDataListPtr;
  991. _buttonData = new Button[15];
  992. assert(_buttonData);
  993. _buttonDataListPtr = new Button *[15];
  994. assert(_buttonDataListPtr);
  995. GUI_V1_BUTTON(_buttonData[1], 0x01, 1, 1, 1, 0x0487, 0, 0x009, 0xA4, 0x36, 0x1E, 0);
  996. _buttonData[1].buttonCallback = BUTTON_FUNCTOR(GUI_LoK, _gui, &GUI_LoK::buttonMenuCallback);
  997. Button::Callback inventoryFunctor = BUTTON_FUNCTOR(KyraEngine_LoK, this, &KyraEngine_LoK::buttonInventoryCallback);
  998. for (int i = 2; i <= 10; ++i)
  999. _buttonData[i].buttonCallback = inventoryFunctor;
  1000. _buttonData[0].buttonCallback = inventoryFunctor;
  1001. GUI_V1_BUTTON(_buttonData[0], 0x02, 0, 0, 0, 0x0400, 0, 0x05D, 0x9E, 0x13, 0x13, 0);
  1002. GUI_V1_BUTTON(_buttonData[2], 0x03, 0, 0, 0, 0x0400, 0, 0x071, 0x9E, 0x13, 0x14, 0);
  1003. GUI_V1_BUTTON(_buttonData[3], 0x04, 0, 0, 0, 0x0400, 0, 0x085, 0x9E, 0x13, 0x14, 0);
  1004. GUI_V1_BUTTON(_buttonData[4], 0x05, 0, 0, 0, 0x0400, 0, 0x099, 0x9E, 0x13, 0x14, 0);
  1005. GUI_V1_BUTTON(_buttonData[5], 0x06, 0, 0, 0, 0x0400, 0, 0x0AD, 0x9E, 0x13, 0x14, 0);
  1006. GUI_V1_BUTTON(_buttonData[6], 0x07, 0, 0, 0, 0x0400, 0, 0x05D, 0xB3, 0x13, 0x14, 0);
  1007. GUI_V1_BUTTON(_buttonData[7], 0x08, 0, 0, 0, 0x0400, 0, 0x071, 0xB3, 0x13, 0x14, 0);
  1008. GUI_V1_BUTTON(_buttonData[8], 0x09, 0, 0, 0, 0x0400, 0, 0x085, 0xB3, 0x13, 0x14, 0);
  1009. GUI_V1_BUTTON(_buttonData[9], 0x0A, 0, 0, 0, 0x0400, 0, 0x099, 0xB3, 0x13, 0x14, 0);
  1010. GUI_V1_BUTTON(_buttonData[10], 0x0B, 0, 0, 0, 0x0400, 0, 0x0AD, 0xB3, 0x13, 0x14, 0);
  1011. Button::Callback amuletFunctor = BUTTON_FUNCTOR(KyraEngine_LoK, this, &KyraEngine_LoK::buttonAmuletCallback);
  1012. GUI_V1_BUTTON(_buttonData[11], 0x15, 1, 1, 1, 0x0487, 0, 0x0FD, 0x9C, 0x1A, 0x12, 0);
  1013. GUI_V1_BUTTON(_buttonData[12], 0x16, 1, 1, 1, 0x0487, 0, 0x0E7, 0xAA, 0x1A, 0x12, 0);
  1014. GUI_V1_BUTTON(_buttonData[13], 0x17, 1, 1, 1, 0x0487, 0, 0x0FD, 0xB5, 0x1A, 0x12, 0);
  1015. GUI_V1_BUTTON(_buttonData[14], 0x18, 1, 1, 1, 0x0487, 0, 0x113, 0xAA, 0x1A, 0x12, 0);
  1016. for (int i = 11; i <= 14; ++i)
  1017. _buttonData[i].buttonCallback = amuletFunctor;
  1018. for (int i = 1; i < 15; ++i)
  1019. _buttonDataListPtr[i - 1] = &_buttonData[i];
  1020. _buttonDataListPtr[14] = 0;
  1021. }
  1022. const uint8 KyraEngine_LoK::_magicMouseItemStartFrame[] = {
  1023. 0xAD, 0xB7, 0xBE, 0x00
  1024. };
  1025. const uint8 KyraEngine_LoK::_magicMouseItemEndFrame[] = {
  1026. 0xB1, 0xB9, 0xC2, 0x00
  1027. };
  1028. const uint8 KyraEngine_LoK::_magicMouseItemStartFrame2[] = {
  1029. 0xB2, 0xBA, 0xC3, 0x00
  1030. };
  1031. const uint8 KyraEngine_LoK::_magicMouseItemEndFrame2[] = {
  1032. 0xB6, 0xBD, 0xC8, 0x00
  1033. };
  1034. const uint16 KyraEngine_LoK::_amuletX[] = { 231, 275, 253, 253 };
  1035. const uint16 KyraEngine_LoK::_amuletY[] = { 170, 170, 159, 181 };
  1036. const uint16 KyraEngine_LoK::_amuletX2[] = { 0x000, 0x0FD, 0x0E7, 0x0FD, 0x113, 0x000 };
  1037. const uint16 KyraEngine_LoK::_amuletY2[] = { 0x000, 0x09F, 0x0AA, 0x0B5, 0x0AA, 0x000 };
  1038. const int8 KyraEngine_LoK::_dosTrackMap[] = {
  1039. -1, 0, -1, 1, 0, 3, 0, 2,
  1040. 0, 4, 1, 2, 1, 3, 1, 4,
  1041. 1, 92, 1, 6, 1, 7, 2, 2,
  1042. 2, 3, 2, 4, 2, 5, 2, 6,
  1043. 2, 7, 3, 3, 3, 4, 1, 8,
  1044. 1, 9, 4, 2, 4, 3, 4, 4,
  1045. 4, 5, 4, 6, 4, 7, 4, 8,
  1046. 1, 11, 1, 12, 1, 14, 1, 13,
  1047. 4, 9, 5, 12, 6, 2, 6, 6,
  1048. 6, 7, 6, 8, 6, 9, 6, 3,
  1049. 6, 4, 6, 5, 7, 2, 7, 3,
  1050. 7, 4, 7, 5, 7, 6, 7, 7,
  1051. 7, 8, 7, 9, 8, 2, 8, 3,
  1052. 8, 4, 8, 5, 6, 11, 5, 11
  1053. };
  1054. const int KyraEngine_LoK::_dosTrackMapSize = ARRAYSIZE(KyraEngine_LoK::_dosTrackMap);
  1055. const int8 KyraEngine_LoK::_amigaTrackMap[] = {
  1056. 0, 1, 32, 26, 31, 30, 33, 33,
  1057. 32, 17, 27, 32, 25, 29, 25, 24,
  1058. 23, 26, 26, 30, 28, 21, 21, 15,
  1059. 3, 15, 23, 25, 33, 21, 30, 22,
  1060. 15, 3, 33, 11, 12, 13, 14, 22,
  1061. 22, 22, 3, 3, 3, 23, 3, 3,
  1062. 23, 3, 3, 3, 3, 3, 3, 33
  1063. };
  1064. const int KyraEngine_LoK::_amigaTrackMapSize = ARRAYSIZE(KyraEngine_LoK::_amigaTrackMap);
  1065. // kyra engine v2 static data
  1066. const int GUI_v2::_sliderBarsPosition[] = {
  1067. 0x92, 0x1F, 0x92, 0x30, 0x92, 0x41, 0x92, 0x52
  1068. };
  1069. // kyra 2 static res
  1070. const char *const KyraEngine_HoF::_languageExtension[] = {
  1071. "ENG",
  1072. "FRE",
  1073. "GER",/*,
  1074. "ITA", Italian and Spanish were never included
  1075. "SPA"*/
  1076. "JPN",
  1077. };
  1078. const char *const KyraEngine_HoF::_scriptLangExt[] = {
  1079. "EMC",
  1080. "FMC",
  1081. "GMC",/*,
  1082. "IMC", Italian and Spanish were never included
  1083. "SMC"*/
  1084. "JMC"
  1085. };
  1086. const uint8 KyraEngine_HoF::_characterFrameTable[] = {
  1087. 0x19, 0x09, 0x09, 0x12, 0x12, 0x12, 0x09, 0x09
  1088. };
  1089. const int KyraEngine_HoF::_inventoryX[] = {
  1090. 0x4F, 0x63, 0x77, 0x8B, 0x9F, 0x4F, 0x63, 0x77, 0x8B, 0x9F
  1091. };
  1092. const int KyraEngine_HoF::_inventoryY[] = {
  1093. 0x95, 0x95, 0x95, 0x95, 0x95, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA
  1094. };
  1095. const byte KyraEngine_HoF::_itemStringMap[] = {
  1096. 2, 2, 0, 0, 2, 2, 2, 0,
  1097. 2, 2, 0, 0, 0, 2, 0, 0,
  1098. 0, 0, 0, 0, 2, 0, 0, 0,
  1099. 0, 1, 0, 2, 2, 2, 2, 0,
  1100. 3, 0, 3, 2, 2, 2, 3, 2,
  1101. 2, 2, 0, 0, 0, 0, 0, 0,
  1102. 0, 0, 0, 0, 2, 0, 0, 0,
  1103. 0, 0, 0, 0, 0, 2, 0, 0,
  1104. 2, 0, 0, 0, 0, 0, 0, 2,
  1105. 2, 0, 0, 0, 2, 2, 2, 2,
  1106. 2, 2, 2, 2, 2, 2, 2, 2,
  1107. 2, 2, 2, 2, 2, 2, 2, 0,
  1108. 2, 2, 2, 0, 0, 1, 3, 2,
  1109. 2, 2, 2, 2, 2, 0, 0, 0,
  1110. 0, 2, 2, 1, 0, 1, 2, 0,
  1111. 0, 0, 0, 0, 0, 2, 2, 2,
  1112. 2, 2, 2, 2, 0, 2, 2, 2,
  1113. 2, 3, 2, 0, 0, 0, 0, 1,
  1114. 2, 0, 0, 0, 0, 0, 0, 0,
  1115. 0, 0, 0, 0, 0, 0, 0, 0,
  1116. 2, 2, 0, 0, 0, 0, 0, 2,
  1117. 0, 2, 0, 0, 0, 0, 0, 0
  1118. };
  1119. const int KyraEngine_HoF::_itemStringMapSize = ARRAYSIZE(KyraEngine_HoF::_itemStringMap);
  1120. const int8 KyraEngine_HoF::_dosTrackMap[] = {
  1121. -1, 0, -1, 1, 9, 6, 5, 4,
  1122. 8, 3, -2, 0, -2, 0, 2, 3,
  1123. -2, 0, -2, 0, -2, 0, -2, 0,
  1124. 0, 2, 0, 3, 1, 2, 1, 3,
  1125. 2, 2, 2, 0, 3, 2, 3, 3,
  1126. 3, 4, 4, 2, 5, 2, 5, 3,
  1127. 5, 4, 6, 2, 6, 3, 6, 4,
  1128. 6, 5, 6, 6, 6, 7, 6, 8,
  1129. 6, 0, 6, 9, 7, 2, 7, 3,
  1130. 7, 4, 7, 5, 8, 6, 7, 6,
  1131. 7, 7, 7, 8, 7, 9, 8, 2,
  1132. 14, 2, 8, 4, 8, 7, 8,

Large files files are truncated, but you can click here to view the full file