[Scummvm-cvs-logs] SF.net SVN: scummvm: [32058] scummvm/trunk

athrxx at users.sourceforge.net athrxx at users.sourceforge.net
Mon May 12 15:35:59 CEST 2008


Revision: 32058
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32058&view=rev
Author:   athrxx
Date:     2008-05-12 06:35:58 -0700 (Mon, 12 May 2008)

Log Message:
-----------
move some kyra 3 static resources to kyra.dat

Modified Paths:
--------------
    scummvm/trunk/dists/engine-data/kyra.dat
    scummvm/trunk/engines/kyra/kyra_mr.cpp
    scummvm/trunk/engines/kyra/kyra_mr.h
    scummvm/trunk/engines/kyra/resource.cpp
    scummvm/trunk/engines/kyra/resource.h
    scummvm/trunk/engines/kyra/sequences_hof.cpp
    scummvm/trunk/engines/kyra/staticres.cpp
    scummvm/trunk/tools/create_kyradat/create_kyradat.cpp
    scummvm/trunk/tools/create_kyradat/create_kyradat.h
    scummvm/trunk/tools/create_kyradat/misc.h

Added Paths:
-----------
    scummvm/trunk/tools/create_kyradat/malcolm.h

Modified: scummvm/trunk/dists/engine-data/kyra.dat
===================================================================
(Binary files differ)

Modified: scummvm/trunk/engines/kyra/kyra_mr.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_mr.cpp	2008-05-12 13:19:11 UTC (rev 32057)
+++ scummvm/trunk/engines/kyra/kyra_mr.cpp	2008-05-12 13:35:58 UTC (rev 32058)
@@ -206,6 +206,7 @@
 	_screen->setResolution();
 
 	KyraEngine_v1::init();
+	initStaticResource();
 	
 	_debugger = new Debugger_v2(this);
 	assert(_debugger);
@@ -420,7 +421,9 @@
 	if (_musicSoundChannel == -1) {
 		assert(track < _soundListSize && track >= 0);
 
-		_musicSoundChannel = _soundDigital->playSound(_soundList[track], 0xFF, Audio::Mixer::kMusicSoundType);
+		char file[13];
+		sprintf(file, "%s.AUD", _soundList[track]);
+		_musicSoundChannel = _soundDigital->playSound(file, 0xFF, Audio::Mixer::kMusicSoundType);
 	}
 
 	_lastMusicCommand = track;

Modified: scummvm/trunk/engines/kyra/kyra_mr.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_mr.h	2008-05-12 13:19:11 UTC (rev 32057)
+++ scummvm/trunk/engines/kyra/kyra_mr.h	2008-05-12 13:35:58 UTC (rev 32058)
@@ -73,6 +73,8 @@
 	void writeSettings();
 	void readSettings();
 
+	void initStaticResource();
+
 	// --
 	Screen_MR *_screen;
 	SoundDigital *_soundDigital;
@@ -108,8 +110,8 @@
 	int _fadeOutMusicChannel;
 	const char *_menuAudioFile;
 
-	static const char *_soundList[];
-	static const int _soundListSize;
+	const char *const *_soundList;
+	int _soundListSize;
 
 	void snd_playWanderScoreViaMap(int track, int force);
 	void stopMusicTrack();
@@ -119,10 +121,10 @@
 
 	void snd_playSoundEffect(int item, int volume);
 
-	static const uint8 _sfxFileMap[];
-	static const int _sfxFileMapSize;
-	static const char *_sfxFileList[];
-	static const int _sfxFileListSize;
+	const uint8 *_sfxFileMap;
+	int _sfxFileMapSize;
+	const char *const *_sfxFileList;
+	int _sfxFileListSize;
 
 	int _voiceSoundChannel;
 
@@ -177,7 +179,8 @@
 
 private:
 	// main menu
-	static const char *_mainMenuStrings[];
+	const char *const *_mainMenuStrings;
+	int _mainMenuStringsSize;
 
 	// animator
 	uint8 *_gamePlayBuffer;
@@ -210,17 +213,7 @@
 	bool _nextIdleType;
 	void showIdleAnim();
 
-	static const FrameControl _itemAnimFrames0[];
-	static const FrameControl _itemAnimFrames1[];
-	static const FrameControl _itemAnimFrames2[];
-	static const FrameControl _itemAnimFrames3[];
-	static const FrameControl _itemAnimFrames4[];
-	static const FrameControl _itemAnimFrames5[];
-	static const FrameControl _itemAnimFrames6[];
-	static const FrameControl _itemAnimFrames7[];
-	static const FrameControl _itemAnimFrames8[];
-	static const FrameControl _itemAnimFrames9[];
-	static const ItemAnimData_v2 _itemAnimData[10];
+	const ItemAnimData_v2 *_itemAnimData;
 	ActiveItemAnim _activeItemAnim[10];
 	int _nextAnimItem;
 
@@ -297,12 +290,12 @@
 
 	bool isDropable(int x, int y);
 
-	static const uint8 _itemMagicTable[];
+	const uint8 *_itemMagicTable;
 	bool itemListMagic(int handItem, int itemSlot);
 	bool itemInventoryMagic(int handItem, int invSlot);
 
-	static const uint8 _itemStringMap[];
-	static const uint _itemStringMapSize;
+	const uint8 *_itemStringMap;
+	int _itemStringMapSize;
 	static const uint8 _itemStringPickUp[];
 	static const uint8 _itemStringDrop[];
 	static const uint8 _itemStringInv[];
@@ -523,8 +516,9 @@
 	int _score;
 	int _scoreMax;
 	
-	static const int8 _scoreTable[];
-	static const int _scoreTableSize;
+	const uint8 *_scoreTable;
+	int _scoreTableSize;
+
 	int8 _scoreFlagTable[26];
 	bool updateScore(int scoreId, int strId);
 	void scoreIncrease(int count, const char *str);

Modified: scummvm/trunk/engines/kyra/resource.cpp
===================================================================
--- scummvm/trunk/engines/kyra/resource.cpp	2008-05-12 13:19:11 UTC (rev 32057)
+++ scummvm/trunk/engines/kyra/resource.cpp	2008-05-12 13:35:58 UTC (rev 32058)
@@ -53,13 +53,11 @@
 	if (!dir.exists() || !dir.isDirectory())
 		error("invalid game path '%s'", dir.getPath().c_str());
 
