[Scummvm-cvs-logs] scummvm master -> 36cc94ab73e6bc23ec904bede7dae768dd9f28b2

athrxx athrxx at scummvm.org
Wed Jan 9 21:01:08 CET 2013


This automated email contains information about 8 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
4eba2a7e54 KYRA: (LOL/FM-TOWNS) - add detection entry
a7c77e8104 KYRA: fix invalid mem access in kyradat tool
cc465076ee KYRA: (LOL/FM-TOWNS) - adapt static resources
da3c385ee3 KYRA: (LOL/FM-TOWNS) some startup code
0b38615a43 KYRA: (LOL/FM-TOWNS) - adjust sjis font settings, spacing, etc.
ee479f289f KYRA: (LOL/FM-TOWNS) - adapt text displayer
0c95f6524e KYRA: (LOL/FM-TOWNS) - fix sjis text position for button labels
36cc94ab73 KYRA: (LOL/FM-TOWNS) - add keyboard controls


Commit: 4eba2a7e54840f74dc741d960432dc3f7e0cc8a0
    https://github.com/scummvm/scummvm/commit/4eba2a7e54840f74dc741d960432dc3f7e0cc8a0
Author: athrxx (athrxx at scummvm.org)
Date: 2013-01-09T11:22:25-08:00

Commit Message:
KYRA: (LOL/FM-TOWNS) - add detection entry

Changed paths:
    engines/kyra/detection_tables.h



diff --git a/engines/kyra/detection_tables.h b/engines/kyra/detection_tables.h
index 5b9d665..d948f7d 100644
--- a/engines/kyra/detection_tables.h
+++ b/engines/kyra/detection_tables.h
@@ -53,7 +53,8 @@ namespace {
 #define LOL_FLOPPY_FLAGS FLAGS(false, false, false, false, false, false, false, false, Kyra::GI_LOL)
 #define LOL_FLOPPY_FAN_FLAGS(x, y) FLAGS_FAN(x, y, false, false, false, false, false, false, false, false, Kyra::GI_LOL)
 #define LOL_FLOPPY_CMP_FLAGS FLAGS(false, false, false, false, false, false, false, true, Kyra::GI_LOL)
-#define LOL_PC98_SJIS_FLAGS FLAGS(false, false, false, false, true, true, false, false, Kyra::GI_LOL)
+#define LOL_PC9801_FLAGS FLAGS(false, false, false, false, true, true, false, false, Kyra::GI_LOL)
+#define LOL_FMTOWNS_FLAGS FLAGS(false, false, false, false, true, false, false, false, Kyra::GI_LOL)
 #define LOL_DEMO_FLAGS FLAGS(true, true, false, false, false, false, false, false, Kyra::GI_LOL)
 #define LOL_KYRA2_DEMO_FLAGS FLAGS(true, false, false, false, false, false, false, false, Kyra::GI_KYRA2)
 
@@ -1462,7 +1463,24 @@ const KYRAGameDescription adGameDescs[] = {
 			ADGF_NO_FLAGS,
 			GUIO5(GUIO_NOSPEECH, GUIO_MIDIPC98, GUIO_RENDERPC9801, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS)
 		},
-		LOL_PC98_SJIS_FLAGS
+		LOL_PC9801_FLAGS
+	},
+
+	{
+		{
+			"lol",
+			0,
+			{
+				{ "GENERAL.PAK", 0, "2e4d4ce54bac9162e11fcba6907b576e", -1 },
+				{ "TMUS.PAK", 0, "5543dae575164e51856f5a49cfd6b368", -1 },
+				{ 0, 0, 0, 0 }
+			},
+			Common::JA_JPN,
+			Common::kPlatformFMTowns,
+			ADGF_NO_FLAGS,
+			GUIO5(GUIO_NOSPEECH, GUIO_MIDITOWNS, GUIO_RENDERFMTOWNS, GAMEOPTION_LOL_SCROLLING, GAMEOPTION_LOL_CURSORS)
+		},
+		LOL_FMTOWNS_FLAGS
 	},
 
 	{


Commit: a7c77e8104019f8958b399ef00980ebf32ae71b6
    https://github.com/scummvm/scummvm/commit/a7c77e8104019f8958b399ef00980ebf32ae71b6
Author: athrxx (athrxx at scummvm.org)
Date: 2013-01-09T11:22:26-08:00

Commit Message:
KYRA: fix invalid mem access in kyradat tool

Changed paths:
    devtools/create_kyradat/extract.cpp



diff --git a/devtools/create_kyradat/extract.cpp b/devtools/create_kyradat/extract.cpp
index 86244fc..7388a32 100644
--- a/devtools/create_kyradat/extract.cpp
+++ b/devtools/create_kyradat/extract.cpp
@@ -965,12 +965,13 @@ bool extractPaddedStrings(PAKFile &out, const ExtractInformation *info, const by
 			src++;
 		while (*src && src < fin)
 			*dst++ = *src++;
-
-		*dst++ = '\0';
+		if (src < fin)
+			*dst++ = *src++;
 		entries++;
 	}
 
 	WRITE_BE_UINT32(buffer, entries);
+
 	outsize = dst - buffer;
 
 	return out.addFile(filename, buffer, outsize);


Commit: cc465076eef6194eb32320704a0855a21438bd95
    https://github.com/scummvm/scummvm/commit/cc465076eef6194eb32320704a0855a21438bd95
Author: athrxx (athrxx at scummvm.org)
Date: 2013-01-09T11:27:35-08:00

Commit Message:
KYRA: (LOL/FM-TOWNS) - adapt static resources

Changed paths:
    devtools/create_kyradat/create_kyradat.cpp
    devtools/create_kyradat/create_kyradat.h
    devtools/create_kyradat/extract.cpp
    devtools/create_kyradat/games.cpp
    devtools/create_kyradat/tables.cpp
    dists/engine-data/kyra.dat
    engines/kyra/eobcommon.h
    engines/kyra/gui_lol.cpp
    engines/kyra/gui_rpg.cpp
    engines/kyra/kyra_rpg.h
    engines/kyra/lol.cpp
    engines/kyra/lol.h
    engines/kyra/resource.h
    engines/kyra/saveload_lol.cpp
    engines/kyra/script_lol.cpp
    engines/kyra/sequences_lol.cpp
    engines/kyra/sprites_lol.cpp
    engines/kyra/staticres.cpp
    engines/kyra/staticres_eob.cpp
    engines/kyra/staticres_lol.cpp



diff --git a/devtools/create_kyradat/create_kyradat.cpp b/devtools/create_kyradat/create_kyradat.cpp
index 3b90ad0..1a3d406 100644
--- a/devtools/create_kyradat/create_kyradat.cpp
+++ b/devtools/create_kyradat/create_kyradat.cpp
@@ -47,7 +47,7 @@
 #include <map>
 
 enum {
-	kKyraDatVersion = 83
+	kKyraDatVersion = 84
 };
 
 const ExtractFilename extractFilenames[] = {
@@ -606,7 +606,7 @@ const ExtractFilename extractFilenames[] = {
 	// LANDS OF LORE
 
 	// Ingame
-	{ kLoLIngamePakFiles, kTypeStringList, false },
+	{ kLoLIngamePakFiles, k2TypeSfxList, false },
 
 	{ kLoLCharacterDefs, kLoLTypeCharData, true },
 	{ kLoLIngameSfxFiles, k2TypeSfxList, false },
@@ -625,7 +625,10 @@ const ExtractFilename extractFilenames[] = {
 	{ kLoLCharDefsKieran, kLoLTypeRaw16, false },
 	{ kLoLCharDefsAkshel, kLoLTypeRaw16, false },
 	{ kLoLExpRequirements, kLoLTypeRaw32, false },
-	{ kLoLMonsterModifiers, kLoLTypeRaw16, false },
+	{ kLoLMonsterModifiers1, kLoLTypeRaw16, false },
+	{ kLoLMonsterModifiers2, kLoLTypeRaw16, false },
+	{ kLoLMonsterModifiers3, kLoLTypeRaw16, false },
+	{ kLoLMonsterModifiers4, kLoLTypeRaw16, false },
 	{ kLoLMonsterShiftOffsets, kTypeRawData, false },
 	{ kLoLMonsterDirFlags, kTypeRawData, false },
 	{ kLoLMonsterScaleY, kTypeRawData, false },
@@ -633,8 +636,8 @@ const ExtractFilename extractFilenames[] = {
 	{ kLoLMonsterScaleWH, kLoLTypeRaw16, false },
 	{ kLoLFlyingObjectShp, kLoLTypeFlightShpData, false },
 	{ kLoLInventoryDesc, kLoLTypeRaw16, false },
-	{ kLoLLevelShpList, kTypeStringList, false },
-	{ kLoLLevelDatList, kTypeStringList, false },
+	{ kLoLLevelShpList, k2TypeSfxList, false },
+	{ kLoLLevelDatList, k2TypeSfxList, false },
 	{ kLoLCompassDefs, kLoLTypeCompassData, false },
 	{ kLoLItemPrices, kLoLTypeRaw16, false },
 	{ kLoLStashSetup, kTypeRawData, false },
@@ -671,14 +674,14 @@ const ExtractFilename extractFilenames[] = {
 	{ kLoLScrollYBottom, k3TypeRaw16to8, false },
 
 	{ kLoLButtonDefs, kLoLTypeButtonDef, false },
-	{ kLoLButtonList1, kLoLTypeRaw16, false },
-	{ kLoLButtonList2, kLoLTypeRaw16, false },
-	{ kLoLButtonList3, kLoLTypeRaw16, false },
-	{ kLoLButtonList4, kLoLTypeRaw16, false },
-	{ kLoLButtonList5, kLoLTypeRaw16, false },
-	{ kLoLButtonList6, kLoLTypeRaw16, false },
-	{ kLoLButtonList7, kLoLTypeRaw16, false },
-	{ kLoLButtonList8, kLoLTypeRaw16, false },
+	{ kLoLButtonList1, k3TypeRaw16to8, false },
+	{ kLoLButtonList2, k3TypeRaw16to8, false },
+	{ kLoLButtonList3, k3TypeRaw16to8, false },
+	{ kLoLButtonList4, k3TypeRaw16to8, false },
+	{ kLoLButtonList5, k3TypeRaw16to8, false },
+	{ kLoLButtonList6, k3TypeRaw16to8, false },
+	{ kLoLButtonList7, k3TypeRaw16to8, false },
+	{ kLoLButtonList8, k3TypeRaw16to8, false },
 
 	{ kLoLLegendData, kTypeRawData, false },
 	{ kLoLMapCursorOvl, kTypeRawData, false },
@@ -2111,8 +2114,14 @@ const char *getIdString(const int id) {
 		return "kLoLCharDefsAkshel";
 	case kLoLExpRequirements:
 		return "kLoLExpRequirements";
-	case kLoLMonsterModifiers:
-		return "kLoLMonsterModifiers";
+	case kLoLMonsterModifiers1:
+		return "kLoLMonsterModifiers1";
+	case kLoLMonsterModifiers2:
+		return "kLoLMonsterModifiers2";
+	case kLoLMonsterModifiers3:
+		return "kLoLMonsterModifiers3";
+	case kLoLMonsterModifiers4:
+		return "kLoLMonsterModifiers4";
 	case kLoLMonsterShiftOffsets:
 		return "kLoLMonsterShiftOffsets";
 	case kLoLMonsterDirFlags:
@@ -2229,6 +2238,8 @@ const char *getIdString(const int id) {
 		return "kLoLLightningDefs";
 	case kLoLFireballCoords:
 		return "kLoLFireballCoords";
+	case kLoLCredits:
+		return "kLoLCredits";
 	case kLoLHistory:
 		return "kLoLHistory";
 	default:
diff --git a/devtools/create_kyradat/create_kyradat.h b/devtools/create_kyradat/create_kyradat.h
index c2a69cf..6d5059c 100644
--- a/devtools/create_kyradat/create_kyradat.h
+++ b/devtools/create_kyradat/create_kyradat.h
@@ -606,7 +606,10 @@ enum kExtractID {
 	kLoLCharDefsKieran,
 	kLoLCharDefsAkshel,
 	kLoLExpRequirements,
-	kLoLMonsterModifiers,
+	kLoLMonsterModifiers1,
+	kLoLMonsterModifiers2,
+	kLoLMonsterModifiers3,
+	kLoLMonsterModifiers4,
 	kLoLMonsterShiftOffsets,
 	kLoLMonsterDirFlags,
 	kLoLMonsterScaleY,
diff --git a/devtools/create_kyradat/extract.cpp b/devtools/create_kyradat/extract.cpp
index 7388a32..748bd36 100644
--- a/devtools/create_kyradat/extract.cpp
+++ b/devtools/create_kyradat/extract.cpp
@@ -53,6 +53,7 @@ bool extractMrShapeAnimData(PAKFile &out, const ExtractInformation *info, const
 bool extractRaw16(PAKFile &out, const ExtractInformation *info, const byte *data, const uint32 size, const char *filename, int id);
 bool extractRaw32(PAKFile &out, const ExtractInformation *info, const byte *data, const uint32 size, const char *filename, int id);
 bool extractLoLButtonDefs(PAKFile &out, const ExtractInformation *info, const byte *data, const uint32 size, const char *filename, int id);
+bool extractLoLFlyingShpDefs(PAKFile &out, const ExtractInformation *info, const byte *data, const uint32 size, const char *filename, int id);
 
 bool extractEoB2SeqData(PAKFile &out, const ExtractInformation *info, const byte *data, const uint32 size, const char *filename, int id);
 bool extractEoB2ShapeData(PAKFile &out, const ExtractInformation *info, const byte *data, const uint32 size, const char *filename, int id);
@@ -81,7 +82,7 @@ const ExtractType extractTypeTable[] = {
 	{ kLoLTypeCharData, extractRaw },
 	{ kLoLTypeSpellData, extractRaw },
 	{ kLoLTypeCompassData, extractRaw16to8 },
-	{ kLoLTypeFlightShpData, extractRaw16to8 },
+	{ kLoLTypeFlightShpData, extractLoLFlyingShpDefs },
 	{ kLoLTypeRaw16, extractRaw16 },
 	{ kLoLTypeRaw32, extractRaw32 },
 	{ kLoLTypeButtonDef, extractLoLButtonDefs },
@@ -978,6 +979,10 @@ bool extractPaddedStrings(PAKFile &out, const ExtractInformation *info, const by
 }
 
 bool extractRaw16to8(PAKFile &out, const ExtractInformation *info, const byte *data, const uint32 size, const char *filename, int id) {
+	// Hack for some LOL FM-Towns entries
+	if (info->platform == Common::kPlatformFMTowns && ((id >= kLoLButtonList1 && id <= kLoLButtonList8) || id == kLoLCharInvIndex))
+		return extractRaw(out, info, data, size, filename, id);
+
 	int outsize = size >> 1;
 	uint8 *buffer = new uint8[outsize];
 	const uint8 *src = data;
@@ -1050,6 +1055,30 @@ bool extractLoLButtonDefs(PAKFile &out, const ExtractInformation *info, const by
 	return out.addFile(filename, buffer, outsize);
 }
 
+bool extractLoLFlyingShpDefs(PAKFile &out, const ExtractInformation *info, const byte *data, const uint32 size, const char *filename, int id) {
+	if (info->platform != Common::kPlatformFMTowns)
+		return extractRaw16to8(out, info, data, size, filename, id);
+
+	int outsize = size / 9 * 5;
+	uint8 *buffer = new uint8[outsize];
+	const uint8 *src = data;
+	uint8 *dst = buffer;
+
+	for (int i = outsize / 5; i; --i) {
+		*dst++ = *src++;
+		src++;
+		*dst++ = *src++;
+		src++;
+		*dst++ = *src++;
+		src++;
+		*dst++ = *src++;
+		*dst++ = *src++;
+		src++;
+	}
+
+	return out.addFile(filename, buffer, outsize);
+}
+
 bool extractEoB2SeqData(PAKFile &out, const ExtractInformation *info, const byte *data, const uint32 size, const char *filename, int id) {
 	int num = size / 11;
 	uint8 *buffer = new uint8[size];
diff --git a/devtools/create_kyradat/games.cpp b/devtools/create_kyradat/games.cpp
index 89229eb..1b62155 100644
--- a/devtools/create_kyradat/games.cpp
+++ b/devtools/create_kyradat/games.cpp
@@ -124,6 +124,9 @@ const Game lolGames[] = {
 	// PC98 (no language specifc strings)
 	{ kLoL, { JA_JPN, -1, -1 }, kPlatformPC98, kNoSpecial, { "6d5bd4a2f5ce433365734ca6b7a8d984", "1b0a457c48ae6908da301b656fe0aab4" } },
 
+	// FM-Towns (no language specifc strings)
+	{ kLoL, { JA_JPN, -1, -1 }, kPlatformFMTowns, kNoSpecial, { "a281c7143bf2b6c5d4daa107a4b0427e", "34b4cecce179990e3bcaaa2d31484a90"} },
+
 	// DOS CD (multi language version, with no language specific strings)
 	{ kLoL, { EN_ANY, FR_FRA, DE_DEU }, kPlatformPC, kTalkieVersion, { "9d1778314de80598c0b0d032e2a1a1cf", "263998ec600afca1cc7b935c473df670" } },
 	{ kLoL, { IT_ITA, FR_FRA, DE_DEU }, kPlatformPC, kTalkieVersion, { "9d1778314de80598c0b0d032e2a1a1cf", "f2af366e00f79dbf832fa19701d71ed9" } }, // Italian fan translation
@@ -800,7 +803,9 @@ const int lolFloppyNeed[] = {
 	kLoLCharDefsKieran,
 	kLoLCharDefsAkshel,
 	kLoLExpRequirements,
-	kLoLMonsterModifiers,
+	kLoLMonsterModifiers1,
+	kLoLMonsterModifiers2,
+	kLoLMonsterModifiers3,
 	kLoLMonsterShiftOffsets,
 	kLoLMonsterDirFlags,
 	kLoLMonsterScaleY,
@@ -844,7 +849,6 @@ const int lolFloppyNeed[] = {
 
 	kLoLButtonDefs,
 	kLoLButtonList1,
-	kLoLButtonList1,
 	kLoLButtonList2,
 	kLoLButtonList3,
 	kLoLButtonList4,
@@ -882,7 +886,9 @@ const int lolPC98Need[] = {
 	kLoLCharDefsKieran,
 	kLoLCharDefsAkshel,
 	kLoLExpRequirements,
-	kLoLMonsterModifiers,
+	kLoLMonsterModifiers1,
+	kLoLMonsterModifiers2,
+	kLoLMonsterModifiers3,
 	kLoLMonsterShiftOffsets,
 	kLoLMonsterDirFlags,
 	kLoLMonsterScaleY,
@@ -926,6 +932,89 @@ const int lolPC98Need[] = {
 
 	kLoLButtonDefs,
 	kLoLButtonList1,
+	kLoLButtonList2,
+	kLoLButtonList3,
+	kLoLButtonList4,
+	kLoLButtonList5,
+	kLoLButtonList6,
+	kLoLButtonList7,
+	kLoLButtonList8,
+
+	kLoLLegendData,
+	kLoLMapStringId,
+
+	kLoLSpellbookAnim,
+	kLoLSpellbookCoords,
+	kLoLHealShapeFrames,
+	kLoLLightningDefs,
+	kLoLFireballCoords,
+
+	kLoLCredits,
+
+	-1
+};
+
+const int lolFMTownsNeed[] = {
+	kLoLIngamePakFiles,
+
+	kLoLCharacterDefs,
+	kLoLIngameSfxFiles,
+	kLoLIngameSfxIndex,
+	kLoLSpellProperties,
+	kLoLGameShapeMap,
+	kLoLSceneItemOffs,
+	kLoLCharInvIndex,
+	kLoLCharInvDefs,
+	kLoLCharDefsMan,
+	kLoLCharDefsWoman,
+	kLoLCharDefsKieran,
+	kLoLCharDefsAkshel,
+	kLoLExpRequirements,
+	kLoLMonsterModifiers1,
+	kLoLMonsterModifiers2,
+	kLoLMonsterModifiers3,
+	kLoLMonsterShiftOffsets,
+	kLoLMonsterDirFlags,
+	kLoLMonsterScaleY,
+	kLoLMonsterScaleX,
+	kLoLMonsterScaleWH,
+	kLoLFlyingObjectShp,
+	kLoLInventoryDesc,
+
+	kLoLLevelShpList,
+	kLoLLevelDatList,
+	kLoLCompassDefs,
+	kLoLStashSetup,
+	kLoLDscWalls,
+	kRpgCommonDscShapeIndex,
+	kLoLDscOvlMap,
+	kLoLDscScaleWidthData,
+	kLoLDscScaleHeightData,
+	kRpgCommonDscX,
+	kLoLDscY,
+	kRpgCommonDscTileIndex,
+	kRpgCommonDscUnk2,
+	kRpgCommonDscDoorShapeIndex,
+	kRpgCommonDscDimData1,
+	kRpgCommonDscDimData2,
+	kRpgCommonDscBlockMap,
+	kRpgCommonDscDimMap,
+	kLoLDscOvlIndex,
+	kRpgCommonDscBlockIndex,
+	kRpgCommonDscDoorY2,
+	kRpgCommonDscDoorFrameY1,
+	kRpgCommonDscDoorFrameY2,
+	kLoLDscDoorScale,
+	kLoLDscDoor4,
+	kLoLDscDoorX,
+	kLoLDscDoorY,
+
+	kLoLScrollXTop,
+	kLoLScrollYTop,
+	kLoLScrollXBottom,
+	kLoLScrollYBottom,
+
+	kLoLButtonDefs,
 	kLoLButtonList1,
 	kLoLButtonList2,
 	kLoLButtonList3,
@@ -968,7 +1057,10 @@ const int lolCDNeed[] = {
 	kLoLCharDefsKieran,
 	kLoLCharDefsAkshel,
 	kLoLExpRequirements,
-	kLoLMonsterModifiers,
+	kLoLMonsterModifiers1,
+	kLoLMonsterModifiers2,
+	kLoLMonsterModifiers3,
+	kLoLMonsterModifiers4,
 	kLoLMonsterShiftOffsets,
 	kLoLMonsterDirFlags,
 	kLoLMonsterScaleY,
@@ -1013,7 +1105,6 @@ const int lolCDNeed[] = {
 
 	kLoLButtonDefs,
 	kLoLButtonList1,
-	kLoLButtonList1,
 	kLoLButtonList2,
 	kLoLButtonList3,
 	kLoLButtonList4,
@@ -1695,6 +1786,7 @@ const GameNeed gameNeedTable[] = {
 
 	{ kLoL, kPlatformPC, kNoSpecial, lolFloppyNeed },
 	{ kLoL, kPlatformPC98, kNoSpecial, lolPC98Need },
+	{ kLoL, kPlatformFMTowns, kNoSpecial, lolFMTownsNeed },
 
 	{ kLoL, kPlatformPC, kTalkieVersion, lolCDNeed },
 
diff --git a/devtools/create_kyradat/tables.cpp b/devtools/create_kyradat/tables.cpp
index 19b69d9..09d70bc 100644
--- a/devtools/create_kyradat/tables.cpp
+++ b/devtools/create_kyradat/tables.cpp
@@ -3341,7 +3341,7 @@ const ExtractEntrySearchData kEoB2WallOfForceShpIdProvider[] = {
 const ExtractEntrySearchData kLoLIngamePakFilesProvider[] = {
 	{ UNK_LANG, kPlatformPC, { 0x00000088, 0x0000224F, { { 0xDA, 0x24, 0x18, 0xA3, 0xEF, 0x16, 0x70, 0x8F, 0xA8, 0xC2, 0x2E, 0xC2, 0xED, 0x39, 0x03, 0xD1 } } } },
 	{ UNK_LANG, kPlatformPC98, { 0x00000084, 0x00002125, { { 0x7A, 0x89, 0xE2, 0x36, 0xEC, 0x6F, 0x52, 0x2B, 0xEF, 0xBA, 0x3D, 0x28, 0x54, 0xDA, 0xFB, 0x72 } } } },
-
+	{ UNK_LANG, kPlatformFMTowns, { 0x0000009D, 0x00002179, { { 0x7D, 0x7A, 0xE1, 0xD9, 0x69, 0x23, 0x9D, 0xFF, 0x83, 0x39, 0x73, 0xEC, 0xF4, 0x26, 0x20, 0x8E } } } },
 	EXTRACT_END_ENTRY
 };
 
@@ -3356,6 +3356,7 @@ const ExtractEntrySearchData kLoLCharacterDefsProvider[] = {
 	{ RU_RUS, kPlatformPC, { 0x00000492, 0x00004ACD, { { 0xDF, 0x87, 0xFE, 0x89, 0x59, 0xCC, 0x01, 0xD7, 0xC7, 0xEB, 0x16, 0xA4, 0x09, 0xAF, 0x5D, 0xC0 } } } }, // CD
 	{ IT_ITA, kPlatformPC, { 0x00000492, 0x00004ACD, { { 0xDF, 0x87, 0xFE, 0x89, 0x59, 0xCC, 0x01, 0xD7, 0xC7, 0xEB, 0x16, 0xA4, 0x09, 0xAF, 0x5D, 0xC0 } } } }, // CD
 	{ JA_JPN, kPlatformPC98, { 0x00000492, 0x00005893, { { 0x7C, 0x7E, 0xFB, 0x80, 0xD9, 0xB6, 0x16, 0x87, 0x80, 0xB7, 0x46, 0x9B, 0x96, 0x1A, 0x6A, 0xBE } } } },
+	{ JA_JPN, kPlatformFMTowns, { 0x00000492, 0x00005041, { { 0xAB, 0x07, 0x37, 0xFE, 0xC2, 0x4B, 0x5D, 0x16, 0xE4, 0xC4, 0x2C, 0x8C, 0xC3, 0x78, 0xCB, 0xCB } } } },
 
 	EXTRACT_END_ENTRY
 };
@@ -3364,7 +3365,7 @@ const ExtractEntrySearchData kLoLIngameSfxFilesProvider[] = {
 	{ UNK_LANG, kPlatformPC, { 0x000008F2, 0x0001E5B6, { { 0x63, 0x5E, 0x37, 0xAA, 0x27, 0x80, 0x4C, 0x85, 0xB1, 0x9D, 0x7B, 0x1D, 0x64, 0xA3, 0xEB, 0x97 } } } }, // floppy
 	{ UNK_LANG, kPlatformPC, { 0x000008F2, 0x0001E5B7, { { 0x9E, 0xC8, 0xE8, 0x19, 0x2F, 0x58, 0x0B, 0xC7, 0x2D, 0x41, 0x72, 0xE7, 0xF4, 0x80, 0x03, 0xCB } } } }, // CD
 	{ UNK_LANG, kPlatformPC98, { 0x000008EF, 0x0001E585, { { 0x85, 0x81, 0x5C, 0xA4, 0x34, 0x44, 0xF4, 0x58, 0xF9, 0x82, 0xEE, 0x0F, 0x6A, 0x0D, 0xA2, 0x7F } } } },
-
+	{ UNK_LANG, kPlatformFMTowns, { 0x000008F0, 0x0001E585, { { 0xB7, 0x82, 0xFF, 0xAB, 0x71, 0x54, 0xEB, 0x52, 0x8D, 0xAC, 0x9A, 0xB4, 0x9E, 0x33, 0x00, 0x95 } } } },
 	EXTRACT_END_ENTRY
 };
 
@@ -3419,6 +3420,7 @@ const ExtractEntrySearchData kLoLSceneItemOffsProvider[] = {
 
 const ExtractEntrySearchData kLoLCharInvIndexProvider[] = {
 	{ UNK_LANG, kPlatformUnknown, { 0x0000000A, 0x00000006, { { 0x19, 0x79, 0x4E, 0xFC, 0x05, 0x14, 0x89, 0x23, 0xEB, 0xCA, 0x94, 0x50, 0xE8, 0xD3, 0x81, 0x24 } } } },
+	{ UNK_LANG, kPlatformFMTowns, { 0x00000005, 0x00000006, { { 0x54, 0x11, 0x01, 0x79, 0x4D, 0xED, 0xF9, 0xEA, 0xDF, 0x03, 0x51, 0xAB, 0x8D, 0x9D, 0x2F, 0x34 } } } },
 
 	EXTRACT_END_ENTRY
 };
@@ -3459,10 +3461,24 @@ const ExtractEntrySearchData kLoLExpRequirementsProvider[] = {
 	EXTRACT_END_ENTRY
 };
 
-const ExtractEntrySearchData kLoLMonsterModifiersProvider[] = {
-	{ UNK_LANG, kPlatformUnknown, { 0x00000018, 0x000002C6, { { 0x38, 0x9A, 0x8B, 0x50, 0xD2, 0x9B, 0x95, 0x38, 0x91, 0x02, 0xA9, 0xBE, 0x78, 0xE5, 0x89, 0x65 } } } }, // floppy + PC98
-	{ UNK_LANG, kPlatformPC, { 0x00000018, 0x000002EE, { { 0x4E, 0x37, 0x56, 0xE3, 0x42, 0xB3, 0x15, 0x2C, 0x7E, 0x9B, 0x7E, 0x50, 0x32, 0x91, 0x55, 0xBE } } } }, // CD
+const ExtractEntrySearchData kLoLMonsterModifiers1Provider[] = {
+	{ UNK_LANG, kPlatformUnknown, { 0x00000006, 0x00000142, { { 0x62, 0x4B, 0x5E, 0x46, 0x64, 0xA4, 0x3A, 0xB7, 0x11, 0x14, 0xA8, 0x41, 0xAF, 0x4E, 0xE6, 0x58 } } } }, // floppy + PC98 + FM-TOWNS
+	{ UNK_LANG, kPlatformPC, { 0x00000006, 0x000000E8, { { 0x94, 0xCB, 0xD2, 0xE4, 0xF4, 0xA8, 0x4D, 0x46, 0x2E, 0x84, 0x8C, 0x6F, 0xF9, 0x75, 0xD7, 0x28 } } } }, // CD
+	EXTRACT_END_ENTRY
+};
 
+const ExtractEntrySearchData kLoLMonsterModifiers2Provider[] = {
+	{ UNK_LANG, kPlatformUnknown, { 0x00000006, 0x000000C2, { { 0x89, 0x12, 0xA7, 0x0D, 0xD9, 0xC7, 0x5B, 0x03, 0xD4, 0x21, 0x6F, 0x0A, 0x1D, 0x83, 0x1B, 0x98 } } } },
+	EXTRACT_END_ENTRY
+};
+
+const ExtractEntrySearchData kLoLMonsterModifiers3Provider[] = {
+	{ UNK_LANG, kPlatformUnknown, { 0x00000006, 0x000000C2, { { 0x56, 0x4D, 0x82, 0xCC, 0x2C, 0x00, 0x1E, 0x9D, 0xF7, 0x64, 0xB7, 0x60, 0x63, 0x0A, 0x03, 0xD7 } } } },
+	EXTRACT_END_ENTRY
+};
+
+const ExtractEntrySearchData kLoLMonsterModifiers4Provider[] = {
+	{ UNK_LANG, kPlatformPC, { 0x00000006, 0x00000082, { { 0xA8, 0xFC, 0xBB, 0x1B, 0xC0, 0x85, 0x3B, 0xEF, 0xDB, 0xDE, 0xB0, 0x98, 0x58, 0x34, 0x75, 0xE9 } } } }, // CD
 	EXTRACT_END_ENTRY
 };
 
@@ -3487,6 +3503,7 @@ const ExtractEntrySearchData kLoLMonsterScaleYProvider[] = {
 const ExtractEntrySearchData kLoLMonsterScaleXProvider[] = {
 	{ UNK_LANG, kPlatformPC, { 0x00000020, 0x00000918, { { 0xF6, 0x14, 0xE6, 0x48, 0x4E, 0x5B, 0x43, 0xCC, 0xCE, 0x4E, 0x98, 0x71, 0x5A, 0xC2, 0x00, 0x1E } } } },
 	{ UNK_LANG, kPlatformPC98, { 0x0000001D, 0x000008D2, { { 0x1C, 0x25, 0x38, 0xE2, 0xBB, 0xB2, 0xDB, 0x93, 0x1B, 0x25, 0xB6, 0x89, 0xA9, 0x9B, 0x0A, 0xFE } } } },
+	{ UNK_LANG, kPlatformFMTowns, { 0x0000001D, 0x000008D2, { { 0x1C, 0x25, 0x38, 0xE2, 0xBB, 0xB2, 0xDB, 0x93, 0x1B, 0x25, 0xB6, 0x89, 0xA9, 0x9B, 0x0A, 0xFE } } } },
 
 	EXTRACT_END_ENTRY
 };
@@ -3499,6 +3516,7 @@ const ExtractEntrySearchData kLoLMonsterScaleWHProvider[] = {
 
 const ExtractEntrySearchData kLoLFlyingObjectShpProvider[] = {
 	{ UNK_LANG, kPlatformUnknown, { 0x00000082, 0x00000252, { { 0xDE, 0x9D, 0x89, 0xAF, 0x0F, 0x50, 0x14, 0x60, 0x68, 0xAF, 0x19, 0xD8, 0x54, 0x8A, 0x36, 0x27 } } } },
+	{ UNK_LANG, kPlatformFMTowns, { 0x00000075, 0x00000252, { { 0xD7, 0xE5, 0x13, 0x67, 0xDB, 0x9C, 0xD4, 0x12, 0x0E, 0x99, 0x0D, 0x2A, 0x70, 0x17, 0x95, 0x89 } } } },
 
 	EXTRACT_END_ENTRY
 };
@@ -3511,13 +3529,13 @@ const ExtractEntrySearchData kLoLInventoryDescProvider[] = {
 
 const ExtractEntrySearchData kLoLLevelShpListProvider[] = {
 	{ UNK_LANG, kPlatformUnknown, { 0x0000007F, 0x00002090, { { 0x17, 0x31, 0x8A, 0xB5, 0x9B, 0x3A, 0xDA, 0x16, 0x9E, 0xE3, 0xD1, 0x5F, 0xB4, 0x7B, 0xB2, 0x25 } } } },
-
+	{ UNK_LANG, kPlatformFMTowns, { 0x00000091, 0x00002090, { { 0x51, 0x79, 0x1D, 0x60, 0xB0, 0x71, 0xB8, 0xF2, 0xDD, 0xD4, 0x36, 0x1B, 0xF8, 0x15, 0xBF, 0xB7 } } } },
 	EXTRACT_END_ENTRY
 };
 
 const ExtractEntrySearchData kLoLLevelDatListProvider[] = {
-	{ UNK_LANG, kPlatformUnknown, { 0x0000007F, 0x00001FB8, { { 0xF6, 0xE9, 0x98, 0x79, 0x51, 0xCA, 0xA0, 0x35, 0xE4, 0xD0, 0xA1, 0xCD, 0x23, 0x89, 0x7D, 0x11 } } } }, // floppy + PC98
-	{ UNK_LANG, kPlatformPC, { 0x000000FF, 0x000047EC, { { 0x0D, 0xA5, 0xFD, 0x8A, 0x33, 0xDB, 0x93, 0x43, 0xE2, 0x57, 0x35, 0xEC, 0xA6, 0xCF, 0x7A, 0xA1 } } } }, // CD
+	{ UNK_LANG, kPlatformUnknown, { 0x0000007F, 0x00001FB8, { { 0xF6, 0xE9, 0x98, 0x79, 0x51, 0xCA, 0xA0, 0x35, 0xE4, 0xD0, 0xA1, 0xCD, 0x23, 0x89, 0x7D, 0x11 } } } },
+	{ UNK_LANG, kPlatformFMTowns, { 0x00000091, 0x00001FB8, { { 0x65, 0x1A, 0x3E, 0x96, 0x96, 0xA9, 0x94, 0xD6, 0xD5, 0x21, 0xBE, 0x60, 0xB5, 0x83, 0xF0, 0xE5 } } } },
 
 	EXTRACT_END_ENTRY
 };
@@ -3680,7 +3698,7 @@ const ExtractEntrySearchData kLoLDscDoorScaleProvider[] = {
 
 const ExtractEntrySearchData kLoLDscDoor4Provider[] = {
 	{ UNK_LANG, kPlatformUnknown, { 0x00000008, 0x00000103, { { 0x29, 0xC0, 0x4B, 0x7F, 0x36, 0x23, 0xBB, 0x38, 0x4C, 0x83, 0xC6, 0x9D, 0xB4, 0x8F, 0x29, 0x2E } } } },
-
+	{ UNK_LANG, kPlatformFMTowns, { 0x00000008, 0x0000000F, { { 0x9C, 0x6B, 0xAF, 0x69, 0x42, 0xC9, 0xC9, 0xA0, 0xD9, 0xF3, 0x54, 0xD9, 0x9A, 0xAF, 0xCF, 0xD8 } } } },
 	EXTRACT_END_ENTRY
 };
 
@@ -3725,55 +3743,56 @@ const ExtractEntrySearchData kLoLButtonDefsProvider[] = {
 	{ UNK_LANG, kPlatformPC, { 0x0000082A, 0x0000C34E, { { 0x7F, 0x9A, 0x0F, 0x28, 0x1A, 0x8F, 0x03, 0x46, 0x48, 0xEB, 0xC9, 0xB9, 0x23, 0x29, 0x5E, 0x50 } } } }, // floppy
 	{ UNK_LANG, kPlatformPC, { 0x0000082A, 0x0000C47B, { { 0xDF, 0x1A, 0x18, 0x1F, 0x58, 0x05, 0x1F, 0x56, 0xD8, 0x6D, 0xBB, 0x93, 0xEC, 0x35, 0x9D, 0xA5 } } } }, // CD
 	{ UNK_LANG, kPlatformPC98, { 0x0000082A, 0x0000AB58, { { 0xDD, 0x2B, 0xA9, 0x54, 0x60, 0x25, 0x2C, 0x74, 0xF8, 0x5D, 0xC6, 0xD2, 0x2C, 0x1A, 0x24, 0x44 } } } },
-
+	{ UNK_LANG, kPlatformFMTowns, { 0x0000082A, 0x0000D271, { { 0xAF, 0xAD, 0x11, 0xF9, 0xDC, 0x41, 0x94, 0xB3, 0x0E, 0x48, 0x69, 0xB3, 0x32, 0x89, 0x7C, 0xDD } } } },
 	EXTRACT_END_ENTRY
 };
 
 const ExtractEntrySearchData kLoLButtonList1Provider[] = {
 	{ UNK_LANG, kPlatformUnknown, { 0x00000050, 0x00000A37, { { 0x0F, 0x73, 0xEC, 0xDD, 0xAB, 0xFF, 0x49, 0x46, 0x5E, 0x8F, 0x0D, 0xC3, 0xE7, 0x1B, 0x89, 0x51 } } } },
+	{ UNK_LANG, kPlatformFMTowns, { 0x00000028, 0x00000938, { { 0x4B, 0xD9, 0x4A, 0x57, 0x58, 0xEC, 0x01, 0xE5, 0xA1, 0x25, 0x6A, 0x1A, 0x9C, 0x5D, 0x79, 0x19 } } } },
 
 	EXTRACT_END_ENTRY
 };
 
 const ExtractEntrySearchData kLoLButtonList2Provider[] = {
 	{ UNK_LANG, kPlatformUnknown, { 0x0000001E, 0x00000522, { { 0xEA, 0x41, 0x46, 0xE2, 0xFE, 0xAA, 0x7D, 0x5E, 0x89, 0x7F, 0xBF, 0x9B, 0x30, 0x60, 0x74, 0xF3 } } } },
-
+	{ UNK_LANG, kPlatformFMTowns, { 0x0000000F, 0x00000423, { { 0xD3, 0xA8, 0xD4, 0xFB, 0x1A, 0x56, 0x21, 0x8C, 0x01, 0xED, 0xF8, 0x54, 0xA9, 0xC5, 0x97, 0x04 } } } },
 	EXTRACT_END_ENTRY
 };
 
 const ExtractEntrySearchData kLoLButtonList3Provider[] = {
 	{ UNK_LANG, kPlatformUnknown, { 0x00000004, 0x0000023E, { { 0x70, 0xAA, 0xCA, 0xAC, 0x5C, 0x21, 0xCF, 0xA5, 0xBF, 0x7F, 0x5F, 0xBC, 0xF1, 0x24, 0x8A, 0xAF } } } },
-
+	{ UNK_LANG, kPlatformFMTowns, { 0x00000002, 0x0000013F, { { 0xDF, 0xE4, 0x3D, 0x18, 0x94, 0x18, 0xA5, 0x74, 0xBA, 0x26, 0x7B, 0x31, 0x87, 0xAE, 0xEE, 0x22 } } } },
 	EXTRACT_END_ENTRY
 };
 
 const ExtractEntrySearchData kLoLButtonList4Provider[] = {
 	{ UNK_LANG, kPlatformUnknown, { 0x0000001E, 0x0000054D, { { 0x19, 0x2A, 0xBE, 0x7F, 0x94, 0x10, 0xA0, 0x60, 0x2A, 0x33, 0xD6, 0x11, 0x85, 0xF0, 0xA4, 0xA9 } } } },
-
+	{ UNK_LANG, kPlatformFMTowns, { 0x0000000F, 0x0000044E, { { 0x18, 0x1E, 0xBB, 0x7D, 0xAC, 0xA1, 0x87, 0x0F, 0x32, 0xA3, 0xBF, 0x5F, 0xBC, 0xBB, 0x90, 0xA4 } } } },
 	EXTRACT_END_ENTRY
 };
 
 const ExtractEntrySearchData kLoLButtonList5Provider[] = {
 	{ UNK_LANG, kPlatformUnknown, { 0x00000020, 0x0000045D, { { 0xE3, 0x7C, 0xC2, 0x36, 0x21, 0x46, 0xDB, 0xF3, 0xDD, 0x38, 0x4B, 0x40, 0xE0, 0x35, 0x09, 0xC3 } } } },
-
+	{ UNK_LANG, kPlatformFMTowns, { 0x00000010, 0x0000035E, { { 0x4E, 0xE2, 0xD6, 0x93, 0xA3, 0xEF, 0xD0, 0xEA, 0x28, 0xE6, 0xE7, 0xDD, 0xFC, 0x44, 0xE2, 0xB9 } } } },
 	EXTRACT_END_ENTRY
 };
 
 const ExtractEntrySearchData kLoLButtonList6Provider[] = {
 	{ UNK_LANG, kPlatformUnknown, { 0x0000001C, 0x000004C4, { { 0x21, 0x7C, 0x29, 0x3F, 0x95, 0x6F, 0x91, 0x8C, 0xB2, 0x30, 0x09, 0xA6, 0x7B, 0x48, 0x44, 0x8F } } } },
-
+	{ UNK_LANG, kPlatformFMTowns, { 0x0000000E, 0x000003C5, { { 0x05, 0x10, 0x83, 0x1E, 0x18, 0x11, 0xC4, 0x43, 0x01, 0xE3, 0xE0, 0xD7, 0x79, 0x29, 0xA5, 0x86 } } } },
 	EXTRACT_END_ENTRY
 };
 
 const ExtractEntrySearchData kLoLButtonList7Provider[] = {
 	{ UNK_LANG, kPlatformUnknown, { 0x00000006, 0x0000021D, { { 0xDC, 0xCE, 0x1B, 0xEB, 0x11, 0x6D, 0xDE, 0x37, 0x17, 0xC8, 0x06, 0x51, 0xC3, 0x0C, 0xCB, 0xA6 } } } },
-
+	{ UNK_LANG, kPlatformFMTowns, { 0x00000003, 0x0000011E, { { 0xCF, 0x37, 0xEF, 0x83, 0xEC, 0x0D, 0x65, 0x41, 0xC8, 0x1D, 0xD1, 0x20, 0x82, 0x6B, 0xB5, 0x9B } } } },
 	EXTRACT_END_ENTRY
 };
 
 const ExtractEntrySearchData kLoLButtonList8Provider[] = {
 	{ UNK_LANG, kPlatformUnknown, { 0x00000004, 0x00000253, { { 0x0C, 0x7B, 0x10, 0x99, 0x93, 0xD0, 0x33, 0xCA, 0xAB, 0x8D, 0x7E, 0x24, 0xE5, 0x7E, 0x6C, 0x91 } } } },
-
+	{ UNK_LANG, kPlatformFMTowns, { 0x00000002, 0x00000154, { { 0xE9, 0x6B, 0x8A, 0xD7, 0x8E, 0xCF, 0x66, 0x07, 0xDC, 0xF1, 0xC0, 0xAA, 0x81, 0x88, 0xB8, 0xB9 } } } },
 	EXTRACT_END_ENTRY
 };
 
@@ -3828,7 +3847,7 @@ const ExtractEntrySearchData kLoLFireballCoordsProvider[] = {
 
 const ExtractEntrySearchData kLoLCreditsProvider[] = {
 	{ JA_JPN , kPlatformPC98, { 0x000005E7, 0x0001A1B0, { { 0x2A, 0xD0, 0x38, 0x84, 0x0C, 0x38, 0xCB, 0x52, 0x5D, 0x82, 0xBE, 0x03, 0x76, 0xFA, 0x0A, 0x4A } } } },
-
+	{ JA_JPN , kPlatformFMTowns, { 0x000005EC, 0x0001A219, { { 0x03, 0xBC, 0x67, 0x19, 0xA1, 0x99, 0x70, 0x10, 0x7A, 0x73, 0x85, 0xDA, 0xB4, 0x59, 0x49, 0xB0 } } } },
 	EXTRACT_END_ENTRY
 };
 
@@ -4377,7 +4396,10 @@ const ExtractEntry extractProviders[] = {
 	{ kLoLCharDefsKieran, kLoLCharDefsKieranProvider },
 	{ kLoLCharDefsAkshel, kLoLCharDefsAkshelProvider },
 	{ kLoLExpRequirements, kLoLExpRequirementsProvider },
-	{ kLoLMonsterModifiers, kLoLMonsterModifiersProvider },
+	{ kLoLMonsterModifiers1, kLoLMonsterModifiers1Provider },
+	{ kLoLMonsterModifiers2, kLoLMonsterModifiers2Provider },
+	{ kLoLMonsterModifiers3, kLoLMonsterModifiers3Provider },
+	{ kLoLMonsterModifiers4, kLoLMonsterModifiers4Provider },
 	{ kLoLMonsterShiftOffsets, kLoLMonsterShiftOffsetsProvider },
 	{ kLoLMonsterDirFlags, kLoLMonsterDirFlagsProvider },
 	{ kLoLMonsterScaleY, kLoLMonsterScaleYProvider },
diff --git a/dists/engine-data/kyra.dat b/dists/engine-data/kyra.dat
index 339b856..305c7e6 100644
Binary files a/dists/engine-data/kyra.dat and b/dists/engine-data/kyra.dat differ
diff --git a/engines/kyra/eobcommon.h b/engines/kyra/eobcommon.h
index e42130c..70200d3 100644
--- a/engines/kyra/eobcommon.h
+++ b/engines/kyra/eobcommon.h
@@ -722,21 +722,21 @@ protected:
 	void gui_processWeaponSlotClickRight(int charIndex, int slotIndex);
 	void gui_processInventorySlotClick(int slot);
 
-	static const int16 _buttonList1[];
+	static const uint8 _buttonList1[];
 	int _buttonList1Size;
-	static const int16 _buttonList2[];
+	static const uint8 _buttonList2[];
 	int _buttonList2Size;
-	static const int16 _buttonList3[];
+	static const uint8 _buttonList3[];
 	int _buttonList3Size;
-	static const int16 _buttonList4[];
+	static const uint8 _buttonList4[];
 	int _buttonList4Size;
-	static const int16 _buttonList5[];
+	static const uint8 _buttonList5[];
 	int _buttonList5Size;
-	static const int16 _buttonList6[];
+	static const uint8 _buttonList6[];
 	int _buttonList6Size;
-	static const int16 _buttonList7[];
+	static const uint8 _buttonList7[];
 	int _buttonList7Size;
-	static const int16 _buttonList8[];
+	static const uint8 _buttonList8[];
 	int _buttonList8Size;
 
 	const EoBGuiButtonDef *_buttonDefs;
diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp
index 8b95230..38478aa 100644
--- a/engines/kyra/gui_lol.cpp
+++ b/engines/kyra/gui_lol.cpp
@@ -322,7 +322,7 @@ void LoLEngine::gui_changeCharacterStats(int charNum) {
 
 void LoLEngine::gui_drawCharInventoryItem(int itemIndex) {
 	static const uint8 slotShapes[] = { 0x30, 0x34, 0x30, 0x34, 0x2E, 0x2F, 0x32, 0x33, 0x31, 0x35, 0x35 };
-
+	//2Eh, 32h, 2Eh, 32h, 2Ch, 2Dh, 30h, 31h, 2Fh, 33h, 33h
 	const uint8 *coords = &_charInvDefs[_charInvIndex[_characters[_selectedCharacter].raceClassSex] * 22 + itemIndex * 2];
 	uint8 x = *coords++;
 	uint8 y = *coords;
diff --git a/engines/kyra/gui_rpg.cpp b/engines/kyra/gui_rpg.cpp
index 71c1d1d..ab25f95 100644
--- a/engines/kyra/gui_rpg.cpp
+++ b/engines/kyra/gui_rpg.cpp
@@ -76,8 +76,8 @@ void KyraRpgEngine::gui_drawHorizontalBarGraph(int x, int y, int w, int h, int32
 		screen()->fillRect(x + t, y, x + w - 1, y + h, col2);
 }
 
-void KyraRpgEngine::gui_initButtonsFromList(const int16 *list) {
-	while (*list != -1)
+void KyraRpgEngine::gui_initButtonsFromList(const uint8 *list) {
+	while (*list != 0xFF)
 		gui_initButton(*list++);
 }
 
diff --git a/engines/kyra/kyra_rpg.h b/engines/kyra/kyra_rpg.h
index 2615875..cd36d2a 100644
--- a/engines/kyra/kyra_rpg.h
+++ b/engines/kyra/kyra_rpg.h
@@ -283,7 +283,7 @@ protected:
 	void removeInputTop();
 	void gui_drawBox(int x, int y, int w, int h, int frameColor1, int frameColor2, int fillColor);
 	virtual void gui_drawHorizontalBarGraph(int x, int y, int w, int h, int32 curVal, int32 maxVal, int col1, int col2);
-	void gui_initButtonsFromList(const int16 *list);
+	void gui_initButtonsFromList(const uint8 *list);
 	virtual void gui_initButton(int index, int x = -1, int y = -1, int val = -1) = 0;
 	void gui_resetButtonList();
 	void gui_notifyButtonListChanged();
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index aa4e7a2..d1da375 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -3356,7 +3356,9 @@ int LoLEngine::battleHitSkillTest(int16 attacker, int16 target, int skill) {
 	}
 
 	if (target & 0x8000) {
-		evadeChanceModifier = (_monsterModifiers[9 + _monsterDifficulty] * _monsters[target & 0x7FFF].properties->fightingStats[3]) >> 8;
+		evadeChanceModifier = _monsters[target & 0x7FFF].properties->fightingStats[3];
+		if (_monsterModifiers4)
+			evadeChanceModifier = (evadeChanceModifier * _monsterModifiers4[_monsterDifficulty]) >> 8;
 		_monsters[target & 0x7FFF].flags |= 0x10;
 	} else {
 		evadeChanceModifier = _characters[target].defaultModifiers[3];
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index d8df6b6..9a251f0 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -558,14 +558,14 @@ private:
 	int clickedStatusIcon(Button *button);
 
 	const LoLButtonDef *_buttonData;
-	const int16 *_buttonList1;
-	const int16 *_buttonList2;
-	const int16 *_buttonList3;
-	const int16 *_buttonList4;
-	const int16 *_buttonList5;
-	const int16 *_buttonList6;
-	const int16 *_buttonList7;
-	const int16 *_buttonList8;
+	const uint8 *_buttonList1;
+	const uint8 *_buttonList2;
+	const uint8 *_buttonList3;
+	const uint8 *_buttonList4;
+	const uint8 *_buttonList5;
+	const uint8 *_buttonList6;
+	const uint8 *_buttonList7;
+	const uint8 *_buttonList8;
 
 	// text
 	int characterSays(int track, int charId, bool redraw);
@@ -1137,7 +1137,11 @@ private:
 	uint16 _monsterCurBlock;
 	int _objectLastDirection;
 
-	const uint16 *_monsterModifiers;
+	const uint16 *_monsterModifiers1;
+	const uint16 *_monsterModifiers2;
+	const uint16 *_monsterModifiers3;
+	const uint16 *_monsterModifiers4;
+
 	const int8 *_monsterShiftOffs;
 	const uint8 *_monsterDirFlags;
 	const uint8 *_monsterScaleX;
diff --git a/engines/kyra/resource.h b/engines/kyra/resource.h
index 5364cce..5c179a7 100644
--- a/engines/kyra/resource.h
+++ b/engines/kyra/resource.h
@@ -679,7 +679,10 @@ enum KyraResources {
 	kLoLCharDefsKieran,
 	kLoLCharDefsAkshel,
 	kLoLExpRequirements,
-	kLoLMonsterModifiers,
+	kLoLMonsterModifiers1,
+	kLoLMonsterModifiers2,
+	kLoLMonsterModifiers3,
+	kLoLMonsterModifiers4,
 	kLoLMonsterShiftOffsets,
 	kLoLMonsterDirFlags,
 	kLoLMonsterScaleY,
diff --git a/engines/kyra/saveload_lol.cpp b/engines/kyra/saveload_lol.cpp
index 58e3d94..6c83ebd 100644
--- a/engines/kyra/saveload_lol.cpp
+++ b/engines/kyra/saveload_lol.cpp
@@ -547,7 +547,7 @@ void LoLEngine::restoreTempDataAdjustMonsterStrength(int index) {
 	if (_lvlTempData[index]->monsterDifficulty == _monsterDifficulty)
 		return;
 
-	uint16 d = (_monsterModifiers[_lvlTempData[index]->monsterDifficulty] << 8) / _monsterModifiers[_monsterDifficulty];
+	uint16 d = (_monsterModifiers1[_lvlTempData[index]->monsterDifficulty] << 8) / _monsterModifiers1[_monsterDifficulty];
 
 	for (int i = 0; i < 30; i++) {
 		if (_monsters[i].mode >= 14 || _monsters[i].block == 0 || _monsters[i].hitPoints <= 0)
diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp
index e9fc1c7..0bbe66f 100644
--- a/engines/kyra/script_lol.cpp
+++ b/engines/kyra/script_lol.cpp
@@ -823,7 +823,7 @@ int LoLEngine::olol_initMonster(EMCState *script) {
 		l->type = stackPos(4);
 		l->properties = &_monsterProperties[l->type];
 		l->direction = l->facing << 1;
-		l->hitPoints = (l->properties->hitPoints * _monsterModifiers[_monsterDifficulty]) >> 8;
+		l->hitPoints = (l->properties->hitPoints * _monsterModifiers1[_monsterDifficulty]) >> 8;
 
 		if (_currentLevel != 12 || l->type != 2)
 			l->hitPoints = (l->hitPoints * (rollDice(1, 128) + 192)) >> 8;
diff --git a/engines/kyra/sequences_lol.cpp b/engines/kyra/sequences_lol.cpp
index 3ff25d9..7cdcc98 100644
--- a/engines/kyra/sequences_lol.cpp
+++ b/engines/kyra/sequences_lol.cpp
@@ -145,7 +145,12 @@ void LoLEngine::setupPrologueData(bool load) {
 	static const char *const fileListFloppy[] = {
 		"INTRO.PAK", "INTROVOC.PAK", 0
 	};
-	const char *const *fileList = _flags.isTalkie ? fileListCD : fileListFloppy;
+
+	static const char *const fileListTowns[] = {
+		"INTRO.PAK", "TINTROVO.PAK", 0
+	};
+
+	const char *const *fileList = _flags.isTalkie ? fileListCD : (_flags.platform == Common::kPlatformFMTowns ? fileListTowns : fileListFloppy);
 
 	char filename[32];
 	for (uint i = 0; fileList[i]; ++i) {
@@ -1015,7 +1020,11 @@ void LoLEngine::setupEpilogueData(bool load) {
 		"GENERAL.PAK", "INTRO.PAK", "FINALE1.PAK", "FINALE2.PAK", 0
 	};
 
-	const char *const *fileList = _flags.isTalkie ? fileListCD : fileListFloppy;
+	static const char *const fileListTowns[] = {
+		"GENERAL.PAK", "INTRO.PAK", "FINALE1.PAK", "TFINALE2.PAK", 0
+	};
+
+	const char *const *fileList = _flags.isTalkie ? fileListCD : (_flags.platform == Common::kPlatformFMTowns ? fileListTowns : fileListFloppy);
 	assert(fileList);
 
 	char filename[32];
diff --git a/engines/kyra/sprites_lol.cpp b/engines/kyra/sprites_lol.cpp
index 9b602d9..88b24e1 100644
--- a/engines/kyra/sprites_lol.cpp
+++ b/engines/kyra/sprites_lol.cpp
@@ -481,19 +481,8 @@ int LoLEngine::calcMonsterSkillLevel(int id, int a) {
 	const uint16 *c = getCharacterOrMonsterStats(id);
 	int r = (a << 8) / c[4];
 
-	/*
-	if (!(id & 0x8000))
-		r = (r * _monsterModifiers[3 + _monsterDifficulty]) >> 8;
-
-	id &= 0x7FFF;
-
-	if (_characters[id].skillLevels[1] <= 3)
-		return r;
-	else if (_characters[id].skillLevels[1] <= 7)
-		return (r- (r >> 2));*/
-
 	if (id & 0x8000) {
-		r = (r * _monsterModifiers[3 + _monsterDifficulty]) >> 8;
+		r = (r * _monsterModifiers2[3 + _monsterDifficulty]) >> 8;
 	} else {
 		if (_characters[id].skillLevels[1] > 7)
 			r = (r - (r >> 1));
@@ -708,7 +697,9 @@ int LoLEngine::getMonsterCurFrame(LoLMonster *m, uint16 dirFlags) {
 		break;
 	case 1:
 		// monsters whose outward appearance reflects the damage they have taken
-		tmp = (m->properties->hitPoints * _monsterModifiers[_monsterDifficulty]) >> 8;
+		tmp = m->properties->hitPoints;
+		if (_flags.isTalkie)
+			tmp = (tmp * _monsterModifiers1[_monsterDifficulty]) >> 8;
 		if (m->hitPoints > (tmp >> 1))
 			tmp = 0;
 		else if (m->hitPoints > (tmp >> 2))
@@ -1127,7 +1118,7 @@ void LoLEngine::updateMonster(LoLMonster *monster) {
 		// first recovery phase after delivering an attack
 		if (++monster->fightCurTick > 2) {
 			setMonsterMode(monster, 5);
-			monster->fightCurTick = (int8)((((8 << 8) / monster->properties->fightingStats[4]) * _monsterModifiers[6 + _monsterDifficulty]) >> 8);
+			monster->fightCurTick = (int8)((((8 << 8) / monster->properties->fightingStats[4]) * _monsterModifiers3[_monsterDifficulty]) >> 8);
 		}
 		checkSceneUpdateNeed(monster->block);
 		break;
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index 38481d9..bac31f0 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -39,7 +39,7 @@
 
 namespace Kyra {
 
-#define RESFILE_VERSION 83
+#define RESFILE_VERSION 84
 
 namespace {
 bool checkKyraDat(Common::SeekableReadStream *file) {
diff --git a/engines/kyra/staticres_eob.cpp b/engines/kyra/staticres_eob.cpp
index 872ab40..e0a2862 100644
--- a/engines/kyra/staticres_eob.cpp
+++ b/engines/kyra/staticres_eob.cpp
@@ -220,44 +220,44 @@ const uint8 EoBCoreEngine::_wallOfForceShapeDefs[] = {
 	0x0C, 0x00, 0x05, 0x10
 };
 
-const int16 EoBCoreEngine::_buttonList1[] = {
+const uint8 EoBCoreEngine::_buttonList1[] = {
 	58, 0, 1, 2, 3, 90, 91, 4, 5, 6, 7, 8, 9, 10, 11, 12, 78, 79, 13, 14,  15,  16,
-	80, 81, 17, 18, 19, 20, 82, 83, 49, 50, 51, 52, 53, 54, 56, 57, -1
+	80, 81, 17, 18, 19, 20, 82, 83, 49, 50, 51, 52, 53, 54, 56, 57, 255
 };
 
-const int16 EoBCoreEngine::_buttonList2[] = {
+const uint8 EoBCoreEngine::_buttonList2[] = {
 	58, 61, 62, 63, 64, 65, 93, 94, 66, 67, 68, 69, 70, 71, 76, 77, 88, 0, 1, 2, 3,
 	90, 91,  4,  5, 6, 7, 8, 9, 10, 11, 12, 78, 79, 13, 14, 15, 16, 80, 81, 17, 18,
-	19, 20, 82, 83, 49, 50, 51, 52, 53, 54, 56, 57, -1
+	19, 20, 82, 83, 49, 50, 51, 52, 53, 54, 56, 57, 255
 };
 
-const int16 EoBCoreEngine::_buttonList3[] = {
+const uint8 EoBCoreEngine::_buttonList3[] = {
 	58, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
 	40, 41, 42, 43, 44, 45, 84, 85, 46, 47, 48, 60, 59, 92, 4, 5, 6, 7, 8, 49,  50,
-	51, 52, 53, 54, 56, 57, -1
+	51, 52, 53, 54, 56, 57, 255
 };
 
-const int16 EoBCoreEngine::_buttonList4[] = {
-	58, 47, 48, 60, 59, 92, 4, 5, 6, 7, 8, 49, 50, 51, 52, 53, 54, 56, 57, -1
+const uint8 EoBCoreEngine::_buttonList4[] = {
+	58, 47, 48, 60, 59, 92, 4, 5, 6, 7, 8, 49, 50, 51, 52, 53, 54, 56, 57, 255
 };
 
-const int16 EoBCoreEngine::_buttonList5[] = {
+const uint8 EoBCoreEngine::_buttonList5[] = {
 	58, 61, 62, 63, 64, 65, 93, 66, 67, 68, 69, 70, 71, 88, 21, 22, 23, 24, 25, 26,
 	27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 84,
-	85, 46, 47, 48, 60, 59, 92, 4, 5, 6, 7, 8, 49, 50, 51, 52, 53, 54, 56, 57, -1
+	85, 46, 47, 48, 60, 59, 92, 4, 5, 6, 7, 8, 49, 50, 51, 52, 53, 54, 56, 57, 255
 };
 
-const int16 EoBCoreEngine::_buttonList6[] = {
+const uint8 EoBCoreEngine::_buttonList6[] = {
 	58, 61, 62, 63, 64, 65, 93, 66, 67, 68, 69, 70, 71, 88, 46, 47, 48, 60, 59, 92,
-	4, 5, 6, 7, 8, 49, 50, 51, 52, 53, 54, 56, 57, -1
+	4, 5, 6, 7, 8, 49, 50, 51, 52, 53, 54, 56, 57, 255
 };
 
-const int16 EoBCoreEngine::_buttonList7[] = {
-	17, 18, 19, 20, 82, 83, 55, -1
+const uint8 EoBCoreEngine::_buttonList7[] = {
+	17, 18, 19, 20, 82, 83, 55, 255
 };
 
-const int16 EoBCoreEngine::_buttonList8[] = {
-	72, 73, 74, 75, 86, 87, 89, -1
+const uint8 EoBCoreEngine::_buttonList8[] = {
+	72, 73, 74, 75, 86, 87, 89, 255
 };
 
 const uint8 EoBCoreEngine::_clock2Timers[] = {
diff --git a/engines/kyra/staticres_lol.cpp b/engines/kyra/staticres_lol.cpp
index 6b30645..ff104bf 100644
--- a/engines/kyra/staticres_lol.cpp
+++ b/engines/kyra/staticres_lol.cpp
@@ -261,7 +261,10 @@ void LoLEngine::initStaticResource() {
 	_charDefsKieran = _staticres->loadRawDataBe16(kLoLCharDefsKieran, tempSize);
 	_charDefsAkshel = _staticres->loadRawDataBe16(kLoLCharDefsAkshel, tempSize);
 	_expRequirements = (const int32 *)_staticres->loadRawDataBe32(kLoLExpRequirements, tempSize);
-	_monsterModifiers = _staticres->loadRawDataBe16(kLoLMonsterModifiers, tempSize);
+	_monsterModifiers1 = _staticres->loadRawDataBe16(kLoLMonsterModifiers1, tempSize);
+	_monsterModifiers2 = _staticres->loadRawDataBe16(kLoLMonsterModifiers2, tempSize);
+	_monsterModifiers3 = _staticres->loadRawDataBe16(kLoLMonsterModifiers3, tempSize);
+	_monsterModifiers4 = _staticres->loadRawDataBe16(kLoLMonsterModifiers4, tempSize);
 	_monsterShiftOffs = (const int8 *)_staticres->loadRawData(kLoLMonsterShiftOffsets, tempSize);
 	_monsterDirFlags = _staticres->loadRawData(kLoLMonsterDirFlags, tempSize);
 	_monsterScaleX = _staticres->loadRawData(kLoLMonsterScaleX, tempSize);
@@ -304,14 +307,14 @@ void LoLEngine::initStaticResource() {
 	}
 
 	_buttonData = _staticres->loadButtonDefs(kLoLButtonDefs, tempSize);
-	_buttonList1 = (const int16 *)_staticres->loadRawDataBe16(kLoLButtonList1, tempSize);
-	_buttonList2 = (const int16 *)_staticres->loadRawDataBe16(kLoLButtonList2, tempSize);
-	_buttonList3 = (const int16 *)_staticres->loadRawDataBe16(kLoLButtonList3, tempSize);
-	_buttonList4 = (const int16 *)_staticres->loadRawDataBe16(kLoLButtonList4, tempSize);
-	_buttonList5 = (const int16 *)_staticres->loadRawDataBe16(kLoLButtonList5, tempSize);
-	_buttonList6 = (const int16 *)_staticres->loadRawDataBe16(kLoLButtonList6, tempSize);
-	_buttonList7 = (const int16 *)_staticres->loadRawDataBe16(kLoLButtonList7, tempSize);
-	_buttonList8 = (const int16 *)_staticres->loadRawDataBe16(kLoLButtonList8, tempSize);
+	_buttonList1 = _staticres->loadRawData(kLoLButtonList1, tempSize);
+	_buttonList2 = _staticres->loadRawData(kLoLButtonList2, tempSize);
+	_buttonList3 = _staticres->loadRawData(kLoLButtonList3, tempSize);
+	_buttonList4 = _staticres->loadRawData(kLoLButtonList4, tempSize);
+	_buttonList5 = _staticres->loadRawData(kLoLButtonList5, tempSize);
+	_buttonList6 = _staticres->loadRawData(kLoLButtonList6, tempSize);
+	_buttonList7 = _staticres->loadRawData(kLoLButtonList7, tempSize);
+	_buttonList8 = _staticres->loadRawData(kLoLButtonList8, tempSize);
 
 	_autoMapStrings = _staticres->loadRawDataBe16(kLoLMapStringId, tempSize);
 


Commit: da3c385ee397ea9592a9b5f900487a7bdfb6e5c9
    https://github.com/scummvm/scummvm/commit/da3c385ee397ea9592a9b5f900487a7bdfb6e5c9
Author: athrxx (athrxx at scummvm.org)
Date: 2013-01-09T11:27:37-08:00

Commit Message:
KYRA: (LOL/FM-TOWNS) some startup code

(let the FM-Towns version load up and run without errors/crashes)

Changed paths:
    engines/kyra/lol.cpp
    engines/kyra/lol.h
    engines/kyra/sequences_lol.cpp
    engines/kyra/sound_lol.cpp
    engines/kyra/sound_towns.cpp
    engines/kyra/staticres_lol.cpp



diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index d1da375..1906591 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -933,7 +933,7 @@ void LoLEngine::writeSettings() {
 
 	case 0:
 	default:
-		if (_flags.platform == Common::kPlatformPC98)
+		if (_flags.platform == Common::kPlatformPC98 || _flags.platform == Common::kPlatformFMTowns)
 			_flags.lang = Common::JA_JPN;
 		else
 			_flags.lang = Common::EN_ANY;
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index 9a251f0..4002346 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -336,9 +336,9 @@ private:
 	static const char *const _charPreviewNamesDefault[];
 	static const char *const _charPreviewNamesRussianFloppy[];
 
-	// PC98 specific data
+	// PC98/FM-TOWNS specific data
 	static const uint16 _charPosXPC98[];
-	static const uint8 _charNamesPC98[][11];
+	static const char *const _charNamesJapanese[];
 
 	WSAMovie_v2 *_chargenWSA;
 	static const uint8 _chargenFrameTableTalkie[];
diff --git a/engines/kyra/sequences_lol.cpp b/engines/kyra/sequences_lol.cpp
index 7cdcc98..b319bfa 100644
--- a/engines/kyra/sequences_lol.cpp
+++ b/engines/kyra/sequences_lol.cpp
@@ -315,7 +315,7 @@ int LoLEngine::chooseCharacter() {
 		_screen->_curPage = 2;
 
 		for (int i = 0; i < 4; ++i) {
-			_screen->printText((const char *)_charNamesPC98[i], _charPosXPC98[i], 168, 0xC1, 0x00);
+			_screen->printText(_charNamesJapanese[i], _charPosXPC98[i], 168, 0xC1, 0x00);
 
 			Screen::FontId old = _screen->setFont(Screen::FID_SJIS_FNT);
 			for (int j = 0; j < 3; ++j) {
@@ -329,7 +329,7 @@ int LoLEngine::chooseCharacter() {
 		_screen->printText(_tim->getCTableEntry(53), 72, 184, 0x81, 0x00);
 		_screen->printText(_tim->getCTableEntry(55), 72, 192, 0x81, 0x00);
 	} else {
-		const char *const *previewNames = (_flags.lang == Common::RU_RUS && !_flags.isTalkie) ? _charPreviewNamesRussianFloppy : _charPreviewNamesDefault;
+		const char *const *previewNames = (_flags.lang == Common::RU_RUS && !_flags.isTalkie) ? _charPreviewNamesRussianFloppy : (_flags.lang == Common::JA_JPN ? _charNamesJapanese : _charPreviewNamesDefault);
 		for (int i = 0; i < 4; ++i) {
 			_screen->fprintStringIntro("%s", _charPreviews[i].x + 16, _charPreviews[i].y + 36, 0xC0, 0x00, 0x9C, 0x120, previewNames[i]);
 			_screen->fprintStringIntro("%d", _charPreviews[i].x + 21, _charPreviews[i].y + 48, 0x98, 0x00, 0x9C, 0x220, _charPreviews[i].attrib[0]);
diff --git a/engines/kyra/sound_lol.cpp b/engines/kyra/sound_lol.cpp
index 02ea3f4..41f59be 100644
--- a/engines/kyra/sound_lol.cpp
+++ b/engines/kyra/sound_lol.cpp
@@ -247,7 +247,7 @@ void LoLEngine::snd_playQueuedEffects() {
 
 void LoLEngine::snd_loadSoundFile(int track) {
 	if (_sound->musicEnabled()) {
-		if (_flags.platform != Common::kPlatformPC98) {
+		if (_flags.platform == Common::kPlatformPC) {
 			int t = (track - 250) * 3;
 			if (_curMusicFileIndex != _musicTrackMap[t] || _curMusicFileExt != (char)_musicTrackMap[t + 1]) {
 				snd_stopMusic();
@@ -269,12 +269,12 @@ int LoLEngine::snd_playTrack(int track) {
 	_lastMusicTrack = track;
 
 	if (_sound->musicEnabled()) {
-		if (_flags.platform == Common::kPlatformPC98) {
-			_sound->playTrack(track - 249);
-		} else {
+		if (_flags.platform == Common::kPlatformPC) {
 			snd_loadSoundFile(track);
 			int t = (track - 250) * 3;
 			_sound->playTrack(_musicTrackMap[t + 2]);
+		} else {			
+			_sound->playTrack(track - 249);
 		}
 	}
 
diff --git a/engines/kyra/sound_towns.cpp b/engines/kyra/sound_towns.cpp
index aff3e0f..af741a1 100644
--- a/engines/kyra/sound_towns.cpp
+++ b/engines/kyra/sound_towns.cpp
@@ -525,7 +525,9 @@ bool SoundTownsPC98_v2::init() {
 		TownsPC98_AudioDriver::kType86 : TownsPC98_AudioDriver::kTypeTowns);
 
 	if (_vm->gameFlags().platform == Common::kPlatformFMTowns) {
-		_vm->checkCD();
+		if (_resInfo[_currentResourceSet])
+			if (_resInfo[_currentResourceSet]->cdaTableSize)
+				_vm->checkCD();
 		// FIXME: While checking for 'track1.XXX(X)' looks like
 		// a good idea, we should definitely not be doing this
 		// here. Basically our filenaming scheme could change
diff --git a/engines/kyra/staticres_lol.cpp b/engines/kyra/staticres_lol.cpp
index ff104bf..a1c5ff3 100644
--- a/engines/kyra/staticres_lol.cpp
+++ b/engines/kyra/staticres_lol.cpp
@@ -238,6 +238,15 @@ void LoLEngine::initStaticResource() {
 		_sound->initAudioResourceInfo(kMusicIntro, &resInfoIntro);
 		_sound->initAudioResourceInfo(kMusicIngame, &resInfoIngame);
 		_sound->initAudioResourceInfo(kMusicFinale, &resInfoFinale);
+	} else if (_flags.platform == Common::kPlatformFMTowns) {
+		static const char *const fileListIntro[] = { 0, "lore84.twn", "lore82.twn", 0, 0, 0, "lore83.twn", "lore81.twn" };
+		static const char *const fileListFinale[] = { 0, 0, "lore85.twn", "lore86.twn", "lore87.twn" };
+		SoundResourceInfo_TownsPC98V2 resInfoIntro(fileListIntro, ARRAYSIZE(fileListIntro), 0, 0, 0);
+		SoundResourceInfo_TownsPC98V2 resInfoIngame(0, 0, "lore%02d.twn", 0, 0);
+		SoundResourceInfo_TownsPC98V2 resInfoFinale(fileListFinale, ARRAYSIZE(fileListFinale), 0, 0, 0);
+		_sound->initAudioResourceInfo(kMusicIntro, &resInfoIntro);
+		_sound->initAudioResourceInfo(kMusicIngame, &resInfoIngame);
+		_sound->initAudioResourceInfo(kMusicFinale, &resInfoFinale);
 	}
 
 	if (_flags.isDemo)
@@ -662,11 +671,11 @@ const uint16 LoLEngine::_charPosXPC98[] = {
 	92, 152, 212, 268
 };
 
-const uint8 LoLEngine::_charNamesPC98[][11] = {
-	{ 0x83, 0x41, 0x83, 0x4E, 0x83, 0x56, 0x83, 0x46, 0x83, 0x8B, 0x00 },
-	{ 0x83, 0x7D, 0x83, 0x43, 0x83, 0x50, 0x83, 0x8B, 0x00, 0x00, 0x00 },
-	{ 0x83, 0x4C, 0x81, 0x5B, 0x83, 0x89, 0x83, 0x93, 0x00, 0x00, 0x00 },
-	{ 0x83, 0x52, 0x83, 0x93, 0x83, 0x89, 0x83, 0x62, 0x83, 0x68, 0x00 }
+const char *const LoLEngine::_charNamesJapanese[] = {
+	"\x83\x41\x83\x4E\x83\x56\x83\x46\x83\x8B\0",
+	"\x83\x7D\x83\x43\x83\x50\x83\x8B\x00\x00\0",
+	"\x83\x4C\x81\x5B\x83\x89\x83\x93\x00\x00\0",
+	"\x83\x52\x83\x93\x83\x89\x83\x62\x83\x68\0"
 };
 
 const uint8 LoLEngine::_chargenFrameTableTalkie[] = {


Commit: 0b38615a431582f499f28da3b038f12e0c216c56
    https://github.com/scummvm/scummvm/commit/0b38615a431582f499f28da3b038f12e0c216c56
Author: athrxx (athrxx at scummvm.org)
Date: 2013-01-09T11:29:19-08:00

Commit Message:
KYRA: (LOL/FM-TOWNS) - adjust sjis font settings, spacing, etc.

Changed paths:
    engines/kyra/gui_lol.cpp
    engines/kyra/kyra_rpg.cpp
    engines/kyra/lol.cpp
    engines/kyra/screen.cpp
    engines/kyra/screen.h
    engines/kyra/script_tim.cpp
    engines/kyra/sequences_lol.cpp
    engines/kyra/text_lol.cpp
    engines/kyra/text_rpg.cpp



diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp
index 38478aa..f7a5386 100644
--- a/engines/kyra/gui_lol.cpp
+++ b/engines/kyra/gui_lol.cpp
@@ -274,7 +274,7 @@ void LoLEngine::gui_printCharacterStats(int index, int redraw, int value) {
 	if (offs)
 		_screen->copyRegion(294, y, 182 + offs, y, 18, 8, 6, _screen->_curPage, Screen::CR_NO_P_CHECK);
 
-	Screen::FontId of = _flags.use16ColorMode ? _screen->setFont(Screen::FID_SJIS_FNT) : _screen->_currentFont;
+	Screen::FontId of = (_flags.lang == Common::JA_JPN && _flags.use16ColorMode) ? _screen->setFont(Screen::FID_SJIS_FNT) : _screen->_currentFont;
 	_screen->fprintString("%d", 200 + offs, y, col, 0, _flags.use16ColorMode ? 2 : 6, value);
 	_screen->setFont(of);
 }
diff --git a/engines/kyra/kyra_rpg.cpp b/engines/kyra/kyra_rpg.cpp
index 1365411..67d27de 100644
--- a/engines/kyra/kyra_rpg.cpp
+++ b/engines/kyra/kyra_rpg.cpp
@@ -204,7 +204,7 @@ bool KyraRpgEngine::posWithinRect(int posX, int posY, int x1, int y1, int x2, in
 
 void KyraRpgEngine::drawDialogueButtons() {
 	int cp = screen()->setCurPage(0);
-	Screen::FontId of = screen()->setFont(gameFlags().use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT);
+	Screen::FontId of = screen()->setFont(gameFlags().lang == Common::JA_JPN && gameFlags().use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT);
 
 	for (int i = 0; i < _dialogueNumButtons; i++) {
 		int x = _dialogueButtonPosX[i];
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 1906591..e9faa9d 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -524,7 +524,7 @@ Common::Error LoLEngine::go() {
 	// the prologue code we need to setup them manually here.
 	if (_gameToLoad != -1 && action != 3) {
 		preInit();
-		_screen->setFont(_flags.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT);
+		_screen->setFont((_flags.lang == Common::JA_JPN && _flags.use16ColorMode) ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT);
 	}
 
 	// We have three sound.dat files, one for the intro, one for the
@@ -683,14 +683,21 @@ int LoLEngine::mainMenu() {
 	bool hasSave = saveFileLoadable(0);
 
 	MainMenu::StaticData data[] = {
-		// 256 color mode
+		// 256 color ASCII mode
 		{
 			{ 0, 0, 0, 0, 0 },
 			{ 0x01, 0x04, 0x0C, 0x04, 0x00, 0x3D, 0x9F },
 			{ 0x2C, 0x19, 0x48, 0x2C },
 			Screen::FID_9_FNT, 1
 		},
-		// 16 color mode
+		// 256 color SJIS mode
+		{
+			{ 0, 0, 0, 0, 0 },
+			{ 0x01, 0x04, 0x0C, 0x04, 0x00, 0x3D, 0x9F },
+			{ 0x2C, 0x19, 0x48, 0x2C },
+			Screen::FID_9_FNT, 1
+		},
+		// 16 color SJIS mode
 		{
 			{ 0, 0, 0, 0, 0 },
 			{ 0x01, 0x04, 0x0C, 0x04, 0x00, 0xC1, 0xE1 },
@@ -699,7 +706,7 @@ int LoLEngine::mainMenu() {
 		}
 	};
 
-	int dataIndex = _flags.use16ColorMode ? 1 : 0;
+	int dataIndex = (_flags.lang == Common::JA_JPN) ? (_flags.use16ColorMode ? 2 : 1) : 0;
 
 	if (!_flags.isTalkie)
 		--data[dataIndex].menuTable[3];
@@ -4191,7 +4198,7 @@ void LoLEngine::drawMapPage(int pageNum) {
 			_screen->copyRegion(236, 16, 236 + xOffset, 16, -xOffset, 1, pageNum, pageNum, Screen::CR_NO_P_CHECK);
 
 		int cp = _screen->setCurPage(pageNum);
-		Screen::FontId of = _screen->setFont(_flags.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT);
+		Screen::FontId of = _screen->setFont((_flags.lang == Common::JA_JPN && _flags.use16ColorMode) ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT);
 		_screen->printText(getLangString(_autoMapStrings[_currentMapLevel]), 236 + xOffset, 8, 1, 0);
 		uint16 blX = mapGetStartPosX();
 		uint16 bl = (mapGetStartPosY() << 5) + blX;
@@ -4251,7 +4258,7 @@ void LoLEngine::drawMapPage(int pageNum) {
 		_screen->setFont(of);
 		_screen->setCurPage(cp);
 
-		of = _screen->setFont(_flags.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT);
+		of = _screen->setFont((_flags.lang == Common::JA_JPN && _flags.use16ColorMode) ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT);
 
 		int tY = 0;
 		sx = mapGetStartPosX();
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp
index 5dd7cfb..419b630 100644
--- a/engines/kyra/screen.cpp
+++ b/engines/kyra/screen.cpp
@@ -56,6 +56,7 @@ Screen::Screen(KyraEngine_v1 *vm, OSystem *system, const ScreenDim *dimTable, co
 		_pageMapping[i] = i & ~1;
 
 	_renderMode = Common::kRenderDefault;
+	_sjisMixedFontMode = false;
 
 	_currentFont = FID_8_FNT;
 	_paletteChanged = true;
@@ -124,6 +125,7 @@ bool Screen::init() {
 	if (_useOverlays) {
 		_useSJIS = (_vm->gameFlags().lang == Common::JA_JPN);
 		_sjisInvisibleColor = (_vm->game() == GI_KYRA1) ? 0x80 : 0xF6;
+		_sjisMixedFontMode = !_use16ColorMode;
 
 		for (int i = 0; i < SCREEN_OVLS_NUM; ++i) {
 			if (!_sjisOverlayPtrs[i]) {
@@ -139,7 +141,7 @@ bool Screen::init() {
 			if (!font)
 				error("Could not load any SJIS font, neither the original nor ScummVM's 'SJIS.FNT'");
 
-			_fonts[FID_SJIS_FNT] = new SJISFont(font, _sjisInvisibleColor, _use16ColorMode, !_use16ColorMode);
+			_fonts[FID_SJIS_FNT] = new SJISFont(font, _sjisInvisibleColor, _use16ColorMode, !_use16ColorMode && _vm->game() != GI_LOL, _vm->game() == GI_LOL ? 1 : 0);
 		}
 	}
 
@@ -1246,11 +1248,16 @@ int Screen::getCharWidth(uint16 c) const {
 	return width + ((_currentFont != FID_SJIS_FNT) ? _charWidth : 0);
 }
 
-int Screen::getTextWidth(const char *str) const {
+int Screen::getTextWidth(const char *str) {
 	int curLineLen = 0;
 	int maxLineLen = 0;
 
+	FontId curFont = _currentFont;
+
 	while (1) {
+		if (_sjisMixedFontMode)
+			setFont(*str < 0 ? FID_SJIS_FNT : curFont);
+
 		uint c = fetchChar(str);
 
 		if (c == 0) {
@@ -1274,7 +1281,7 @@ void Screen::printText(const char *str, int x, int y, uint8 color1, uint8 color2
 	cmap[1] = color1;
 	setTextColor(cmap, 0, 1);
 
-	const uint8 charHeightFnt = getFontHeight();
+	FontId curFont = _currentFont;
 
 	if (x < 0)
 		x = 0;
@@ -1288,6 +1295,11 @@ void Screen::printText(const char *str, int x, int y, uint8 color1, uint8 color2
 		return;
 
 	while (1) {
+		if (_sjisMixedFontMode)
+			setFont(*str < 0 ? FID_SJIS_FNT : curFont);
+
+		uint8 charHeightFnt = getFontHeight();
+
 		uint c = fetchChar(str);
 
 		if (c == 0) {
@@ -3566,11 +3578,11 @@ void AMIGAFont::unload() {
 	memset(_chars, 0, sizeof(_chars));
 }
 
-SJISFont::SJISFont(Graphics::FontSJIS *font, const uint8 invisColor, bool is16Color, bool outlineSize)
-    : _colorMap(0), _font(font), _invisColor(invisColor), _is16Color(is16Color) {
+SJISFont::SJISFont(Graphics::FontSJIS *font, const uint8 invisColor, bool is16Color, bool drawOutline, int extraSpacing)
+    : _colorMap(0), _font(font), _invisColor(invisColor), _is16Color(is16Color), _drawOutline(drawOutline), _sjisWidthOffset(extraSpacing) {
 	assert(_font);
 
-	_font->setDrawingMode(outlineSize ? Graphics::FontSJIS::kOutlineMode : Graphics::FontSJIS::kDefaultMode);
+	_font->setDrawingMode(_drawOutline ? Graphics::FontSJIS::kOutlineMode : Graphics::FontSJIS::kDefaultMode);
 
 	_sjisWidth = _font->getMaxFontWidth() >> 1;
 	_fontHeight = _font->getFontHeight() >> 1;
@@ -3587,14 +3599,14 @@ int SJISFont::getHeight() const {
 }
 
 int SJISFont::getWidth() const {
-	return _sjisWidth;
+	return _sjisWidth + _sjisWidthOffset;
 }
 
 int SJISFont::getCharWidth(uint16 c) const {
 	if (c <= 0x7F || (c >= 0xA1 && c <= 0xDF))
 		return _asciiWidth;
 	else
-		return _sjisWidth;
+		return _sjisWidth + _sjisWidthOffset;
 }
 
 void SJISFont::setColorMap(const uint8 *src) {
@@ -3604,7 +3616,7 @@ void SJISFont::setColorMap(const uint8 *src) {
 		if (_colorMap[0] == _invisColor)
 			_font->setDrawingMode(Graphics::FontSJIS::kDefaultMode);
 		else
-			_font->setDrawingMode(Graphics::FontSJIS::kOutlineMode);
+			_font->setDrawingMode(_drawOutline ? Graphics::FontSJIS::kOutlineMode : Graphics::FontSJIS::kDefaultMode);
 	}
 }
 
diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h
index 7f3abf8..156b5b9 100644
--- a/engines/kyra/screen.h
+++ b/engines/kyra/screen.h
@@ -211,7 +211,7 @@ private:
  */
 class SJISFont : public Font {
 public:
-	SJISFont(Graphics::FontSJIS *font, const uint8 invisColor, bool is16Color, bool outlineSize);
+	SJISFont(Graphics::FontSJIS *font, const uint8 invisColor, bool is16Color, bool drawOutline, int extraSpacing);
 	~SJISFont() { unload(); }
 
 	bool usesOverlay() const { return true; }
@@ -230,6 +230,12 @@ private:
 	Graphics::FontSJIS *_font;
 	const uint8 _invisColor;
 	const bool _is16Color;
+	const bool _drawOutline;
+	// We use this for cases where the font width returned by getWidth() or getCharWidth() does not match the original.
+	// The original Japanese game versions use hard coded sjis font widths of 8 or 9. However, this does not necessarily
+	// depend on whether an outline is used or not (neither LOL/PC-9801 nor LOL/FM-TOWNS use an outline, but the first
+	// version uses a font width of 8 where the latter uses a font width of 9).
+	const int _sjisWidthOffset;
 
 	int _sjisWidth, _asciiWidth;
 	int _fontHeight;
@@ -468,7 +474,7 @@ public:
 	int getFontWidth() const;
 
 	int getCharWidth(uint16 c) const;
-	int getTextWidth(const char *str) const;
+	int getTextWidth(const char *str);
 
 	void printText(const char *str, int x, int y, uint8 color1, uint8 color2);
 
@@ -581,6 +587,7 @@ protected:
 	Common::RenderMode _renderMode;
 
 	uint8 _sjisInvisibleColor;
+	bool _sjisMixedFontMode;
 
 	Palette *_screenPalette;
 	Common::Array<Palette *> _palettes;
diff --git a/engines/kyra/script_tim.cpp b/engines/kyra/script_tim.cpp
index 82ec3dc..ba0f62a 100644
--- a/engines/kyra/script_tim.cpp
+++ b/engines/kyra/script_tim.cpp
@@ -297,20 +297,20 @@ void TIMInterpreter::displayText(uint16 textId, int16 flags) {
 			memcpy(filename, text+1, end-1-text);
 	}
 
-	const bool isPC98 = (_vm->gameFlags().platform == Common::kPlatformPC98);
+	const bool sjisMode = (_vm->gameFlags().lang == Common::JA_JPN && _vm->gameFlags().use16ColorMode);
 	if (filename[0] && (_vm->speechEnabled() || !_vm->gameFlags().isTalkie))
 		_vm->sound()->voicePlay(filename, 0, 255, 255, !_vm->gameFlags().isTalkie);
 
 	if (text[0] == '$')
 		text = strchr(text + 1, '$') + 1;
 
-	if (!isPC98)
+	if (!_vm->gameFlags().use16ColorMode)
 		setupTextPalette((flags < 0) ? 1 : flags, 0);
 
 	if (flags < 0) {
 		static const uint8 colorMap[] = { 0x00, 0xF0, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
 
-		_screen->setFont(isPC98 ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT);
+		_screen->setFont(sjisMode ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT);
 		_screen->setTextColorMap(colorMap);
 		_screen->_charWidth = -2;
 	}
@@ -335,7 +335,7 @@ void TIMInterpreter::displayText(uint16 textId, int16 flags) {
 		int width = _screen->getTextWidth(str);
 
 		if (flags >= 0) {
-			if (isPC98) {
+			if (_vm->gameFlags().use16ColorMode) {
 				static const uint8 colorMap[] = { 0xE1, 0xE1, 0xC1, 0xA1, 0x81, 0x61 };
 				_screen->printText(str, (320 - width) >> 1, 160 + heightAdd, colorMap[flags], 0x00);
 			} else {
@@ -359,7 +359,7 @@ void TIMInterpreter::displayText(uint16 textId, int16 flags) {
 	if (flags < 0) {
 		static const uint8 colorMap[] = { 0x00, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0x00, 0x00, 0x00, 0x00 };
 
-		_screen->setFont(isPC98 ? Screen::FID_SJIS_FNT : Screen::FID_INTRO_FNT);
+		_screen->setFont(sjisMode ? Screen::FID_SJIS_FNT : Screen::FID_INTRO_FNT);
 		_screen->setTextColorMap(colorMap);
 		_screen->_charWidth = 0;
 	}
@@ -377,7 +377,7 @@ void TIMInterpreter::displayText(uint16 textId, int16 flags, uint8 color) {
 	if (flags == 255)
 		return;
 
-	_screen->setFont(_vm->gameFlags().use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_INTRO_FNT);
+	_screen->setFont((_vm->gameFlags().lang == Common::JA_JPN && _vm->gameFlags().use16ColorMode) ? Screen::FID_SJIS_FNT : Screen::FID_INTRO_FNT);
 
 	static const uint8 colorMap[] = { 0x00, 0xA0, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
 	_screen->setTextColorMap(colorMap);
diff --git a/engines/kyra/sequences_lol.cpp b/engines/kyra/sequences_lol.cpp
index b319bfa..c8f97eb 100644
--- a/engines/kyra/sequences_lol.cpp
+++ b/engines/kyra/sequences_lol.cpp
@@ -72,7 +72,7 @@ int LoLEngine::processPrologue() {
 		// Original version: (260|193) "V CD1.02 D"
 		const int width = _screen->getTextWidth(versionString.c_str());
 		_screen->fprintString("%s", 320 - width, 193, 0x67, 0x00, 0x04, versionString.c_str());
-		_screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT);
+		_screen->setFont((_flags.lang == Common::JA_JPN && _flags.use16ColorMode) ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT);
 
 		_screen->fadePalette(_screen->getPalette(0), 0x1E);
 		_screen->updateScreen();
@@ -230,7 +230,7 @@ void LoLEngine::showIntro() {
 
 	_screen->loadFont(Screen::FID_8_FNT, "NEW8P.FNT");
 	_screen->loadFont(Screen::FID_INTRO_FNT, "INTRO.FNT");
-	_screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT);
+	_screen->setFont((_flags.lang == Common::JA_JPN && _flags.use16ColorMode) ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT);
 
 	_tim->resetFinishedFlag();
 	_tim->setLangData("LOLINTRO.DIP");
@@ -300,10 +300,10 @@ int LoLEngine::chooseCharacter() {
 
 	_chargenWSA->displayFrame(0, 2, 113, 0, 0, 0, 0);
 
-	_screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT);
+	_screen->setFont((_flags.lang == Common::JA_JPN && _flags.use16ColorMode) ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT);
 	_screen->_curPage = 2;
 
-	if (_flags.platform == Common::kPlatformPC98) {
+	if (_flags.platform == Common::kPlatformPC98 && _flags.use16ColorMode) {
 		_screen->fillRect(17, 29, 94, 97, 17);
 		_screen->fillRect(68, 167, 310, 199, 17);
 		_screen->drawClippedLine(68, 166, 311, 166, 238);
diff --git a/engines/kyra/text_lol.cpp b/engines/kyra/text_lol.cpp
index eee3ea9..9aad105 100644
--- a/engines/kyra/text_lol.cpp
+++ b/engines/kyra/text_lol.cpp
@@ -162,7 +162,7 @@ void TextDisplayer_LoL::printDialogueText(int dim, char *str, EMCState *script,
 	}
 
 	int cp = _screen->setCurPage(0);
-	Screen::FontId of = _screen->setFont(_vm->gameFlags().use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT);
+	Screen::FontId of = _screen->setFont((_vm->gameFlags().lang == Common::JA_JPN && _vm->gameFlags().use16ColorMode) ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT);
 
 	preprocessString(str, script, paramList, paramIndex);
 	_numCharsTotal = strlen(_dialogueBuffer);
diff --git a/engines/kyra/text_rpg.cpp b/engines/kyra/text_rpg.cpp
index 07f4fe0..f9861cf 100644
--- a/engines/kyra/text_rpg.cpp
+++ b/engines/kyra/text_rpg.cpp
@@ -88,8 +88,8 @@ void TextDisplayer_rpg::resetDimTextPositions(int dim) {
 }
 
 void TextDisplayer_rpg::resetPageBreakString() {
-	if (vm()->_moreStrings)
-		strcpy(_pageBreakString, vm()->_moreStrings[0]);
+	if (_vm->_moreStrings)
+		strcpy(_pageBreakString, _vm->_moreStrings[0]);
 }
 
 void TextDisplayer_rpg::setPageBreakFlag() {
@@ -319,13 +319,13 @@ void TextDisplayer_rpg::printLine(char *str) {
 		if ((lw + _textDimData[sdx].column) > w) {
 			if ((lines - 1 - (_waitButtonSpace << 1)) <= _lineCount)
 				// cut off line to leave space for "MORE" button
-				w -= vm()->guiSettings()->buttons.waitReserve;
+				w -= _vm->guiSettings()->buttons.waitReserve;
 		} else {
 			if (!_sjisLineBreakFlag || (_lineCount + 1 < lines - 1))
 				ct = false;
 			else
 				// cut off line to leave space for "MORE" button
-				w -= vm()->guiSettings()->buttons.waitReserve;
+				w -= _vm->guiSettings()->buttons.waitReserve;
 		}
 
 		if (ct) {
@@ -347,7 +347,7 @@ void TextDisplayer_rpg::printLine(char *str) {
 		if ((lw + _textDimData[sdx].column) > w) {
 			if ((lines - 1) <= _lineCount && _allowPageBreak)
 				// cut off line to leave space for "MORE" button
-				w -= vm()->guiSettings()->buttons.waitReserve;
+				w -= _vm->guiSettings()->buttons.waitReserve;
 
 			w -= _textDimData[sdx].column;
 
@@ -483,7 +483,7 @@ void TextDisplayer_rpg::printMessage(const char *str, int textColor, ...) {
 
 	displayText(_dialogueBuffer);
 
-	if (vm()->game() != GI_EOB1)
+	if (_vm->game() != GI_EOB1)
 		_textDimData[_screen->curDimIndex()].color1 = tc;
 
 	if (!_screen->_curPage)
@@ -494,7 +494,7 @@ int TextDisplayer_rpg::clearDim(int dim) {
 	int res = _screen->curDimIndex();
 	_screen->setScreenDim(dim);
 	_textDimData[dim].color1 = _screen->_curDim->unk8;
-	_textDimData[dim].color2 = vm()->game() == GI_LOL ? _screen->_curDim->unkA : vm()->guiSettings()->colors.fill;
+	_textDimData[dim].color2 = _vm->game() == GI_LOL ? _screen->_curDim->unkA : _vm->guiSettings()->colors.fill;
 	clearCurDim();
 	return res;
 }
@@ -502,7 +502,7 @@ int TextDisplayer_rpg::clearDim(int dim) {
 void TextDisplayer_rpg::clearCurDim() {
 	int d = _screen->curDimIndex();
 	const ScreenDim *tmp = _screen->getScreenDim(d);
-	if (vm()->gameFlags().use16ColorMode) {
+	if (_vm->gameFlags().use16ColorMode) {
 		_screen->fillRect(tmp->sx << 3, tmp->sy, ((tmp->sx + tmp->w) << 3) - 2, (tmp->sy + tmp->h) - 2, _textDimData[d].color2);
 	} else
 		_screen->fillRect(tmp->sx << 3, tmp->sy, ((tmp->sx + tmp->w) << 3) - 1, (tmp->sy + tmp->h) - 1, _textDimData[d].color2);
@@ -512,40 +512,40 @@ void TextDisplayer_rpg::clearCurDim() {
 }
 
 void TextDisplayer_rpg::textPageBreak() {
-	if (vm()->game() != GI_LOL)
-		SWAP(vm()->_dialogueButtonLabelColor1, vm()->_dialogueButtonLabelColor2);
+	if (_vm->game() != GI_LOL)
+		SWAP(_vm->_dialogueButtonLabelColor1, _vm->_dialogueButtonLabelColor2);
 
 	int cp = _screen->setCurPage(0);
-	Screen::FontId cf = _screen->setFont(vm()->gameFlags().use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT);
+	Screen::FontId cf = _screen->setFont((_vm->gameFlags().lang == Common::JA_JPN && _vm->gameFlags().use16ColorMode) ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT);
 
-	if (vm()->game() == GI_LOL)
-		vm()->_timer->pauseSingleTimer(11, true);
+	if (_vm->game() == GI_LOL)
+		_vm->_timer->pauseSingleTimer(11, true);
 
-	vm()->_fadeText = false;
+	_vm->_fadeText = false;
 	int resetPortraitAfterSpeechAnim = 0;
 	int updatePortraitSpeechAnimDuration = 0;
 
-	if (vm()->_updateCharNum != -1)  {
-		resetPortraitAfterSpeechAnim = vm()->_resetPortraitAfterSpeechAnim;
-		vm()->_resetPortraitAfterSpeechAnim = 0;
-		updatePortraitSpeechAnimDuration = vm()->_updatePortraitSpeechAnimDuration;
-		if (vm()->_updatePortraitSpeechAnimDuration > 36)
-			vm()->_updatePortraitSpeechAnimDuration = 36;
+	if (_vm->_updateCharNum != -1)  {
+		resetPortraitAfterSpeechAnim = _vm->_resetPortraitAfterSpeechAnim;
+		_vm->_resetPortraitAfterSpeechAnim = 0;
+		updatePortraitSpeechAnimDuration = _vm->_updatePortraitSpeechAnimDuration;
+		if (_vm->_updatePortraitSpeechAnimDuration > 36)
+			_vm->_updatePortraitSpeechAnimDuration = 36;
 	}
 
 	uint32 speechPartTime = 0;
-	if (vm()->speechEnabled() && vm()->_activeVoiceFileTotalTime && _numCharsTotal)
-		speechPartTime = vm()->_system->getMillis() + ((_numCharsPrinted * vm()->_activeVoiceFileTotalTime) / _numCharsTotal);
+	if (_vm->speechEnabled() && _vm->_activeVoiceFileTotalTime && _numCharsTotal)
+		speechPartTime = _vm->_system->getMillis() + ((_numCharsPrinted * _vm->_activeVoiceFileTotalTime) / _numCharsTotal);
 
 	const ScreenDim *dim = _screen->getScreenDim(_screen->curDimIndex());
 
 	int x = ((dim->sx + dim->w) << 3) - (_vm->_dialogueButtonWidth + 3);
 	int y = 0;
-	int w = vm()->_dialogueButtonWidth;
+	int w = _vm->_dialogueButtonWidth;
 
-	if (vm()->game() == GI_LOL) {
-		if (vm()->_needSceneRestore && (vm()->_updateFlags & 2)) {
-			if (vm()->_currentControlMode || !(vm()->_updateFlags & 2)) {
+	if (_vm->game() == GI_LOL) {
+		if (_vm->_needSceneRestore && (_vm->_updateFlags & 2)) {
+			if (_vm->_currentControlMode || !(_vm->_updateFlags & 2)) {
 				y = dim->sy + dim->h - 5;
 			} else {
 				x += 6;
@@ -555,49 +555,49 @@ void TextDisplayer_rpg::textPageBreak() {
 			y = dim->sy + dim->h - 10;
 		}
 	} else {
-		y = vm()->guiSettings()->buttons.waitY[_waitButtonMode];
-		x = vm()->guiSettings()->buttons.waitX[_waitButtonMode];
-		w = vm()->guiSettings()->buttons.waitWidth[_waitButtonMode];
+		y = _vm->guiSettings()->buttons.waitY[_waitButtonMode];
+		x = _vm->guiSettings()->buttons.waitX[_waitButtonMode];
+		w = _vm->guiSettings()->buttons.waitWidth[_waitButtonMode];
 	}
 
-	if (vm()->gameFlags().use16ColorMode) {
-		vm()->gui_drawBox(x + 8, (y & ~7) - 1, 66, 10, 0xEE, 0xCC, -1);
+	if (_vm->gameFlags().use16ColorMode) {
+		_vm->gui_drawBox(x + 8, (y & ~7) - 1, 66, 10, 0xEE, 0xCC, -1);
 		_screen->printText(_pageBreakString, (x + 37 - (strlen(_pageBreakString) << 1) + 4) & ~3, (y + 2) & ~7, 0xC1, 0);
 	} else {
-		vm()->gui_drawBox(x, y, w, vm()->guiSettings()->buttons.height, vm()->guiSettings()->colors.frame1, vm()->guiSettings()->colors.frame2, vm()->guiSettings()->colors.fill);
-		_screen->printText(_pageBreakString, x + (w >> 1) - (vm()->screen()->getTextWidth(_pageBreakString) >> 1), y + 2, vm()->_dialogueButtonLabelColor1, 0);
+		_vm->gui_drawBox(x, y, w, _vm->guiSettings()->buttons.height, _vm->guiSettings()->colors.frame1, _vm->guiSettings()->colors.frame2, _vm->guiSettings()->colors.fill);
+		_screen->printText(_pageBreakString, x + (w >> 1) - (_vm->screen()->getTextWidth(_pageBreakString) >> 1), y + 2, _vm->_dialogueButtonLabelColor1, 0);
 	}
 
-	vm()->removeInputTop();
+	_vm->removeInputTop();
 
 	bool loop = true;
 	bool target = false;
 
 	do {
-		int inputFlag = vm()->checkInput(0, false) & 0xFF;
-		vm()->removeInputTop();
+		int inputFlag = _vm->checkInput(0, false) & 0xFF;
+		_vm->removeInputTop();
 
 		while (!inputFlag && !_vm->shouldQuit()) {
-			vm()->update();
+			_vm->update();
 
-			if (vm()->speechEnabled()) {
-				if (((vm()->_system->getMillis() > speechPartTime) || (vm()->snd_updateCharacterSpeech() != 2)) && speechPartTime) {
+			if (_vm->speechEnabled()) {
+				if (((_vm->_system->getMillis() > speechPartTime) || (_vm->snd_updateCharacterSpeech() != 2)) && speechPartTime) {
 					loop = false;
-					inputFlag = vm()->_keyMap[Common::KEYCODE_RETURN];
+					inputFlag = _vm->_keyMap[Common::KEYCODE_RETURN];
 					break;
 				}
 			}
 
-			inputFlag = vm()->checkInput(0, false) & 0xFF;
-			vm()->removeInputTop();
+			inputFlag = _vm->checkInput(0, false) & 0xFF;
+			_vm->removeInputTop();
 		}
 
-		vm()->gui_notifyButtonListChanged();
+		_vm->gui_notifyButtonListChanged();
 
-		if (inputFlag == vm()->_keyMap[Common::KEYCODE_SPACE] || inputFlag == vm()->_keyMap[Common::KEYCODE_RETURN]) {
+		if (inputFlag == _vm->_keyMap[Common::KEYCODE_SPACE] || inputFlag == _vm->_keyMap[Common::KEYCODE_RETURN]) {
 			loop = false;
 		} else if (inputFlag == 199 || inputFlag == 201) {
-			if (vm()->posWithinRect(vm()->_mouseX, vm()->_mouseY, x, y, x + w, y + 9)) {
+			if (_vm->posWithinRect(_vm->_mouseX, _vm->_mouseY, x, y, x + w, y + 9)) {
 				if (_vm->game() == GI_LOL)
 					target = true;
 				else
@@ -609,7 +609,7 @@ void TextDisplayer_rpg::textPageBreak() {
 		}
 	} while (loop && !_vm->shouldQuit());
 
-	if (vm()->gameFlags().use16ColorMode)
+	if (_vm->gameFlags().use16ColorMode)
 		_screen->fillRect(x + 8, y, x + 57, y + 9, _textDimData[_screen->curDimIndex()].color2);
 	else
 		_screen->fillRect(x, y, x + w - 1, y + 8, _textDimData[_screen->curDimIndex()].color2);
@@ -617,52 +617,52 @@ void TextDisplayer_rpg::textPageBreak() {
 	clearCurDim();
 	_screen->updateScreen();
 
-	if (vm()->game() == GI_LOL)
-		vm()->_timer->pauseSingleTimer(11, false);
+	if (_vm->game() == GI_LOL)
+		_vm->_timer->pauseSingleTimer(11, false);
 
-	if (vm()->_updateCharNum != -1) {
-		vm()->_resetPortraitAfterSpeechAnim = resetPortraitAfterSpeechAnim;
+	if (_vm->_updateCharNum != -1) {
+		_vm->_resetPortraitAfterSpeechAnim = resetPortraitAfterSpeechAnim;
 		if (updatePortraitSpeechAnimDuration > 36)
 			updatePortraitSpeechAnimDuration -= 36;
 		else
 			updatePortraitSpeechAnimDuration >>= 1;
 
-		vm()->_updatePortraitSpeechAnimDuration = updatePortraitSpeechAnimDuration;
+		_vm->_updatePortraitSpeechAnimDuration = updatePortraitSpeechAnimDuration;
 	}
 
 	_screen->setFont(cf);
 	_screen->setCurPage(cp);
 
-	if (vm()->game() != GI_LOL)
-		SWAP(vm()->_dialogueButtonLabelColor1, vm()->_dialogueButtonLabelColor2);
+	if (_vm->game() != GI_LOL)
+		SWAP(_vm->_dialogueButtonLabelColor1, _vm->_dialogueButtonLabelColor2);
 
-	vm()->removeInputTop();
+	_vm->removeInputTop();
 }
 
 void TextDisplayer_rpg::displayWaitButton() {
-	vm()->_dialogueNumButtons = 1;
-	vm()->_dialogueButtonString[0] = _pageBreakString;
-	vm()->_dialogueButtonString[1] = 0;
-	vm()->_dialogueButtonString[2] = 0;
-	vm()->_dialogueHighlightedButton = 0;
+	_vm->_dialogueNumButtons = 1;
+	_vm->_dialogueButtonString[0] = _pageBreakString;
+	_vm->_dialogueButtonString[1] = 0;
+	_vm->_dialogueButtonString[2] = 0;
+	_vm->_dialogueHighlightedButton = 0;
 
-	vm()->_dialogueButtonPosX = &vm()->guiSettings()->buttons.waitX[_waitButtonMode];
-	vm()->_dialogueButtonPosY = &vm()->guiSettings()->buttons.waitY[_waitButtonMode];
-	vm()->_dialogueButtonWidth = vm()->guiSettings()->buttons.waitWidth[_waitButtonMode];
-	vm()->_dialogueButtonYoffs = 0;
+	_vm->_dialogueButtonPosX = &_vm->guiSettings()->buttons.waitX[_waitButtonMode];
+	_vm->_dialogueButtonPosY = &_vm->guiSettings()->buttons.waitY[_waitButtonMode];
+	_vm->_dialogueButtonWidth = _vm->guiSettings()->buttons.waitWidth[_waitButtonMode];
+	_vm->_dialogueButtonYoffs = 0;
 
-	SWAP(vm()->_dialogueButtonLabelColor1, vm()->_dialogueButtonLabelColor2);
-	vm()->drawDialogueButtons();
+	SWAP(_vm->_dialogueButtonLabelColor1, _vm->_dialogueButtonLabelColor2);
+	_vm->drawDialogueButtons();
 
-	if (!vm()->shouldQuit())
-		vm()->removeInputTop();
+	if (!_vm->shouldQuit())
+		_vm->removeInputTop();
 
-	while (!vm()->processDialogue() && !vm()->shouldQuit()) {}
+	while (!_vm->processDialogue() && !_vm->shouldQuit()) {}
 
-	_screen->fillRect(vm()->_dialogueButtonPosX[0], vm()->_dialogueButtonPosY[0], vm()->_dialogueButtonPosX[0] + vm()->_dialogueButtonWidth - 1, vm()->_dialogueButtonPosY[0] + vm()->guiSettings()->buttons.height - 1, vm()->guiSettings()->colors.fill);
+	_screen->fillRect(_vm->_dialogueButtonPosX[0], _vm->_dialogueButtonPosY[0], _vm->_dialogueButtonPosX[0] + _vm->_dialogueButtonWidth - 1, _vm->_dialogueButtonPosY[0] + _vm->guiSettings()->buttons.height - 1, _vm->guiSettings()->colors.fill);
 	_screen->updateScreen();
-	vm()->_dialogueButtonWidth = 95;
-	SWAP(vm()->_dialogueButtonLabelColor1, vm()->_dialogueButtonLabelColor2);
+	_vm->_dialogueButtonWidth = 95;
+	SWAP(_vm->_dialogueButtonLabelColor1, _vm->_dialogueButtonLabelColor2);
 	clearCurDim();
 }
 


Commit: ee479f289f7b94c124caf40cdebe02540bc45f56
    https://github.com/scummvm/scummvm/commit/ee479f289f7b94c124caf40cdebe02540bc45f56
Author: athrxx (athrxx at scummvm.org)
Date: 2013-01-09T11:29:20-08:00

Commit Message:
KYRA: (LOL/FM-TOWNS) - adapt text displayer

Changed paths:
    engines/kyra/text_lol.cpp
    engines/kyra/text_rpg.cpp
    engines/kyra/text_rpg.h



diff --git a/engines/kyra/text_lol.cpp b/engines/kyra/text_lol.cpp
index 9aad105..6e77db1 100644
--- a/engines/kyra/text_lol.cpp
+++ b/engines/kyra/text_lol.cpp
@@ -136,18 +136,16 @@ void TextDisplayer_LoL::expandField() {
 void TextDisplayer_LoL::printDialogueText(int dim, char *str, EMCState *script, const uint16 *paramList, int16 paramIndex) {
 	int oldDim = 0;
 
-	const bool isPc98 = (_vm->gameFlags().platform == Common::kPlatformPC98);
-
 	if (dim == 3) {
 		if (_vm->_updateFlags & 2) {
 			oldDim = clearDim(4);
-			_textDimData[4].color1 = isPc98 ? 0x33 : 254;
+			_textDimData[4].color1 = _vm->gameFlags().use16ColorMode ? 0x33 : 254;
 			_textDimData[4].color2 = _screen->_curDim->unkA;
 		} else {
 			oldDim = clearDim(3);
-			_textDimData[3].color1 = isPc98 ? 0x33 : 192;
+			_textDimData[3].color1 = _vm->gameFlags().use16ColorMode ? 0x33 : 192;
 			_textDimData[3].color2 = _screen->_curDim->unkA;
-			if (!isPc98)
+			if (!_vm->gameFlags().use16ColorMode)
 				_screen->copyColor(192, 254);
 			_vm->enableTimer(11);
 			_vm->_textColorFlag = 0;
@@ -157,7 +155,7 @@ void TextDisplayer_LoL::printDialogueText(int dim, char *str, EMCState *script,
 		oldDim = _screen->curDimIndex();
 		_screen->setScreenDim(dim);
 		_lineCount = 0;
-		_textDimData[dim].color1 = isPc98 ? 0x33 : 254;
+		_textDimData[dim].color1 = _vm->gameFlags().use16ColorMode ? 0x33 : 254;
 		_textDimData[dim].color2 = _screen->_curDim->unkA;
 	}
 
@@ -228,10 +226,9 @@ void TextDisplayer_LoL::printMessage(uint16 type, const char *str, ...) {
 
 void TextDisplayer_LoL::preprocessString(char *str, EMCState *script, const uint16 *paramList, int16 paramIndex) {
 	char *dst = _dialogueBuffer;
-	const bool isPc98 = (_vm->gameFlags().platform == Common::kPlatformPC98);
 
 	for (char *s = str; *s;) {
-		if (isPc98) {
+		if (_vm->gameFlags().lang == Common::JA_JPN) {
 			uint8 c = *s;
 			if (c >= 0xE0 || (c > 0x80 && c < 0xA0)) {
 				*dst++ = *s++;
diff --git a/engines/kyra/text_rpg.cpp b/engines/kyra/text_rpg.cpp
index f9861cf..b6b09e9 100644
--- a/engines/kyra/text_rpg.cpp
+++ b/engines/kyra/text_rpg.cpp
@@ -36,7 +36,7 @@ enum {
 
 TextDisplayer_rpg::TextDisplayer_rpg(KyraRpgEngine *engine, Screen *scr) : _vm(engine), _screen(scr),
 	_lineCount(0), _printFlag(false), _lineWidth(0), _numCharsTotal(0), _allowPageBreak(true),
-	_numCharsLeft(0), _numCharsPrinted(0), _sjisLineBreakFlag(false), _waitButtonMode(1) {
+	_numCharsLeft(0), _numCharsPrinted(0), _sjisTextModeLineBreak(false), _waitButtonMode(1) {
 
 	_dialogueBuffer = new char[kEoBTextBufferSize];
 	memset(_dialogueBuffer, 0, kEoBTextBufferSize);
@@ -102,8 +102,6 @@ void TextDisplayer_rpg::removePageBreakFlag() {
 }
 
 void TextDisplayer_rpg::displayText(char *str, ...) {
-	const bool isPc98 = (_vm->gameFlags().platform == Common::kPlatformPC98);
-
 	_printFlag = false;
 
 	_lineWidth = 0;
@@ -125,7 +123,9 @@ void TextDisplayer_rpg::displayText(char *str, ...) {
 	const ScreenDim *sd = _screen->_curDim;
 	int sdx = _screen->curDimIndex();
 
-	bool pc98PrintFlag = (isPc98 && (sdx == 3 || sdx == 4 || sdx == 5 || sdx == 15)) ? true : false;
+	bool sjisTextMode = (_vm->gameFlags().lang == Common::JA_JPN && _vm->gameFlags().use16ColorMode && (sdx == 3 || sdx == 4 || sdx == 5 || sdx == 15)) ? true : false;
+	int sjisOffs = sjisTextMode ? 8 : 9;
+	
 	uint16 charsPerLine = (sd->w << 3) / (_screen->getFontWidth() + _screen->_charWidth);
 
 	while (c) {
@@ -146,15 +146,25 @@ void TextDisplayer_rpg::displayText(char *str, ...) {
 			c = parseCommand();
 		}
 
-		if (isPc98) {
+		if (_vm->gameFlags().lang == Common::JA_JPN) {
 			uint8 cu = (uint8) c;
 			if (cu >= 0xE0 || (cu > 0x80 && cu < 0xA0)) {
-				_currentLine[_numCharsLeft++] = c;
-				_currentLine[_numCharsLeft++] = parseCommand();
-				_currentLine[_numCharsLeft] = '\0';
-				_lineWidth += 8;
-				if ((_textDimData[sdx].column + _lineWidth) > (sd->w << 3))
+				if (sjisTextMode) {
+					_currentLine[_numCharsLeft++] = c;
+					_currentLine[_numCharsLeft++] = parseCommand();
+					_currentLine[_numCharsLeft] = '\0';
+				}
+
+				if ((_textDimData[sdx].column + _lineWidth + sjisOffs) > (sd->w << 3))
 					printLine(_currentLine);
+
+				if (!sjisTextMode) {
+					_currentLine[_numCharsLeft++] = c;
+					_currentLine[_numCharsLeft++] = parseCommand();
+					_currentLine[_numCharsLeft] = '\0';
+				}
+
+				_lineWidth += sjisOffs;
 				c = parseCommand();
 				continue;
 			}
@@ -189,10 +199,10 @@ void TextDisplayer_rpg::displayText(char *str, ...) {
 			break;
 
 		case 12:
-			if (isPc98)
-				_sjisLineBreakFlag = true;
+			if (sjisTextMode)
+				_sjisTextModeLineBreak = true;
 			printLine(_currentLine);
-			_sjisLineBreakFlag = false;
+			_sjisTextModeLineBreak = false;
 			_lineCount++;
 			_textDimData[sdx].column = 0;
 			_textDimData[sdx].line++;
@@ -208,7 +218,7 @@ void TextDisplayer_rpg::displayText(char *str, ...) {
 
 		default:
 			if (_vm->game() == GI_LOL || (unsigned char)c > 30) {
-				_lineWidth += (pc98PrintFlag ? 4 : _screen->getCharWidth((uint8)c));
+				_lineWidth += (sjisTextMode ? 4 : (_screen->_currentFont == Screen::FID_SJIS_FNT ? 9 : _screen->getCharWidth((uint8)c)));
 				_currentLine[_numCharsLeft++] = c;
 				_currentLine[_numCharsLeft] = 0;
 
@@ -280,10 +290,9 @@ void TextDisplayer_rpg::readNextPara() {
 }
 
 void TextDisplayer_rpg::printLine(char *str) {
-	const bool isPc98 = (_vm->gameFlags().platform == Common::kPlatformPC98);
 	const ScreenDim *sd = _screen->_curDim;
 	int sdx = _screen->curDimIndex();
-	bool pc98PrintFlag = (isPc98 && (sdx == 3 || sdx == 4 || sdx == 5 || sdx == 15)) ? true : false;
+	bool sjisTextMode = (_vm->gameFlags().lang == Common::JA_JPN && _vm->gameFlags().use16ColorMode && (sdx == 3 || sdx == 4 || sdx == 5 || sdx == 15)) ? true : false;
 
 	int fh = (_screen->_currentFont == Screen::FID_SJIS_FNT) ? 9 : (_screen->getFontHeight() + _screen->_charOffset);
 	int lines = (sd->h - _screen->_charOffset) / fh;
@@ -307,13 +316,15 @@ void TextDisplayer_rpg::printLine(char *str) {
 	}
 
 	int x1 = (sd->sx << 3) + _textDimData[sdx].column;
-	int y = sd->sy + (pc98PrintFlag ? (_textDimData[sdx].line << 3) : (fh * _textDimData[sdx].line));
+	int y = sd->sy + (sjisTextMode ? (_textDimData[sdx].line << 3) : (fh * _textDimData[sdx].line));
 	int w = sd->w << 3;
 	int lw = _lineWidth;
 	int s = _numCharsLeft;
 	char c = 0;
+	uint8 twoByteCharOffs = 0;
 
-	if (pc98PrintFlag) {
+	
+	if (sjisTextMode) {
 		bool ct = true;
 
 		if ((lw + _textDimData[sdx].column) > w) {
@@ -321,7 +332,7 @@ void TextDisplayer_rpg::printLine(char *str) {
 				// cut off line to leave space for "MORE" button
 				w -= _vm->guiSettings()->buttons.waitReserve;
 		} else {
-			if (!_sjisLineBreakFlag || (_lineCount + 1 < lines - 1))
+			if (!_sjisTextModeLineBreak || (_lineCount + 1 < lines - 1))
 				ct = false;
 			else
 				// cut off line to leave space for "MORE" button
@@ -344,41 +355,88 @@ void TextDisplayer_rpg::printLine(char *str) {
 			s = n2;
 		}
 	} else {
-		if ((lw + _textDimData[sdx].column) > w) {
+		if (_vm->gameFlags().lang == Common::JA_JPN) {
+			for (int i = 0; i < s; ++i) {
+				uint8 cu = (uint8) str[i];
+				if (cu >= 0xE0 || (cu > 0x80 && cu < 0xA0))
+					twoByteCharOffs = 8;
+			}
+		}
+
+		if ((lw + _textDimData[sdx].column) >= w) {
 			if ((lines - 1) <= _lineCount && _allowPageBreak)
 				// cut off line to leave space for "MORE" button
 				w -= _vm->guiSettings()->buttons.waitReserve;
 
 			w -= _textDimData[sdx].column;
 
-			int n2 = 0;
-			int n1 = s - 1;
+			int lineLastCharPos = 0;
+			int strPos = s - 1;
+
+			if (twoByteCharOffs) {
+				lw = 0;
+				int prevStrPos = 0;
+				c = str[0];
+
+				for (strPos = 0; strPos < s; ++strPos) {
+					uint8 cu = (uint8) str[strPos];
+					if (cu >= 0xE0 || (cu > 0x80 && cu < 0xA0)) {
+						lw += 9;
+						strPos++;
+					} else {
+						lw += _screen->getCharWidth((uint8)c);
+					}
+
+					if (!lineLastCharPos && w < lw + twoByteCharOffs)
+						lineLastCharPos = prevStrPos;
+
+					if (lineLastCharPos && c == ' ') {
+						s = strPos;
+						_printFlag = false;
+						break;
+					}
+					prevStrPos = strPos;
+					c = (char) cu;
+				}
 
-			while (n1 > 0) {
-				//cut off line after last space
-				c = str[n1];
+				if (!lineLastCharPos) {
+					lineLastCharPos = s - 1;
+					if (lineLastCharPos && str[lineLastCharPos] == ' ') {
+						s = strPos;
+						_printFlag = false;
+					}
+				}
 
-				lw -= _screen->getCharWidth((uint8)c);
+				lw = _lineWidth;
 
-				if (!n2 && lw <= w)
-					n2 = n1;
+			} else {
+				while (strPos > 0) {
+					//cut off line after last space
+					c = str[strPos];
 
-				if (n2 && c == ' ') {
-					s = n1;
-					_printFlag = false;
-					break;
+					lw -= _screen->getCharWidth((uint8)c);
+
+					if (!lineLastCharPos && lw <= w)
+						lineLastCharPos = strPos;
+
+					if (lineLastCharPos && c == ' ') {
+						s = strPos;
+						_printFlag = false;
+						break;
+					}
+					strPos--;
 				}
-				n1--;
 			}
-
-			if (!n1) {
+			
+			if (!strPos) {
 				if (_textDimData[sdx].column && !_printFlag) {
 					s = lw = 0;
 					_printFlag = true;
 				} else {
-					s = n2;
+					s = lineLastCharPos;
 				}
 			}
+			
 		}
 	}
 
@@ -386,7 +444,7 @@ void TextDisplayer_rpg::printLine(char *str) {
 	str[s] = 0;
 
 	uint8 col = _textDimData[sdx].color1;
-	if (isPc98 && (sdx == 2 || sdx == 3 || sdx == 4 || sdx == 5 || sdx == 15)) {
+	if (sjisTextMode && (sdx == 2 || sdx == 3 || sdx == 4 || sdx == 5 || sdx == 15)) {
 		switch (_textDimData[sdx].color1) {
 		case 0x88:
 			col = 0x41;
@@ -413,6 +471,7 @@ void TextDisplayer_rpg::printLine(char *str) {
 		_screen->printText(str, x1 & ~3, (y + 8) & ~7, col, 0);
 	} else {
 		_screen->printText(str, x1, y, col, _textDimData[sdx].color2);
+		_screen->updateScreen();
 	}
 
 	_textDimData[sdx].column += lw;
@@ -432,9 +491,9 @@ void TextDisplayer_rpg::printLine(char *str) {
 	str[len] = 0;
 
 	_numCharsLeft = strlen(str);
-	_lineWidth = pc98PrintFlag ? (_numCharsLeft << 2) : _screen->getTextWidth(str);
+	_lineWidth = sjisTextMode ? (_numCharsLeft << 2) : (_screen->_currentFont == Screen::FID_SJIS_FNT ? _numCharsLeft * 9: _screen->getTextWidth(str));
 
-	if (!_numCharsLeft && _textDimData[sdx].column < (sd->w << 3))
+	if (!_numCharsLeft && (_textDimData[sdx].column + twoByteCharOffs) <= (sd->w << 3))
 		return;
 
 	_textDimData[sdx].column = 0;
diff --git a/engines/kyra/text_rpg.h b/engines/kyra/text_rpg.h
index 5ad8899..eb8617a 100644
--- a/engines/kyra/text_rpg.h
+++ b/engines/kyra/text_rpg.h
@@ -79,7 +79,7 @@ protected:
 	uint32 _numCharsPrinted;
 
 	bool _printFlag;
-	bool _sjisLineBreakFlag;
+	bool _sjisTextModeLineBreak;
 
 	char _pageBreakString[20];
 	char _scriptParaString[11];


Commit: 0c95f6524e0d22ebb3dd4e13ec8b0026eff52887
    https://github.com/scummvm/scummvm/commit/0c95f6524e0d22ebb3dd4e13ec8b0026eff52887
Author: athrxx (athrxx at scummvm.org)
Date: 2013-01-09T11:31:23-08:00

Commit Message:
KYRA: (LOL/FM-TOWNS) - fix sjis text position for button labels

Changed paths:
    engines/kyra/kyra_rpg.cpp
    engines/kyra/sound_lol.cpp
    engines/kyra/text_rpg.cpp



diff --git a/engines/kyra/kyra_rpg.cpp b/engines/kyra/kyra_rpg.cpp
index 67d27de..f8eb7d0 100644
--- a/engines/kyra/kyra_rpg.cpp
+++ b/engines/kyra/kyra_rpg.cpp
@@ -204,18 +204,19 @@ bool KyraRpgEngine::posWithinRect(int posX, int posY, int x1, int y1, int x2, in
 
 void KyraRpgEngine::drawDialogueButtons() {
 	int cp = screen()->setCurPage(0);
-	Screen::FontId of = screen()->setFont(gameFlags().lang == Common::JA_JPN && gameFlags().use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT);
+	Screen::FontId of = screen()->setFont(_flags.lang == Common::JA_JPN && _flags.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT);
 
 	for (int i = 0; i < _dialogueNumButtons; i++) {
 		int x = _dialogueButtonPosX[i];
-		if (gameFlags().use16ColorMode) {
+		if (_flags.lang == Common::JA_JPN && _flags.use16ColorMode) {
 			gui_drawBox(x, ((_dialogueButtonYoffs + _dialogueButtonPosY[i]) & ~7) - 1, 74, 10, 0xEE, 0xCC, -1);
 			screen()->printText(_dialogueButtonString[i], (x + 37 - (screen()->getTextWidth(_dialogueButtonString[i])) / 2) & ~3,
 			                    ((_dialogueButtonYoffs + _dialogueButtonPosY[i]) + 2) & ~7, _dialogueHighlightedButton == i ? 0xC1 : 0xE1, 0);
 		} else {
+			int sjisYOffset = (_flags.lang == Common::JA_JPN && _dialogueButtonString[i][0] < 0) ? 2 : 0;
 			gui_drawBox(x, (_dialogueButtonYoffs + _dialogueButtonPosY[i]), _dialogueButtonWidth, guiSettings()->buttons.height, guiSettings()->colors.frame1, guiSettings()->colors.frame2, guiSettings()->colors.fill);
 			screen()->printText(_dialogueButtonString[i], x + (_dialogueButtonWidth >> 1) - (screen()->getTextWidth(_dialogueButtonString[i])) / 2,
-			                    (_dialogueButtonYoffs + _dialogueButtonPosY[i]) + 2, _dialogueHighlightedButton == i ? _dialogueButtonLabelColor1 : _dialogueButtonLabelColor2, 0);
+			                    (_dialogueButtonYoffs + _dialogueButtonPosY[i]) + 2 - sjisYOffset, _dialogueHighlightedButton == i ? _dialogueButtonLabelColor1 : _dialogueButtonLabelColor2, 0);
 		}
 	}
 	screen()->setFont(of);
@@ -228,7 +229,7 @@ uint16 KyraRpgEngine::processDialogue() {
 
 	for (int i = 0; i < _dialogueNumButtons; i++) {
 		int x = _dialogueButtonPosX[i];
-		int y = (gameFlags().use16ColorMode ? ((_dialogueButtonYoffs + _dialogueButtonPosY[i]) & ~7) - 1 : (_dialogueButtonYoffs + _dialogueButtonPosY[i]));
+		int y = ((_flags.lang == Common::JA_JPN && _flags.use16ColorMode) ? ((_dialogueButtonYoffs + _dialogueButtonPosY[i]) & ~7) - 1 : (_dialogueButtonYoffs + _dialogueButtonPosY[i]));
 		Common::Point p = getMousePos();
 		if (posWithinRect(p.x, p.y, x, y, x + _dialogueButtonWidth, y + guiSettings()->buttons.height)) {
 			_dialogueHighlightedButton = i;
diff --git a/engines/kyra/sound_lol.cpp b/engines/kyra/sound_lol.cpp
index 41f59be..48230d0 100644
--- a/engines/kyra/sound_lol.cpp
+++ b/engines/kyra/sound_lol.cpp
@@ -273,7 +273,7 @@ int LoLEngine::snd_playTrack(int track) {
 			snd_loadSoundFile(track);
 			int t = (track - 250) * 3;
 			_sound->playTrack(_musicTrackMap[t + 2]);
-		} else {			
+		} else {
 			_sound->playTrack(track - 249);
 		}
 	}
diff --git a/engines/kyra/text_rpg.cpp b/engines/kyra/text_rpg.cpp
index b6b09e9..a19d678 100644
--- a/engines/kyra/text_rpg.cpp
+++ b/engines/kyra/text_rpg.cpp
@@ -125,7 +125,7 @@ void TextDisplayer_rpg::displayText(char *str, ...) {
 
 	bool sjisTextMode = (_vm->gameFlags().lang == Common::JA_JPN && _vm->gameFlags().use16ColorMode && (sdx == 3 || sdx == 4 || sdx == 5 || sdx == 15)) ? true : false;
 	int sjisOffs = sjisTextMode ? 8 : 9;
-	
+
 	uint16 charsPerLine = (sd->w << 3) / (_screen->getFontWidth() + _screen->_charWidth);
 
 	while (c) {
@@ -323,7 +323,7 @@ void TextDisplayer_rpg::printLine(char *str) {
 	char c = 0;
 	uint8 twoByteCharOffs = 0;
 
-	
+
 	if (sjisTextMode) {
 		bool ct = true;
 
@@ -427,7 +427,7 @@ void TextDisplayer_rpg::printLine(char *str) {
 					strPos--;
 				}
 			}
-			
+
 			if (!strPos) {
 				if (_textDimData[sdx].column && !_printFlag) {
 					s = lw = 0;
@@ -436,7 +436,7 @@ void TextDisplayer_rpg::printLine(char *str) {
 					s = lineLastCharPos;
 				}
 			}
-			
+
 		}
 	}
 


Commit: 36cc94ab73e6bc23ec904bede7dae768dd9f28b2
    https://github.com/scummvm/scummvm/commit/36cc94ab73e6bc23ec904bede7dae768dd9f28b2
Author: athrxx (athrxx at scummvm.org)
Date: 2013-01-09T11:31:25-08:00

Commit Message:
KYRA: (LOL/FM-TOWNS) - add keyboard controls

Changed paths:
    engines/kyra/kyra_v1.cpp
    engines/kyra/lol.cpp



diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp
index f6fc4c3..1313863 100644
--- a/engines/kyra/kyra_v1.cpp
+++ b/engines/kyra/kyra_v1.cpp
@@ -353,84 +353,88 @@ void KyraEngine_v1::setupKeyMap() {
 		Common::KeyCode kcScummVM;
 		int16 kcDOS;
 		int16 kcPC98;
+		int16 kcFMTowns;
 	};
 
+#define UNKNOWN_KEYCODE -1
 #define KC(x) Common::KEYCODE_##x
 	static const KeyCodeMapEntry keys[] = {
-		{ KC(SPACE), 61, 53 },
-		{ KC(RETURN), 43, 29 },
-		{ KC(UP), 96, 68 },
-		{ KC(KP8), 96, 68 },
-		{ KC(RIGHT), 102, 73 },
-		{ KC(KP6), 102, 73 },
-		{ KC(DOWN), 98, 76 },
-		{ KC(KP2), 98, 76 },
-		{ KC(KP5), 97, 72 },
-		{ KC(LEFT), 92, 71 },
-		{ KC(KP4), 92, 71 },
-		{ KC(HOME), 91, 67 },
-		{ KC(KP7), 91, 67 },
-		{ KC(PAGEUP), 101, 69 },
-		{ KC(KP9), 101, 69 },
-		{ KC(END), 93, 0/*unknown*/ },
-		{ KC(KP1), 93, 0/*unknown*/ },
-		{ KC(PAGEDOWN), 103, 0/*unknown*/ },
-		{ KC(KP3), 103, 0/*unknown*/ },
-		{ KC(F1), 112, 99 },
-		{ KC(F2), 113, 100 },
-		{ KC(F3), 114, 101 },
-		{ KC(F4), 115, 102 },
-		{ KC(F5), 116, 103 },
-		{ KC(F6), 117, 104 },
-		{ KC(a), 31, 31 },
-		{ KC(b), 50, 50 },
-		{ KC(c), 48, 48 },
-		{ KC(d), 33, 33 },
-		{ KC(e), 19, 19 },
-		{ KC(f), 34, 34 },
-		{ KC(i), 24, 24 },
-		{ KC(k), 38, 38 },
-		{ KC(m), 52, 52 },
-		{ KC(n), 51, 51 },
-		{ KC(o), 25, 25 },
-		{ KC(p), 26, 26 },
-		{ KC(r), 20, 20 },
-		{ KC(s), 32, 32 },
-		{ KC(w), 18, 18 },
-		{ KC(y), 22, 22 },
-		{ KC(z), 46, 46 },
-		{ KC(1), 2, 0/*unknown*/ },
-		{ KC(2), 3, 0/*unknown*/ },
-		{ KC(3), 4, 0/*unknown*/ },
-		{ KC(4), 5, 0/*unknown*/ },
-		{ KC(5), 6, 0/*unknown*/ },
-		{ KC(6), 7, 0/*unknown*/ },
-		{ KC(7), 8, 0/*unknown*/ },
-		{ KC(SLASH), 55, 55 },
-		{ KC(ESCAPE), 110, 1 },
-		{ KC(MINUS), 12, 0/*unknown*/ },
-		{ KC(KP_MINUS), 105, 0/*unknown*/ },
-		{ KC(PLUS), 13, 0/*unknown*/ },
-		{ KC(KP_PLUS), 106, 0/*unknown*/ },
+		{ KC(SPACE), 61, 53, 32 },
+		{ KC(RETURN), 43, 29, 13 },
+		{ KC(UP), 96, 68, 30 },
+		{ KC(KP8), 96, 68, 30 },
+		{ KC(RIGHT), 102, 73, 28 },
+		{ KC(KP6), 102, 73, 28 },
+		{ KC(DOWN), 98, 76, 31 },
+		{ KC(KP2), 98, 76, 31 },
+		{ KC(KP5), 97, 72, UNKNOWN_KEYCODE },
+		{ KC(LEFT), 92, 71, 29 },
+		{ KC(KP4), 92, 71, 29 },
+		{ KC(HOME), 91, 67, 127 },
+		{ KC(KP7), 91, 67, 127 },
+		{ KC(PAGEUP), 101, 69, 18 },
+		{ KC(KP9), 101, 69, 18 },
+		{ KC(END), 93, UNKNOWN_KEYCODE, UNKNOWN_KEYCODE },
+		{ KC(KP1), 93, UNKNOWN_KEYCODE, UNKNOWN_KEYCODE },
+		{ KC(PAGEDOWN), 103, UNKNOWN_KEYCODE },
+		{ KC(KP3), 103, UNKNOWN_KEYCODE },
+		{ KC(F1), 112, 99, UNKNOWN_KEYCODE },
+		{ KC(F2), 113, 100, UNKNOWN_KEYCODE },
+		{ KC(F3), 114, 101, UNKNOWN_KEYCODE },
+		{ KC(F4), 115, 102, UNKNOWN_KEYCODE },
+		{ KC(F5), 116, 103, UNKNOWN_KEYCODE },
+		{ KC(F6), 117, 104, UNKNOWN_KEYCODE },
+		{ KC(a), 31, 31, UNKNOWN_KEYCODE },
+		{ KC(b), 50, 50, UNKNOWN_KEYCODE },
+		{ KC(c), 48, 48, 67 },
+		{ KC(d), 33, 33, UNKNOWN_KEYCODE },
+		{ KC(e), 19, 19, UNKNOWN_KEYCODE },
+		{ KC(f), 34, 34, UNKNOWN_KEYCODE },
+		{ KC(i), 24, 24, UNKNOWN_KEYCODE },
+		{ KC(k), 38, 38, UNKNOWN_KEYCODE },
+		{ KC(m), 52, 52, UNKNOWN_KEYCODE },
+		{ KC(n), 51, 51, UNKNOWN_KEYCODE },
+		{ KC(o), 25, 25, 79 },
+		{ KC(p), 26, 26, 80 },
+		{ KC(r), 20, 20, 82 },
+		{ KC(s), 32, 32, UNKNOWN_KEYCODE },
+		{ KC(w), 18, 18, UNKNOWN_KEYCODE },
+		{ KC(y), 22, 22, UNKNOWN_KEYCODE },
+		{ KC(z), 46, 46, UNKNOWN_KEYCODE },
+		{ KC(0), UNKNOWN_KEYCODE, UNKNOWN_KEYCODE, 48 },
+		{ KC(1), 2, UNKNOWN_KEYCODE, 49 },
+		{ KC(2), 3, UNKNOWN_KEYCODE, 50 },
+		{ KC(3), 4, UNKNOWN_KEYCODE, 51 },
+		{ KC(4), 5, UNKNOWN_KEYCODE, 52 },
+		{ KC(5), 6, UNKNOWN_KEYCODE, 53 },
+		{ KC(6), 7, UNKNOWN_KEYCODE, 54 },
+		{ KC(7), 8, UNKNOWN_KEYCODE, 55 },
+		{ KC(SLASH), 55, 55, 47 },
+		{ KC(ESCAPE), 110, 1, 27 },
+		{ KC(MINUS), 12, UNKNOWN_KEYCODE, UNKNOWN_KEYCODE },
+		{ KC(KP_MINUS), 105, UNKNOWN_KEYCODE, UNKNOWN_KEYCODE },
+		{ KC(PLUS), 13, UNKNOWN_KEYCODE, UNKNOWN_KEYCODE },
+		{ KC(KP_PLUS), 106, UNKNOWN_KEYCODE, UNKNOWN_KEYCODE },
 
 		// Multiple mappings for the keys to the right of the 'M' key,
 		// since these are different for QWERTZ, QWERTY and AZERTY keyboards.
 		// QWERTZ
-		{ KC(COMMA), 53, 0/*unknown*/ },
-		{ KC(PERIOD), 54, 0/*unknown*/ },
+		{ KC(COMMA), 53, UNKNOWN_KEYCODE, UNKNOWN_KEYCODE },
+		{ KC(PERIOD), 54, UNKNOWN_KEYCODE, UNKNOWN_KEYCODE },
 		// AZERTY
-		{ KC(SEMICOLON), 53, 0/*unknown*/ },
-		{ KC(COLON), 54, 0/*unknown*/ },
+		{ KC(SEMICOLON), 53, UNKNOWN_KEYCODE, UNKNOWN_KEYCODE },
+		{ KC(COLON), 54, UNKNOWN_KEYCODE, UNKNOWN_KEYCODE },
 		// QWERTY
-		{ KC(LESS), 53, 0/*unknown*/ },
-		{ KC(GREATER), 54, 0/*unknown*/ }
+		{ KC(LESS), 53, UNKNOWN_KEYCODE, UNKNOWN_KEYCODE },
+		{ KC(GREATER), 54, UNKNOWN_KEYCODE, UNKNOWN_KEYCODE }
 	};
 #undef KC
+#undef UNKNOWN_KEYCODE
 
 	_keyMap.clear();
 
 	for (int i = 0; i < ARRAYSIZE(keys); i++)
-		_keyMap[keys[i].kcScummVM] = (_flags.platform == Common::kPlatformPC98) ? keys[i].kcPC98 : keys[i].kcDOS;
+		_keyMap[keys[i].kcScummVM] = (_flags.platform == Common::kPlatformPC98) ? keys[i].kcPC98 : ((_flags.platform == Common::kPlatformFMTowns) ? keys[i].kcFMTowns : keys[i].kcDOS);
 }
 
 void KyraEngine_v1::updateInput() {
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index e9faa9d..f4c069b 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -4071,7 +4071,7 @@ void LoLEngine::displayAutomap() {
 			gui_notifyButtonListChanged();
 		}
 
-		if (f == 0x30) {
+		if (f == _keyMap[Common::KEYCODE_c]) {
 			for (int i = 0; i < 1024; i++)
 				_levelBlockProperties[i].flags |= 7;
 			_mapUpdateNeeded = true;






More information about the Scummvm-git-logs mailing list