-	if (_vm->game() != GI_KYRA3) {
-		if (!loadPakFile(StaticResource::staticDataFilename()) || !StaticResource::checkKyraDat()) {
-			Common::String errorMessage = "You're missing the '" + StaticResource::staticDataFilename() + "' file or it got corrupted, (re)get it from the ScummVM website";
-			::GUI::MessageDialog errorMsg(errorMessage);
-			errorMsg.runModal();
-			error(errorMessage.c_str());
-		}
+	if (!loadPakFile(StaticResource::staticDataFilename()) || !StaticResource::checkKyraDat()) {
+		Common::String errorMessage = "You're missing the '" + StaticResource::staticDataFilename() + "' file or it got corrupted, (re)get it from the ScummVM website";
+		::GUI::MessageDialog errorMsg(errorMessage);
+		errorMsg.runModal();
+		error(errorMessage.c_str());
 	}
 
 	if (_vm->game() == GI_KYRA1) {

Modified: scummvm/trunk/engines/kyra/resource.h
===================================================================
--- scummvm/trunk/engines/kyra/resource.h	2008-05-12 13:19:11 UTC (rev 32057)
+++ scummvm/trunk/engines/kyra/resource.h	2008-05-12 13:35:58 UTC (rev 32058)
@@ -229,6 +229,15 @@
 	k2IngameShapeAnimData,
 	k2IngameTlkDemoStrings,
 
+	k3MainMenuStrings,
+	k3MusicFiles,
+	k3ScoreTable,
+	k3SfxFiles,
+	k3SfxMap,
+	k3ItemAnimData,
+	k3ItemMagicTable,
+	k3ItemStringMap,
+
 	kMaxResIDs
 };
 
@@ -253,8 +262,8 @@
 	const Room *loadRoomTable(int id, int &entries);
 	const uint8 * const*loadPaletteTable(int id, int &entries);
 	const HofSeqData *loadHofSequenceData(int id, int &entries);
-	const ItemAnimData_v1 *loadHofShapeAnimDataV1(int id, int &entries);
-	const ItemAnimData_v2 *loadHofShapeAnimDataV2(int id, int &entries);
+	const ItemAnimData_v1 *loadShapeAnimData_v1(int id, int &entries);
+	const ItemAnimData_v2 *loadShapeAnimData_v2(int id, int &entries);
 
 	// use '-1' to prefetch/unload all ids
 	// prefetchId retruns false if only on of the resources
@@ -284,8 +293,8 @@
 	bool loadRoomTable(const char *filename, void *&ptr, int &size);
 	bool loadPaletteTable(const char *filename, void *&ptr, int &size);
 	bool loadHofSequenceData(const char *filename, void *&ptr, int &size);
-	bool loadHofShapeAnimDataV1(const char *filename, void *&ptr, int &size);
-	bool loadHofShapeAnimDataV2(const char *filename, void *&ptr, int &size);
+	bool loadShapeAnimData_v1(const char *filename, void *&ptr, int &size);
+	bool loadShapeAnimData_v2(const char *filename, void *&ptr, int &size);
 
 	void freeRawData(void *&ptr, int &size);
 	void freeStringTable(void *&ptr, int &size);

Modified: scummvm/trunk/engines/kyra/sequences_hof.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sequences_hof.cpp	2008-05-12 13:19:11 UTC (rev 32057)
+++ scummvm/trunk/engines/kyra/sequences_hof.cpp	2008-05-12 13:35:58 UTC (rev 32058)
@@ -2626,7 +2626,7 @@
 
 	int numShp = -1;
 	if (_flags.isDemo && !_flags.isTalkie) {
-		_demoAnimData = _staticres->loadHofShapeAnimDataV1(k2SeqplayShapeAnimData, _itemAnimDataSize);
+		_demoAnimData = _staticres->loadShapeAnimData_v1(k2SeqplayShapeAnimData, _itemAnimDataSize);
 		uint8 *shp = _res->fileData("icons.shp", 0);
 		uint32 outsize = READ_LE_UINT16(shp + 4);
 		_animShapeFiledata = new uint8[outsize];

Modified: scummvm/trunk/engines/kyra/staticres.cpp
===================================================================
--- scummvm/trunk/engines/kyra/staticres.cpp	2008-05-12 13:19:11 UTC (rev 32057)
+++ scummvm/trunk/engines/kyra/staticres.cpp	2008-05-12 13:35:58 UTC (rev 32058)
@@ -44,7 +44,7 @@
 
 namespace Kyra {
 
-#define RESFILE_VERSION 24
+#define RESFILE_VERSION 25
 
 bool StaticResource::checkKyraDat() {
 	Common::File kyraDat;
@@ -144,8 +144,8 @@
 		{ kPaletteTable, proc(loadPaletteTable), proc(freePaletteTable) },
 
 		{ k2SeqData, proc(loadHofSequenceData), proc(freeHofSequenceData) },
-		{ k2ShpAnimDataV1, proc(loadHofShapeAnimDataV1), proc(freeHofShapeAnimDataV1) },
-		{ k2ShpAnimDataV2, proc(loadHofShapeAnimDataV2), proc(freeHofShapeAnimDataV2) },
+		{ k2ShpAnimDataV1, proc(loadShapeAnimData_v1), proc(freeHofShapeAnimDataV1) },
+		{ k2ShpAnimDataV2, proc(loadShapeAnimData_v2), proc(freeHofShapeAnimDataV2) },
 
 		{ 0, 0, 0 }
 	};
@@ -262,11 +262,24 @@
 		{ k2IngameTalkObjIndex, kRawData, "I_TALKOBJECTS.MAP" },
 		{ k2IngameTimJpStrings, kStringList, "I_TIMJPSTR.TXT" },
 		{ k2IngameShapeAnimData, k2ShpAnimDataV2, "I_INVANIM.SHP" },
-		{ k2IngameTlkDemoStrings, kLanguageList, "I_TLKDEMO.TXT." },		
+		{ k2IngameTlkDemoStrings, kLanguageList, "I_TLKDEMO.TXT." },
 
 		{ 0, 0, 0 }
 	};
 
+	static const FilenameTable kyra3StaticRes[] = {
+		{ k3MainMenuStrings, kStringList, "MAINMENU.TXT" },
+		{ k3MusicFiles, kStringList, "SCORE.TRA" },
+		{ k3ScoreTable, kRawData, "SCORE.MAP" },
+		{ k3SfxFiles, kStringList, "SFXFILES.TRA" },
+		{ k3SfxMap, kRawData, "SFXINDEX.MAP" },
+		{ k3ItemAnimData, k2ShpAnimDataV2, "INVANIM.SHP" },
+		{ k3ItemMagicTable, kRawData, "ITEMMAGIC.MAP" },
+		{ k3ItemStringMap, kRawData, "ITEMSTRINGS.MAP" },
+
+		{ 0, 0, 0 }
+	};
+
 	if (_vm->game() == GI_KYRA1) {
 		_builtIn = 0;
 		_filenameTable = kyra1StaticRes;
@@ -274,7 +287,8 @@
 		_builtIn = 0;
 		_filenameTable = kyra2StaticRes;
 	} else if (_vm->game() == GI_KYRA3) {
-		return true;
+		_builtIn = 0;
+		_filenameTable = kyra3StaticRes;
 	} else {
 		error("unknown game ID");
 	}
@@ -367,11 +381,11 @@
 	return (const HofSeqData*)getData(id, k2SeqData, entries);
 }
 
-const ItemAnimData_v1 *StaticResource::loadHofShapeAnimDataV1(int id, int &entries) {
+const ItemAnimData_v1 *StaticResource::loadShapeAnimData_v1(int id, int &entries) {
 	return (const ItemAnimData_v1*)getData(id, k2ShpAnimDataV1, entries);
 }
 
-const ItemAnimData_v2 *StaticResource::loadHofShapeAnimDataV2(int id, int &entries) {
+const ItemAnimData_v2 *StaticResource::loadShapeAnimData_v2(int id, int &entries) {
 	return (const ItemAnimData_v2*)getData(id, k2ShpAnimDataV2, entries);
 }
 
@@ -729,11 +743,6 @@
 		if (ctrlOffs) {
 			int num_c = *(filePtr + ctrlOffs);
 			const uint16 *in_c = (uint16*) (filePtr + ctrlOffs + 1);
-			// safety check for library sequence which is supposed to have
-			// one frame more than control entries (seems to be a bug in
-			// the original code). This caused invalid memory access .
-			if (tmp_n[i].endFrame > num_c)
-				tmp_n[i].endFrame = num_c;
 			FrameControl *tmp_f = new FrameControl[num_c];
 
 			for (int ii = 0; ii < num_c; ii++) {
@@ -764,7 +773,7 @@
 	return true;
 }
 
-bool StaticResource::loadHofShapeAnimDataV1(const char *filename, void *&ptr, int &size) {
+bool StaticResource::loadShapeAnimData_v1(const char *filename, void *&ptr, int &size) {
 	int filesize;
 	uint8 *filePtr = getFile(filename, filesize);
 	uint8 *src = filePtr;
@@ -795,7 +804,7 @@
 	return true;
 }
 
-bool StaticResource::loadHofShapeAnimDataV2(const char *filename, void *&ptr, int &size) {
+bool StaticResource::loadShapeAnimData_v2(const char *filename, void *&ptr, int &size) {
 	int filesize;
 	uint8 *filePtr = getFile(filename, filesize);
 	uint8 *src = filePtr;
@@ -910,8 +919,10 @@
 
 	if (_vm->gameFlags().gameID == GI_KYRA2)
 		filename += ".K2";
+	else if (_vm->gameFlags().gameID == GI_KYRA3)
+		filename += ".K3";
 
-	if (_vm->gameFlags().isTalkie)
+	if (_vm->gameFlags().isTalkie && _vm->gameFlags().gameID != GI_KYRA3)
 		filename += ".CD";
 	else if (_vm->gameFlags().isDemo)
 		filename += ".DEM";
@@ -1202,7 +1213,7 @@
 	_cdaTrackTableFinale = _staticres->loadRawData(k2SeqplayFinaleCDA, _cdaTrackTableFinaleSize);
 	_ingameTalkObjIndex = (const uint16*) _staticres->loadRawData(k2IngameTalkObjIndex, _ingameTalkObjIndexSize);
 	_ingameTimJpStr = _staticres->loadStrings(k2IngameTimJpStrings, _ingameTimJpStrSize);
-	_itemAnimData = _staticres->loadHofShapeAnimDataV2(k2IngameShapeAnimData, _itemAnimDataSize);
+	_itemAnimData = _staticres->loadShapeAnimData_v2(k2IngameShapeAnimData, _itemAnimDataSize);
 
 	// replace sequence talkie files with localized versions and cut off .voc
 	// suffix from voc files so as to allow compression specific file extensions
@@ -1296,6 +1307,18 @@
 	_callbackN = (_flags.isDemo && !_flags.isTalkie) ? hofDemoNestedSequenceCallbacks : hofNestedSequenceCallbacks;
 }
 
+void KyraEngine_MR::initStaticResource() {
+	int tmp = 0;
+	_mainMenuStrings = _staticres->loadStrings(k3MainMenuStrings, _mainMenuStringsSize);
+	_soundList = _staticres->loadStrings(k3MusicFiles, _soundListSize);
+	_scoreTable = _staticres->loadRawData(k3ScoreTable, _scoreTableSize);	
+	_sfxFileList = _staticres->loadStrings(k3SfxFiles, _sfxFileListSize);
+	_sfxFileMap = _staticres->loadRawData(k3SfxMap, _sfxFileMapSize);	
+	_itemAnimData = _staticres->loadShapeAnimData_v2(k3ItemAnimData, tmp);
+	_itemMagicTable = _staticres->loadRawData(k3ItemMagicTable, tmp);
+	_itemStringMap = _staticres->loadRawData(k3ItemStringMap, _itemStringMapSize);
+}
+
 const ScreenDim Screen_LoK::_screenDimTable[] = {
 	{ 0x00, 0x00, 0x28, 0xC8, 0x0F, 0x0C, 0x00, 0x00 },
 	{ 0x08, 0x48, 0x18, 0x38, 0x0F, 0x0C, 0x00, 0x00 },
@@ -1939,69 +1962,6 @@
 
 // kyra 3 static res
 
-const char *KyraEngine_MR::_mainMenuStrings[] = {
-	"Start a new game",
-	"Introduction",
-	"Load a game",
-	"Exit the game",
-	"Nouvelle Partie",
-	"Introduction",
-	"Charger une partie",
-	"Quitter le jeu",
-	"Neues Spiel starten",
-	"Intro",
-	"Spielstand laden",
-	"Spiel beenden",
-	0
-};
-
-const char *KyraEngine_MR::_soundList[] = {
-	"ARREST1.AUD",
-	"BATH1.AUD",
-	"OCEAN1.AUD",
-	"CLOWN1.AUD",
-	"DARM2.AUD",
-	"FALL1M.AUD",
-	"FALL2.AUD",
-	"FISH1.AUD",
-	"FISHWNDR.AUD",
-	"HERMAN1.AUD",
-	"JAIL1.AUD",
-	"JUNGLE1.AUD",
-	"KATHY1.AUD",
-	"NICESINE.AUD",
-	"PEGASUS1.AUD",
-	"PIRATE1.AUD",
-	"PIRATE2.AUD",
-	"PIRATE3.AUD",
-	"POP3.AUD",
-	"PORT1.AUD",
-	"QUEEN1.AUD",
-	"RUINS1.AUD",
-	"SNAKES1.AUD",
-	"SPRING1.AUD",
-	"STATUE1.AUD",
-	"STATUE2.AUD",
-	"TITLE1.AUD",
-	"UNDER1.AUD",
-	"WALKCHP1.AUD",
-	"YANK1.AUD",
-	"ZAN2.AUD",
-	"GROOVE2.AUD",
-	"GROOVE3.AUD",
-	"KING1.AUD",
-	"KING2.AUD",
-	"GROOVE1.AUD",
-	"JAIL2.AUD",
-	"SPIRIT1.AUD",
-	"SPRING1A.AUD",
-	"POP1.AUD",
-	"POP2.AUD",
-	"SQUIRL1.AUD"
-};
-
-const int KyraEngine_MR::_soundListSize = ARRAYSIZE(KyraEngine_MR::_soundList);
-
 const char *KyraEngine_MR::_languageExtension[] = {
 	"TRE",
 	"TRF",
@@ -2029,386 +1989,10 @@
 
 const int KyraEngine_MR::_shapeDescsSize = ARRAYSIZE(KyraEngine_MR::_shapeDescs);
 
-const FrameControl KyraEngine_MR::_itemAnimFrames0[] = {
-	{ 0x03, 0x19 }, { 0x48, 0x1E }, { 0x49, 0x1E }
-};
-
-const FrameControl KyraEngine_MR::_itemAnimFrames1[] = {
-	{ 0x3A, 0x0B }, { 0x4B, 0x0B }, { 0x4C, 0x0B },	{ 0x4D, 0x0B },
-	{ 0x4E, 0x0B }, { 0x4F, 0x0B }, { 0x50, 0x0B }
-};
-
-const FrameControl KyraEngine_MR::_itemAnimFrames2[] = {
-	{ 0x14, 0x0F }, { 0x51, 0x0F }, { 0x52, 0x0F }, { 0x53, 0x0F }
-};
-
-const FrameControl KyraEngine_MR::_itemAnimFrames3[] = {
-	{ 0x13, 0x14 }, { 0x54, 0x14 }, { 0x55, 0x14 }, { 0x56, 0x14 }
-};
-
-const FrameControl KyraEngine_MR::_itemAnimFrames4[] = {
-	{ 0x15, 0x10 }, { 0x57, 0x12 }, { 0x58, 0x10 }, { 0x59, 0x11 },
-	{ 0x5A, 0x10 }, { 0x5B, 0x11 }, { 0x5C, 0x10 }
-};
-
-const FrameControl KyraEngine_MR::_itemAnimFrames5[] = { 
-	{ 0x09, 0x1E }, { 0x5D, 0x1E }, { 0x5E, 0x1E }, { 0x5D, 0x1E }
-};
-
-const FrameControl KyraEngine_MR::_itemAnimFrames6[] = {
-	{ 0x39, 0x21 }, { 0x5F, 0x20 }, { 0x60, 0x1E }, { 0x61, 0x20 },
-	{ 0x62, 0x21 }, { 0x63, 0x1E }, { 0x64, 0x22 }
-};
-
-const FrameControl KyraEngine_MR::_itemAnimFrames7[] = { 
-	{ 0x40, 0x0C }, { 0x6C, 0x10 }, { 0x6B, 0x10 }, { 0x6A, 0x0F },
-	{ 0x69, 0x0F },	{ 0x68, 0x0F }, { 0x67, 0x0F }, { 0x66, 0x0F },
-	{ 0x65, 0x0F }, { 0x66, 0x11 },	{ 0x67, 0x12 }, { 0x68, 0x10 },
-	{ 0x69, 0x0F }, { 0x6A, 0x10 }, { 0x6B, 0x0F }, { 0x6C, 0x10 },
-	{ 0x6B, 0x0F }, { 0x6A, 0x10 }, { 0x6B, 0x0F }, { 0x6C, 0x10 },
-	{ 0x6B, 0x0F }, { 0x6A, 0x10 }, { 0x69, 0x0F }, { 0x68, 0x10 },
-	{ 0x67, 0x12 }, { 0x66, 0x11 }, { 0x65, 0xC8 }, { 0x66, 0x11 },
-	{ 0x67, 0x12 }, { 0x68, 0x10 }, { 0x69, 0x0F }, { 0x6A, 0x10 },
-	{ 0x6B, 0x0F }, { 0x6C, 0x10 }
-};
-
-const FrameControl KyraEngine_MR::_itemAnimFrames8[] = {
-	{ 0x2B, 0x19 }, { 0x8E, 0x16 }, { 0x8F, 0x14 },
-	{ 0x90, 0x16 }, { 0x91, 0x50 }
-};
-
-const FrameControl KyraEngine_MR::_itemAnimFrames9[] = {
-	{ 0x3B, 0x258}, { 0x92, 0x0A }, { 0x93, 0x0A }, { 0x94, 0x0A },
-	{ 0x93, 0x0A }, { 0x92, 0x0A }
-};
-
-const ItemAnimData_v2 KyraEngine_MR::_itemAnimData[10] = {
-	{ 0x03, 0x03, _itemAnimFrames0 },
-	{ 0x3a, 0x07, _itemAnimFrames1 },
-	{ 0x14, 0x04, _itemAnimFrames2 },
-	{ 0x13, 0x04, _itemAnimFrames3 },
-	{ 0x15, 0x07, _itemAnimFrames4 },
-	{ 0x09, 0x04, _itemAnimFrames5 },
-	{ 0x39, 0x07, _itemAnimFrames6 },
-	{ 0x40, 0x22, _itemAnimFrames7 },
-	{ 0x2B, 0x05, _itemAnimFrames8 },
-	{ 0x3B, 0x06, _itemAnimFrames9 }
-};
-
 const uint8 KyraEngine_MR::_characterFrameTable[] = {
 	0x36, 0x35, 0x35, 0x33, 0x32, 0x32, 0x34, 0x34
 };
 
-const uint8 KyraEngine_MR::_sfxFileMap[] = {
-	0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
-	0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
-	0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x99, 0x00,
-	0x46, 0x00, 0xA9, 0x00, 0x33, 0x00, 0x65, 0x00,
-	0x9B, 0x00, 0x17, 0x00, 0xBB, 0x00, 0x64, 0x00,
-	0x55, 0x00, 0xD5, 0x00, 0x66, 0x00, 0xB9, 0x00,
-	0x9A, 0x00, 0xFF, 0x00, 0xCC, 0x00, 0x67, 0x00,
-	0x2E, 0x00, 0xA1, 0x00, 0xD0, 0x00, 0x63, 0x00,
-	0x89, 0x00, 0xBE, 0x00, 0x80, 0x00, 0x1D, 0x00,
-	0x02, 0x00, 0x28, 0x00, 0x91, 0x00, 0x29, 0x00,
-	0xCE, 0x00, 0x8F, 0x00, 0x49, 0x00, 0x2B, 0x00,
-	0x2D, 0x00, 0x2C, 0x00, 0x3E, 0x00, 0x22, 0x00,
-	0x80, 0x00, 0x9C, 0x00, 0x2E, 0x00, 0x04, 0x00,
-	0x47, 0x00, 0xA8, 0x00, 0x51, 0x00, 0x52, 0x00,
-	0x80, 0x00, 0x48, 0x00, 0x38, 0x0A, 0x0C, 0x00,
-	0xD8, 0x00, 0xD1, 0x00, 0xD2, 0x00, 0xD3, 0x00,
-	0xD1, 0x00, 0x6A, 0x00, 0x8A, 0x00, 0xC0, 0x00,
-	0xC1, 0x00, 0xC2, 0x00, 0x9F, 0x00, 0xA3, 0x00,
-	0x90, 0x00, 0xB6, 0x00, 0x37, 0x00, 0x71, 0x00,
-	0x13, 0x00, 0x50, 0x00, 0x5A, 0x00, 0x6E, 0x00,
-	0x70, 0x00, 0x11, 0x00, 0x16, 0x00, 0x14, 0x00,
-	0x43, 0x00, 0xCD, 0x00, 0xAA, 0x00, 0x15, 0x00,
-	0x83, 0x00, 0x19, 0x00, 0xB3, 0x00, 0x6F, 0x00,
-	0x26, 0x00, 0xC8, 0x00, 0xA7, 0x00, 0x98, 0x00,
-	0x87, 0x00, 0xC7, 0x00, 0xA2, 0x00, 0xB0, 0x00,
-	0x12, 0x00, 0xD7, 0x00, 0x56, 0x00, 0x45, 0x00,
-	0x4B, 0x00, 0xAF, 0x00, 0x3B, 0x00, 0x6C, 0x00,
-	0x8E, 0x00, 0x39, 0x00, 0x38, 0x00, 0x92, 0x00,
-	0x4B, 0x00, 0xD0, 0x00, 0x4A, 0x00, 0x9D, 0x00,
-	0x7F, 0x00, 0x6D, 0x00, 0xFF, 0x00, 0xFF, 0x00,
-	0x3D, 0x00, 0x72, 0x00, 0x40, 0x00, 0x66, 0x00,
-	0x01, 0x00, 0xA5, 0x00, 0x00, 0x00, 0x3C, 0x00,
-	0xAC, 0x00, 0x38, 0x00, 0x8B, 0x00, 0xDF, 0x00,
-	0x0E, 0x00, 0x54, 0x00, 0xFF, 0x00, 0xFF, 0x00,
-	0x94, 0x00, 0xAB, 0x00, 0x76, 0x00, 0x58, 0x00,
-	0x6B, 0x00, 0x27, 0x00, 0xFF, 0x00, 0x77, 0x00,
-	0xA6, 0x00, 0x63, 0x00, 0x9E, 0x00, 0xDE, 0x00,
-	0x84, 0x00, 0x85, 0x00, 0x86, 0x00, 0x3F, 0x00,
-	0xCC, 0x00, 0xCC, 0x00, 0xCC, 0x00, 0x93, 0x00,
-	0x9D, 0x00, 0x75, 0x00, 0x75, 0x00, 0x75, 0x00,
-	0x75, 0x00, 0x3A, 0x00, 0xFF, 0x00, 0xFF, 0x00,
-	0xFF, 0x00, 0xAE, 0x00, 0x8C, 0x00, 0x20, 0x00,
-	0xFF, 0x00, 0x32, 0x00, 0x32, 0x00, 0xFF, 0x00,
-	0x4D, 0x00, 0xD9, 0x00, 0x88, 0x00, 0x4D, 0x00,
-	0x4D, 0x00, 0x4D, 0x00, 0x4D, 0x00, 0xA0, 0x00,
-	0x4C, 0x00, 0x8C, 0x00, 0x4C, 0x00, 0x4C, 0x00,
-	0x8C, 0x00, 0x8C, 0x00, 0x5C, 0x00, 0x5D, 0x00,
-	0x60, 0x00, 0x5F, 0x00, 0xC5, 0x00, 0xBF, 0x00,
-	0xFF, 0x00, 0x4F, 0x00, 0x16, 0x00, 0x59, 0x00,
-	0xFF, 0x00, 0x24, 0x00, 0xA4, 0x00, 0xCF, 0x00,
-	0xFF, 0x00, 0x47, 0x00, 0x95, 0x00, 0x96, 0x00,
-	0x7B, 0x00, 0xBD, 0x00, 0xFF, 0x00, 0x34, 0x00,
-	0x35, 0x00, 0x36, 0x00, 0xDE, 0x00, 0xFF, 0x00,
-	0x4B, 0x00, 0xD6, 0x00, 0xFF, 0x00, 0x61, 0x00,
-	0x62, 0x00, 0xFF, 0x00, 0x78, 0x00, 0xFF, 0x00,
-	0x44, 0x00, 0xB4, 0x00, 0xB5, 0x00, 0x42, 0x00,
-	0x27, 0x00, 0xA2, 0x00, 0x27, 0x00, 0x5D, 0x00,
-	0x7A, 0x00, 0x89, 0x00, 0x1A, 0x00, 0x0E, 0x00,
-	0x82, 0x00, 0xFF, 0x00, 0x79, 0x00, 0x2A, 0x00,
-	0x81, 0x00, 0xFF, 0x00, 0x74, 0x00, 0x4E, 0x00,
-	0xB1, 0x00, 0x1B, 0x00, 0x2F, 0x00, 0xBA, 0x00,
-	0xBB, 0x00, 0xBC, 0x00, 0xDA, 0x00, 0xDB, 0x00,
-	0x18, 0x00, 0x5E, 0x00, 0x0D, 0x0A, 0x88, 0x00,
-	0x1E, 0x00, 0x1F, 0x00, 0x20, 0x00, 0x21, 0x00,
-	0x69, 0x00, 0x1C, 0x00, 0x7C, 0x00, 0x30, 0x00,
-	0xC3, 0x00, 0xC4, 0x00, 0xAD, 0x00, 0x25, 0x00,
-	0x53, 0x00, 0xB7, 0x00, 0xB8, 0x00, 0xDC, 0x00,
-	0x8D, 0x00, 0xCB, 0x00, 0xD4, 0x00, 0xB2, 0x00,
-	0xDD, 0x00, 0x57, 0x00, 0x41, 0x00, 0x10, 0x00,
-	0x4C, 0x00, 0xC9, 0x00, 0xFF, 0x00, 0xFF, 0x00,
-	0x7D, 0x00, 0x7E, 0x00, 0xCA, 0x00, 0x03, 0x00,
-	0x04, 0x00, 0x05, 0x00, 0x06, 0x00, 0x07, 0x00,
-	0x08, 0x00, 0x09, 0x00, 0x0A, 0x00, 0x0B, 0x00,
-	0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
-	0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
-	0x23, 0x00, 0x97, 0x00, 0x73, 0x00
-};
-
-const int KyraEngine_MR::_sfxFileMapSize = ARRAYSIZE(KyraEngine_MR::_sfxFileMap);
-
-const char *KyraEngine_MR::_sfxFileList[] = {
-	"ALARM1",
-	"ARMOIRE1",
-	"ARROW1",
-	"AUDLAFF1",
-	"AUDLAFF2",
-	"AUDLAFF3",
-	"AUDLAFF4",
-	"AUDLAFF5",
-	"AUDLAFF6",
-	"AUDLAFF7",
-	"AUDLAFF8",
-	"AUDLAFF9",
-	"BARK22A",
-	"BEAM1",
-	"BEDSQK1",
-	"BEDSQK2",
-	"BIGCLOK1",
-	"BIGDOR2",
-	"BIRD4",
-	"BIRD122",
-	"BIRD222",
-	"BIRD322",
-	"BLAST22D",
-	"BLINK1",
-	"BOATMIX1",
-	"BODYFAL1",
-	"BOTLBLOW",
-	"BOUNCE3",
-	"BOUNCE5",
-	"BOW2",
-	"BUBL1",
-	"BUBL2",
-	"BUBL3",
-	"BUBL4",
-	"BUTTON1",
-	"BUTTON2",
-	"CANNON1",
-	"CASHREG1",
-	"CATHY1",
-	"CHAIN1",
-	"CHATTER1",
-	"CHATTER2",
-	"CHEESE1",
-	"CHICHIC2",
-	"CHIPLAF1",
-	"CHIPROR1",
-	"CLANG1",
-	"CLDOOR1",
-	"CLEAT1",
-	"CLOTHES1",
-	"COIN2",
-	"COUNTER1",
-	"CREAK1",
-	"CREAK2",
-	"CREAK3",
-	"CRIKT22A",
-	"CRMAD1",
-	"CRNORM1",
-	"CRUMBLE1",
-	"CRUNCH1",
-	"CRYSTAL1",
-	"DFLY1",
-	"DIAL1",
-	"DIGDIRT1",
-	"DIZZY1",
-	"DODO1",
-	"DOORBELL",
-	"DOORCL1",
-	"DOOROP1",
-	"DRIP1",
-	"DROPITM1",
-	"EAT22A",
-	"EATNUT1",
-	"ELEC1",
-	"EXPLODE2",
-	"FALL1",
-	"FALLM2",
-	"FALLM3",
-	"FESTRE1",
-	"FISHLAF2",
-	"FLAG22A",
-	"FLAG22B",
-	"FLAG22C",
-	"FLPOOF1",
-	"FOLDER1",
-	"FROG1",
-	"FROGJMP1",
-	"FSHBUBL1",
-	"FUNNEL1",
-	"FUSE1",
-	"GATE22A",
-	"GEM1",
-	"GEMFIRE1",
-	"GEMLIT1",
-	"GEMPUT1",
-	"GEMRAIN1",
-	"GEMWND1",
-	"GIRLLAF1",
-	"GIRLLAF2",
-	"GLASBRK1",
-	"GLOWY1",
-	"GOODK33",
-	"GROWTWIG",
-	"GUNTHER3",
-	"H2ODROP2",
-	"H2OFALL1",
-	"HAMMER1",
-	"HAYFALL2",
-	"HERMMAG1",
-	"HIPRES1",
-	"HITHED22",
-	"HOWL1",
-	"HUM1",
-	"HYPNO1",
-	"HYPNO2",
-	"IMPACT1",
-	"JOHAN1",
-	"JUNGAMB2",
-	"KISS1",
-	"KISS2",
-	"KNIFE",
-	"KNIFHIT1",
-	"KNIFSTAB",
-	"KNOCK",
-	"LAND1",
-	"LEVIBAB1",
-	"LEVIMAN1",
-	"LID",
-	"MACHMIX1",
-	"MALCFALL",
-	"MALCYAWN",
-	"MJUMP1",
-	"MOO1",
-	"MOO2",
-	"MOO3",
-	"MORPH1",
-	"MORPH2",
-	"MORPH3",
-	"MORPH4",
-	"MOTHS1",
-	"MSPLASH1",
-	"MTLSLAM1",
-	"MUDBATH1",
-	"NAIL1",
-	"NEIGH1",
-	"NETCATCH",
-	"NETMAL1",
-	"NETRIP1",
-	"OPDOOR1",
-	"OWL1",
-	"OWL2",
-	"PEDAL3",
-	"PEGWING1",
-	"PICKUP1",
-	"PLUCK3",
-	"POLGULP1",
-	"POOF1",
-	"PORTAL1",
-	"POURH2O1",
-	"PRIMOR1",
-	"PUMP1",
-	"PUNCTRE1",
-	"RATTLE1",
-	"REV2",
-	"RING",
-	"ROAR3",
-	"ROWBOAT1",
-	"RUCKUS1",
-	"RUMBLE1",
-	"SCOLD1",
-	"SCRATCH1",
-	"SHOVEL1",
-	"SHOWER2",
-	"SLOTPUL1",
-	"SNAKKILL",
-	"SNAP1",
-	"SNIFF1",
-	"SNIFF2",
-	"SNIFFM1",
-	"SNIP22B",
-	"SNORIN1",
-	"SNOROUT1",
-	"SNORT1",
-	"SPITBAL1",
-	"SPITBAL2",
-	"SPLASH1",
-	"SQUEAK1",
-	"SQUEAK2",
-	"SQUEAK3",
-	"STATUE",
-	"STAMPED1",
-	"STARS1",
-	"STONE1",
-	"STONE2",
-	"STONE3",
-	"STRETCH1",
-	"STRETCH2",
-	"SUNRISE1",
-	"SWALLOW1",
-	"SWALLOW2",
-	"SWAV22B",
-	"TELBEL1",
-	"TELBEL2",
-	"TENNIS1",
-	"THROW1",
-	"THUMP1",
-	"TOILET1",
-	"TRAPDOR1",
-	"TRICKLE",
-	"TROLGRNT",
-	"TROLYEL1",
-	"TROLYEL2",
-	"TUBEDOR1",
-	"TWIGSNAP",
-	"UMBRLA1",
-	"UNLOK22A",
-	"VACUUM",
-	"WAVELT1",
-	"WHIP1",
-	"WHIP2",
-	"WOODHIT1",
-	"YAWN1",
-	"ZING",
-	"ZIPPER1"
-};
-
-const int KyraEngine_MR::_sfxFileListSize = ARRAYSIZE(KyraEngine_MR::_sfxFileList);
-
 const uint8 KyraEngine_MR::_badConscienceFrameTable[] = {
 	0x13, 0x13, 0x13, 0x18, 0x13, 0x13, 0x13, 0x13,
 	0x13, 0x13, 0x13, 0x10, 0x13, 0x13, 0x13, 0x13,
@@ -2449,28 +2033,6 @@
 	0x39, 0x40, 0x3E, 0x3D, 0x3C, 0x3F, 0xFF
 };
 
-const uint8 KyraEngine_MR::_itemMagicTable[] = {
-	0x06, 0x05, 0x07, 0xFE, 0x05, 0x06, 0x07, 0xFE,
-	0x03, 0x00, 0x22, 0xFE, 0x00, 0x03, 0x22, 0xFE,
-	0x10, 0x00, 0x20, 0x0F, 0x00, 0x10, 0x0F, 0x20,
-	0x10, 0x22, 0x21, 0x0F, 0x22, 0x10, 0x0F, 0x21,
-	0xFF, 0xFF, 0xFF, 0xFF
-};
-
-const uint8 KyraEngine_MR::_itemStringMap[] = {
-	1, 0, 2, 0, 2, 2, 0, 0,
-	2, 2, 2, 2, 2, 2, 2, 0,
-	0, 0, 0, 0, 0, 0, 3, 1,
-	2, 0, 2, 2, 0, 0, 0, 0,
-	0, 0, 1, 2, 0, 2, 0, 2,
-	0, 0, 2, 0, 0, 0, 0, 1,
-	1, 0, 2, 2, 0, 0, 2, 0,
-	0, 2, 0, 2, 2, 0, 0, 2,
-	0, 0, 0, 0, 2, 0, 0, 2
-};
-
-const uint KyraEngine_MR::_itemStringMapSize = ARRAYSIZE(KyraEngine_MR::_itemStringMap);
-
 const uint8 KyraEngine_MR::_itemStringPickUp[] = {
 	0x4, 0x7, 0x0, 0xA
 };
@@ -2483,36 +2045,6 @@
 	0x6, 0x9, 0x2, 0xC
 };
 
-const int8 KyraEngine_MR::_scoreTable[] = {
-	10,  8,  5,  9, 10, 10,  7,  8,
-	 9,  9,  8,  8,  7,  8,  5,  9,
-	 6, 10,  7,  8,  5,  9,  6,  6,
-	 7,  8,  5,  9,  6,  8,  7,  8,
-	 5,  9,  6, 10,  7,  8,  5,  5,
-	 5,  7,  5,  7, 10,  5, 10,  5,
-	 5,  8,  6,  8,  7,  5,  5,  8,
-	 6,  9,  5,  7,  6,  5,  5,  7,
-	 7,  7,  6,  5,  8,  6, 10,  5,
-	 7,  5, 10,  5,  5,  5,  5,  7,
-	 5,  8,  9,  7,  7,  6, 10,  6,
-	 5, 10,  8,  5,  8,  6, 10,  5,
-	 5,  8,  8,  5,  7,  7,  7,  6,
-	 8,  9,  8,  8,  6,  5,  7,  6,
-	 5,  8, 15,  7,  9,  6,  6,  8,
-	 5,  8, 15, 15,  5, 15,  0,  0,
-	 0,  0,  0,  0,  0,  0,  0,  0,
-	 0,  0,  0,  0,  0,  0,  0,  0,
-	 0,  0,  0,  0,  0,  0,  0,  0,
-	 0,  0,  0,  0,  0,  0,  0,  0,
-	 0,	 0,  0,  0,  0,  0,  0,  0,
-	 0,  0,  0,  0,  0,  0,  0,  0,
-	 0,  0,  0,  0,  0,  0,  0,  0,
-	 0,  0,  0,  0,  0,  0,  0,  0,
-	 0,  0,  0,  0,  0,  0,  0,  0 
-}; 
-
-const int KyraEngine_MR::_scoreTableSize = ARRAYSIZE(KyraEngine_MR::_scoreTable);
-
 void KyraEngine_MR::initMainButtonList(bool disable) {
 	if (!_mainButtonListInitialized) {
 		_mainButtonData = new Button[14];

Modified: scummvm/trunk/tools/create_kyradat/create_kyradat.cpp
===================================================================
--- scummvm/trunk/tools/create_kyradat/create_kyradat.cpp	2008-05-12 13:19:11 UTC (rev 32057)
+++ scummvm/trunk/tools/create_kyradat/create_kyradat.cpp	2008-05-12 13:35:58 UTC (rev 32058)
@@ -31,7 +31,7 @@
 #include "md5.h"
 
 enum {
-	kKyraDatVersion = 24,
+	kKyraDatVersion = 25,
 	kIndexSize = 12
 };
 
@@ -50,6 +50,8 @@
 #include "hof_cd.h"
 #include "hof_demo.h"
 
+#include "malcolm.h"
+
 const Game kyra1FanTranslations[] = {
 	{ kKyra1, IT_ITA, kTalkieVersion, "d0f1752098236083d81b9497bd2b6989", kyra1FreCD },
 	GAME_DUMMY_ENTRY
@@ -63,6 +65,10 @@
 bool extractHofShapeAnimDataV1(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch = 0);
 bool extractHofShapeAnimDataV2(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch = 0);
 
+bool extractStringsWoSuffix(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch = 0);
+bool extractRaw16to8(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch = 0);
+bool extractMrShapeAnimData(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch = 0);
+
 int extractHofSeqData_checkString(const void *ptr, uint8 checkSize);
 int extractHofSeqData_isSequence(const void *ptr, const Game *g, uint32 maxCheckSize);
 int extractHofSeqData_isControl(const void *ptr, uint32 size);
@@ -81,6 +87,10 @@
 	{ k2TypeShpDataV1, extractHofShapeAnimDataV1, createFilename },
 	{ k2TypeShpDataV2, extractHofShapeAnimDataV2, createFilename },
 
+	{ k2TypeSoundList, extractStringsWoSuffix, createFilename },
+	{ k3TypeRaw16to8, extractRaw16to8, createFilename },
+	{ k3TypeShpData, extractMrShapeAnimData, createFilename },
+
 	{ -1, 0, 0}
 };
 
@@ -224,8 +234,19 @@
 	{ k2IngameTalkObjIndex, kTypeRawData, "I_TALKOBJECTS.MAP" },
 	{ k2IngameTimJpStrings, kTypeStringList, "I_TIMJPSTR.TXT" },
 	{ k2IngameItemAnimData, k2TypeShpDataV2, "I_INVANIM.SHP" },	
-	{ k2IngameTlkDemoStrings, kTypeLanguageList, "I_TLKDEMO.TXT" },	
-	
+	{ k2IngameTlkDemoStrings, kTypeLanguageList, "I_TLKDEMO.TXT" },
+
+
+	// MALCOLM'S REVENGE
+	{ k3MainMenuStrings, kTypeStringList, "MAINMENU.TXT" },
+	{ k3MusicFiles, k2TypeSoundList, "SCORE.TRA" },
+	{ k3ScoreTable, kTypeRawData, "SCORE.MAP" },
+	{ k3SfxFiles, kTypeStringList, "SFXFILES.TRA" },
+	{ k3SfxMap, k3TypeRaw16to8, "SFXINDEX.MAP" },
+	{ k3ItemAnimData, k3TypeShpData, "INVANIM.SHP" },
+	{ k3ItemMagicTable, k3TypeRaw16to8, "ITEMMAGIC.MAP" },
+	{ k3ItemStringMap, kTypeRawData, "ITEMSTRINGS.MAP" },
+
 	{ -1, 0, 0 }
 };
 
@@ -637,6 +658,7 @@
 
 			} else if (cycle == 1 && v != 1 && v != -2) {
 				uint16 controlOffs = 0;
+				uint16 ctrSize = 0;
 				if (v) {
 					const byte *ctrStart = ptr;
 					while (v && v != -2) {
@@ -647,7 +669,7 @@
 					if (v == -2)
 						break;
 
-					uint16 ctrSize = (uint16)(ptr - ctrStart);
+					ctrSize = (uint16)(ptr - ctrStart);
 
 					if (g->special != k2DemoVersion &&
 						extractHofSeqData_isControl(ctrStart, ctrSize)) {
@@ -673,11 +695,20 @@
 				ptr += 14;
 				output += 14;
 
-				for (int w = 0; w < 3; w++) { //startframe, endFrame, frameDelay
-					WRITE_BE_UINT16(output, READ_LE_UINT16(ptr));
-					ptr += 2;
-					output += 2;
-				}
+				// startframe
+				WRITE_BE_UINT16(output, READ_LE_UINT16(ptr));
+				ptr += 2;
+				output += 2;
+
+				// endFrame				
+				WRITE_BE_UINT16(output, (ctrSize && ((ctrSize >> 2)  < READ_LE_UINT16(ptr))) ? (ctrSize >> 2) : READ_LE_UINT16(ptr));
+				ptr += 2;
+				output += 2;
+
+				// frameDelay
+				WRITE_BE_UINT16(output, READ_LE_UINT16(ptr));
+				ptr += 2;
+				output += 2;
 				
 				ptr += 4;
 
@@ -839,8 +870,8 @@
 }
 
 bool extractHofShapeAnimDataV1(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch) {
-	int outsize = size + 1;
-	uint8 *buffer = new uint8[outsize];
+	int outsize = 1;
+	uint8 *buffer = new uint8[size + 1];
 	const uint8 *src = data;
 	uint8 *dst = buffer + 1;
 
@@ -851,12 +882,13 @@
 		WRITE_BE_UINT16(dst, READ_LE_UINT16(src));
 		src += 4;
 		dst += 2;
-		outsize -= 2;
+		outsize += 4;
 		
 		for (int j = 0; j < 20; j++) {
 			WRITE_BE_UINT16(dst, READ_LE_UINT16(src));
 			src += 2;
 			dst += 2;
+			outsize += 2;
 		}
 
 	};
@@ -867,11 +899,11 @@
 }
 
 bool extractHofShapeAnimDataV2(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch) {
-	int outsize = size + 1;
-	uint8 *buffer = new uint8[outsize];
+	int outsize = 1;
+	uint8 *buffer = new uint8[size + 1];
 	const uint8 *src = data;
 	uint8 *dst = buffer + 1;
-	uint8 *fin = buffer + outsize;
+	const uint8 *fin = data + size;
 	int count = 0;
 
 	do {
@@ -887,23 +919,104 @@
 		uint8 numFrames = *src;
 		*dst++ = numFrames;
 		src += 6;
-		outsize -= 5;
+		outsize += 3;
 		
 		for (int i = 0; i < (numFrames << 1); i++) {
 			WRITE_BE_UINT16(dst, READ_LE_UINT16(src));
 			src += 2;
 			dst += 2;
+			outsize += 2;
 		}
 
 		src += (48 - (numFrames << 2));
 
-	} while (dst < fin);
+	} while (src < fin);
 
 	*buffer = count; // number of items
 
 	return out.addFile(filename, buffer, outsize);
 }
 
+bool extractStringsWoSuffix(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch) {
+	int outsize = size + 4;
+	uint8 *buffer = new uint8[outsize];
+	const uint8 *src = data;
+	uint8 *dst = buffer + 4;
+	const uint8 *fin = src + size;
+	int entries = 0;
+
+	while (src < fin) {
+		while (!*src && src < fin)
+			src++;
+		while (*src && *src != '.' && src < fin)
+			*dst++ = *src++;
+
+		*dst++ = '\0';
+		entries++;
+
+		if (*src == '.') {
+			while (*src && src < fin)
+				src++;
+		}
+	}
+
+	WRITE_BE_UINT32(buffer, entries);
+	outsize = dst - buffer;
+
+	return out.addFile(filename, buffer, outsize);
+}
+
+bool extractRaw16to8(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch) {
+	int outsize = size >> 1;
+	uint8 *buffer = new uint8[outsize];
+	const uint8 *src = data;
+	uint8 *dst = buffer;
+
+	for (int i = 0; i < outsize; i++) {
+		*dst++ = *src++;
+		*src++;
+	}
+
+	return out.addFile(filename, buffer, outsize);
+}
+
+bool extractMrShapeAnimData(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int fmtPatch) {
+	int outsize = 1;
+	uint8 *buffer = new uint8[size + 1];
+	const uint8 *src2 = data;
+	const uint8 *src1 = data + 324;
+	uint8 *dst = buffer + 1;
+	const uint8 *fin = data + size;
+	int count = 0;
+
+	do {
+		if (READ_LE_UINT16(src1) == 0xffff)
+			break;
+
+		count++;
+
+		WRITE_BE_UINT16(dst, READ_LE_UINT16(src1));
+		src1 += 2;
+		dst += 2;
+		
+		uint8 numFrames = *src1;
+		*dst++ = numFrames;
+		src1 += 10;
+		outsize += 3;
+		
+		for (int i = 0; i < (numFrames << 1); i++) {
+			WRITE_BE_UINT16(dst, READ_LE_UINT16(src2));
+			src2 += 2;
+			dst += 2;
+			outsize += 2;
+		}
+	} while (src1 < fin);
+
+	*buffer = count; // number of items
+
+	return out.addFile(filename, buffer, outsize);
+}
+
 // index generation
 
 enum {
@@ -925,7 +1038,7 @@
 uint32 getFeatures(const Game *g) {
 	uint32 features = 0;
 
-	if (g->special == kTalkieVersion || g->special == k2CDFile1E || g->special == k2CDFile1F || g->special == k2CDFile1G || g->special == k2CDFile2E || g->special == k2CDFile2F || g->special == k2CDFile2G)
+	if (g->special == kTalkieVersion || g->special == k2CDFile1E || g->special == k2CDFile1F || g->special == k2CDFile1G || g->special == k2CDFile2E || g->special == k2CDFile2F || g->special == k2CDFile2G || g->game == kKyra3)
 		features |= GF_TALKIE;
 	else if (g->special == kDemoVersion || g->special == k2DemoVersion)
 		features |= GF_DEMO;
@@ -1203,6 +1316,8 @@
 	kyra2TownsGames,
 	kyra2Demos,
 
+	kyra3Games,
+
 	0
 };
 
@@ -1229,6 +1344,3 @@
 	printf("file is not supported (unknown md5 \"%s\")\n", md5str);
 	return 0;
 }
-
-
-

Modified: scummvm/trunk/tools/create_kyradat/create_kyradat.h
===================================================================
--- scummvm/trunk/tools/create_kyradat/create_kyradat.h	2008-05-12 13:19:11 UTC (rev 32057)
+++ scummvm/trunk/tools/create_kyradat/create_kyradat.h	2008-05-12 13:35:58 UTC (rev 32058)
@@ -164,6 +164,15 @@
 	k2IngameItemAnimData,
 	k2IngameTlkDemoStrings,
 
+	k3MainMenuStrings,
+	k3MusicFiles,
+	k3ScoreTable,
+	k3SfxFiles,
+	k3SfxMap,
+	k3ItemAnimData,
+	k3ItemMagicTable,
+	k3ItemStringMap,
+
 	kMaxResIDs
 };
 
@@ -246,7 +255,11 @@
 
 	k2TypeSeqData,
 	k2TypeShpDataV1,
-	k2TypeShpDataV2
+	k2TypeShpDataV2,
+	k2TypeSoundList,
+
+	k3TypeRaw16to8,
+	k3TypeShpData
 };
 
 struct ExtractType {

Added: scummvm/trunk/tools/create_kyradat/malcolm.h
===================================================================
--- scummvm/trunk/tools/create_kyradat/malcolm.h	                        (rev 0)
+++ scummvm/trunk/tools/create_kyradat/malcolm.h	2008-05-12 13:35:58 UTC (rev 32058)
@@ -0,0 +1,17 @@
+const ExtractEntry kyra3cd[] = {
+	{ k3MainMenuStrings, 0x0002D932, 0x0002D9E2 },
+	{ k3MusicFiles, 0x0003062C, 0x00030801 },
+	{ k3ScoreTable, 0x0002E4D0, 0x0002E598 },
+	{ k3SfxFiles, 0x0002E84E, 0x0002F10D },
+	{ k3SfxMap, 0x0002A590, 0x0002AA50 },
+	{ k3ItemAnimData, 0x00031614, 0x000317DC },
+	{ k3ItemMagicTable, 0x0002FB2A, 0x0002FB72 },
+	{ k3ItemStringMap, 0x0002D07A, 0x0002D0C2 },
+	{ -1, 0, 0 }
+};
+
+const Game kyra3Games[] = {
+	{ kKyra3, EN_ANY, -1, "bf68701eb591d0b72219f314c0d32688", kyra3cd },
+	GAME_DUMMY_ENTRY
+};
+


Property changes on: scummvm/trunk/tools/create_kyradat/malcolm.h
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Date Rev Author URL Id
Name: svn:eol-style
   + native

Modified: scummvm/trunk/tools/create_kyradat/misc.h
===================================================================
--- scummvm/trunk/tools/create_kyradat/misc.h	2008-05-12 13:19:11 UTC (rev 32057)
+++ scummvm/trunk/tools/create_kyradat/misc.h	2008-05-12 13:35:58 UTC (rev 32058)
@@ -460,6 +460,18 @@
 	-1
 };
 
+const int kyra3Need[] = {
+	k3MainMenuStrings,
+	k3MusicFiles,
+	k3ScoreTable,
+	k3SfxFiles,
+	k3SfxMap,
+	k3ItemAnimData,
+	k3ItemMagicTable,
+	k3ItemStringMap,
+	-1
+};
+
 const GameNeed gameNeedTable[] = {
 	{ kKyra1, -1, kyra1FloppyNeed },
 	{ kKyra1, kTalkieVersion, kyra1CDNeed },
@@ -485,6 +497,8 @@
 	{ kKyra2, k2DemoVersionTlkF, kyra2TlkDemoNeed},
 	{ kKyra2, k2DemoVersionTlkG, kyra2TlkDemoNeed},
 
+	{ kKyra3, -1, kyra3Need },
+
 	{ -1, -1, 0 }
 };
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list