[Scummvm-cvs-logs] SF.net SVN: scummvm: [32980] scummvm/branches/gsoc2008-tfmx

marwanhilmi at users.sourceforge.net marwanhilmi at users.sourceforge.net
Thu Jul 10 01:47:30 CEST 2008


Revision: 32980
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32980&view=rev
Author:   marwanhilmi
Date:     2008-07-09 16:47:29 -0700 (Wed, 09 Jul 2008)

Log Message:
-----------
Merged from trunk via svnmerge.

Modified Paths:
--------------
    scummvm/branches/gsoc2008-tfmx/base/main.cpp
    scummvm/branches/gsoc2008-tfmx/dists/engine-data/lure.dat
    scummvm/branches/gsoc2008-tfmx/dists/msvc9/scummvm.vcproj
    scummvm/branches/gsoc2008-tfmx/engines/cine/bg_list.cpp
    scummvm/branches/gsoc2008-tfmx/engines/cine/object.cpp
    scummvm/branches/gsoc2008-tfmx/engines/cine/various.cpp
    scummvm/branches/gsoc2008-tfmx/engines/drascula/talk.cpp
    scummvm/branches/gsoc2008-tfmx/engines/kyra/detection.cpp
    scummvm/branches/gsoc2008-tfmx/engines/kyra/kyra_hof.cpp
    scummvm/branches/gsoc2008-tfmx/engines/kyra/kyra_mr.cpp
    scummvm/branches/gsoc2008-tfmx/engines/kyra/kyra_v1.cpp
    scummvm/branches/gsoc2008-tfmx/engines/kyra/kyra_v1.h
    scummvm/branches/gsoc2008-tfmx/engines/kyra/kyra_v2.cpp
    scummvm/branches/gsoc2008-tfmx/engines/kyra/kyra_v2.h
    scummvm/branches/gsoc2008-tfmx/engines/m4/assets.cpp
    scummvm/branches/gsoc2008-tfmx/engines/m4/converse.cpp
    scummvm/branches/gsoc2008-tfmx/engines/made/screen.cpp
    scummvm/branches/gsoc2008-tfmx/engines/parallaction/exec_br.cpp
    scummvm/branches/gsoc2008-tfmx/engines/parallaction/gfxbase.cpp
    scummvm/branches/gsoc2008-tfmx/engines/parallaction/graphics.cpp
    scummvm/branches/gsoc2008-tfmx/engines/parallaction/graphics.h
    scummvm/branches/gsoc2008-tfmx/engines/parallaction/input.h
    scummvm/branches/gsoc2008-tfmx/engines/parallaction/objects.cpp
    scummvm/branches/gsoc2008-tfmx/engines/parallaction/objects.h
    scummvm/branches/gsoc2008-tfmx/engines/parallaction/parallaction.cpp
    scummvm/branches/gsoc2008-tfmx/engines/parallaction/parallaction_ns.cpp
    scummvm/branches/gsoc2008-tfmx/tools/create_lure/create_lure_dat.cpp

Property Changed:
----------------
    scummvm/branches/gsoc2008-tfmx/


Property changes on: scummvm/branches/gsoc2008-tfmx
___________________________________________________________________
Name: svnmerge-integrated
   - /scummvm/trunk:1-32856
   + /scummvm/trunk:1-32878

Modified: scummvm/branches/gsoc2008-tfmx/base/main.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/base/main.cpp	2008-07-09 23:05:47 UTC (rev 32979)
+++ scummvm/branches/gsoc2008-tfmx/base/main.cpp	2008-07-09 23:47:29 UTC (rev 32980)
@@ -291,6 +291,7 @@
 	
 	Audio::Tfmx _aTfmx;
 	_aTfmx.load();
+//	_aTfmx.
 
 
 

Modified: scummvm/branches/gsoc2008-tfmx/dists/engine-data/lure.dat
===================================================================
(Binary files differ)

Modified: scummvm/branches/gsoc2008-tfmx/dists/msvc9/scummvm.vcproj
===================================================================
--- scummvm/branches/gsoc2008-tfmx/dists/msvc9/scummvm.vcproj	2008-07-09 23:05:47 UTC (rev 32979)
+++ scummvm/branches/gsoc2008-tfmx/dists/msvc9/scummvm.vcproj	2008-07-09 23:47:29 UTC (rev 32980)
@@ -100,9 +100,6 @@
 				Name="VCAppVerifierTool"
 			/>
 			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
@@ -194,9 +191,6 @@
 				Name="VCAppVerifierTool"
 			/>
 			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>

Modified: scummvm/branches/gsoc2008-tfmx/engines/cine/bg_list.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/cine/bg_list.cpp	2008-07-09 23:05:47 UTC (rev 32979)
+++ scummvm/branches/gsoc2008-tfmx/engines/cine/bg_list.cpp	2008-07-09 23:47:29 UTC (rev 32980)
@@ -63,6 +63,7 @@
 void createBgIncrustListElement(int16 objIdx, int16 param) {
 	BGIncrust tmp;
 
+	tmp.unkPtr = 0;
 	tmp.objIdx = objIdx;
 	tmp.param = param;
 	tmp.x = objectTable[objIdx].x;
@@ -90,6 +91,7 @@
 		fHandle.readUint32BE();
 		fHandle.readUint32BE();
 
+		tmp.unkPtr = 0;
 		tmp.objIdx = fHandle.readUint16BE();
 		tmp.param = fHandle.readUint16BE();
 		tmp.x = fHandle.readUint16BE();

Modified: scummvm/branches/gsoc2008-tfmx/engines/cine/object.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/cine/object.cpp	2008-07-09 23:05:47 UTC (rev 32979)
+++ scummvm/branches/gsoc2008-tfmx/engines/cine/object.cpp	2008-07-09 23:47:29 UTC (rev 32980)
@@ -125,6 +125,10 @@
 
 	tmp.objIdx = objIdx;
 	tmp.type = type;
+	tmp.x = 0;
+	tmp.y = 0;
+	tmp.width = 0;
+	tmp.color = 0;
 
 	overlayList.insert(it, tmp);
 }

Modified: scummvm/branches/gsoc2008-tfmx/engines/cine/various.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/cine/various.cpp	2008-07-09 23:05:47 UTC (rev 32979)
+++ scummvm/branches/gsoc2008-tfmx/engines/cine/various.cpp	2008-07-09 23:47:29 UTC (rev 32980)
@@ -95,6 +95,9 @@
 
 byte isInPause = 0;
 
+// TODO: Implement inputVar0's changes in the program
+// Currently inputVar0 isn't updated anywhere even though it's used at least in processSeqListElement.
+uint16 inputVar0 = 0;
 byte inputVar1 = 0;
 uint16 inputVar2 = 0, inputVar3 = 0;
 
@@ -133,6 +136,7 @@
  */
 void addPlayerCommandMessage(int16 cmd) {
 	overlay tmp;
+	memset(&tmp, 0, sizeof(tmp));
 	tmp.objIdx = cmd;
 	tmp.type = 3;
 
@@ -1682,8 +1686,7 @@
 	return returnVar;
 }
 
-uint16 addAni(uint16 param1, uint16 objIdx, const byte *ptrByte, SeqListElement &element, uint16 param3, int16 *param4) {
-	const int8 *ptr = (const int8 *)ptrByte;
+uint16 addAni(uint16 param1, uint16 objIdx, const int8 *ptr, SeqListElement &element, uint16 param3, int16 *param4) {
 	const int8 *ptrData;
 	const int8 *ptr2;
 	int16 di;
@@ -1789,7 +1792,7 @@
 void processSeqListElement(SeqListElement &element) {
 	int16 x = objectTable[element.objIdx].x;
 	int16 y = objectTable[element.objIdx].y;
-	const byte *ptr1 = animDataTable[element.frame].data();
+	const int8 *ptr1 = (const int8 *) animDataTable[element.frame].data();
 	int16 var_10;
 	int16 var_4;
 	int16 var_2;
@@ -1802,22 +1805,44 @@
 	element.var12 = 0;
 
 	if (ptr1) {
-		uint16 param1 = ptr1[1];
-		uint16 param2 = ptr1[2];
+		int16 param1 = ptr1[1];
+		int16 param2 = ptr1[2];
 
 		if (element.varC != 255) {
-			// FIXME: Why is this here? Fingolfin gets lots of these
-			// in his copy of Operation Stealth (value 0 or 236) under
-			// Mac OS X. Maybe it's a endian issue? At least the graphics
-			// in the copy protection screen are partially messed up.
-			warning("processSeqListElement: varC = %d", element.varC);
-		}
+			int16 x2 = element.var18;
+			int16 y2 = element.var1A;
+			if (element.varC) {
+				x2 += objectTable[element.varC].x;
+				y2 += objectTable[element.varC].y;
+			}
+			computeMove1(element, ptr1[4] + x, ptr1[5] + y, param1, param2, x2, y2);
+		} else {
+			if (inputVar0 && allowPlayerInput) {
+				int16 adder = param1 + 1;
+				if (inputVar0 != 1) {
+					adder = -adder;
+				}
+				// FIXME: In Operation Stealth's disassembly global variable 251 is used here
+				//        but it's named as VAR_MOUSE_Y_MODE in ScummVM. Is it correct or a
+				//        left over from Future Wars's reverse engineering?
+				globalVars[VAR_MOUSE_X_POS] = globalVars[251] = ptr1[4] + x + adder;
+			}
 
-		if (globalVars[VAR_MOUSE_X_POS] || globalVars[VAR_MOUSE_Y_POS]) {
-			computeMove1(element, ptr1[4] + x, ptr1[5] + y, param1, param2, globalVars[VAR_MOUSE_X_POS], globalVars[VAR_MOUSE_Y_POS]);
-		} else {
-			element.var16 = 0;
-			element.var14 = 0;
+			if (inputVar1 && allowPlayerInput) {
+				int16 adder = param2 + 1;
+				if (inputVar1 != 1) {
+					adder = -adder;
+				}
+				// TODO: Name currently unnamed global variable 252
+				globalVars[VAR_MOUSE_Y_POS] = globalVars[252] = ptr1[5] + y + adder;
+			}
+
+			if (globalVars[VAR_MOUSE_X_POS] || globalVars[VAR_MOUSE_Y_POS]) {
+				computeMove1(element, ptr1[4] + x, ptr1[5] + y, param1, param2, globalVars[VAR_MOUSE_X_POS], globalVars[VAR_MOUSE_Y_POS]);
+			} else {
+				element.var16 = 0;
+				element.var14 = 0;
+			}
 		}
 
 		var_10 = computeMove2(element);
@@ -1858,14 +1883,14 @@
 			}
 		}
 
-		if (element.var16 + element.var14) {
+		if (element.var16 + element.var14 == 0) {
 			if (element.var1C) {
 				if (element.var1E) {
 					objectTable[element.objIdx].costume = 0;
 					element.var1E = 0;
 				}
 
-				addAni(element.var1C + 3, element.objIdx, ptr1, element, 1, (int16 *) & var2);
+				addAni(element.var1C + 3, element.objIdx, ptr1, element, 1, &var_2);
 
 			}
 		}

Modified: scummvm/branches/gsoc2008-tfmx/engines/drascula/talk.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/drascula/talk.cpp	2008-07-09 23:05:47 UTC (rev 32979)
+++ scummvm/branches/gsoc2008-tfmx/engines/drascula/talk.cpp	2008-07-09 23:47:29 UTC (rev 32980)
@@ -60,7 +60,7 @@
 	int x_talk1[8] = {  56,  86, 116, 146, 176, 206, 236, 266 };
 	int x_talk3[4] = {  80, 102, 124, 146 };
 	int x_talk4[4] = { 119, 158, 197, 236 };
-	int face;
+	int face = 0;
 	int length = strlen(said);
 
 	color_abc(kColorWhite);

Modified: scummvm/branches/gsoc2008-tfmx/engines/kyra/detection.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/kyra/detection.cpp	2008-07-09 23:05:47 UTC (rev 32979)
+++ scummvm/branches/gsoc2008-tfmx/engines/kyra/detection.cpp	2008-07-09 23:47:29 UTC (rev 32980)
@@ -41,7 +41,8 @@
 
 namespace {
 
-#define FLAGS(x, y, z, a, b, c, id) { Common::UNK_LANG, Common::kPlatformUnknown, x, y, z, a, b, c, id }
+#define FLAGS(x, y, z, a, b, c, id) { Common::UNK_LANG, Common::UNK_LANG, Common::UNK_LANG, Common::kPlatformUnknown, x, y, z, a, b, c, id }
+#define FLAGS_FAN(fanLang, repLang, x, y, z, a, b, c, id) { Common::UNK_LANG, fanLang, repLang, Common::kPlatformUnknown, x, y, z, a, b, c, id }
 
 #define KYRA1_FLOPPY_FLAGS FLAGS(false, false, false, false, false, false, Kyra::GI_KYRA1)
 #define KYRA1_FLOPPY_CMP_FLAGS FLAGS(false, false, false, false, false, true, Kyra::GI_KYRA1)
@@ -60,7 +61,8 @@
 #define KYRA2_TOWNS_SJIS_FLAGS FLAGS(false, false, false, true, false, false, Kyra::GI_KYRA2)
 
 #define KYRA3_CD_FLAGS FLAGS(false, false, true, false, true, true, Kyra::GI_KYRA3)
-#define KYRA3_CD_INS_FLAGS FLAGS(false, false, true, false, true, true, Kyra::GI_KYRA3)
+#define KYRA3_CD_INS_FLAGS FLAGS(false, false, true, false, true, false, Kyra::GI_KYRA3)
+#define KYRA3_CD_FAN_FLAGS(x, y) FLAGS_FAN(x, y, false, false, true, false, true, false, Kyra::GI_KYRA3)
 
 const KYRAGameDescription adGameDescs[] = {
 	{
@@ -605,6 +607,53 @@
 		KYRA3_CD_FLAGS
 	},
 
+	// Spanish fan translation, see fr#1994040 "KYRA3: Add support for Spanish fan translation"
+	{
+		{
+			"kyra3",
+			0,
+			{
+				{ "ONETIME.PAK", 0, "9aaca21d2a205ca02ec53132f2911794", -1 },
+				{ "AUD.PAK", 0, 0, -1 },
+				{ 0, 0, 0, 0 }
+			},
+			Common::ES_ESP,
+			Common::kPlatformPC,
+			Common::ADGF_DROPLANGUAGE
+		},
+		KYRA3_CD_FAN_FLAGS(Common::ES_ESP, Common::EN_ANY)
+	},
+	{
+		{
+			"kyra3",
+			0,
+			{
+				{ "ONETIME.PAK", 0, "9aaca21d2a205ca02ec53132f2911794", -1 },
+				{ "AUD.PAK", 0, 0, -1 },
+				{ 0, 0, 0, 0 }
+			},
+			Common::DE_DEU,
+			Common::kPlatformPC,
+			Common::ADGF_DROPLANGUAGE
+		},
+		KYRA3_CD_FAN_FLAGS(Common::ES_ESP, Common::EN_ANY)
+	},
+	{
+		{
+			"kyra3",
+			0,
+			{
+				{ "ONETIME.PAK", 0, "9aaca21d2a205ca02ec53132f2911794", -1 },
+				{ "AUD.PAK", 0, 0, -1 },
+				{ 0, 0, 0, 0 }
+			},
+			Common::FR_FRA,
+			Common::kPlatformPC,
+			Common::ADGF_DROPLANGUAGE
+		},
+		KYRA3_CD_FAN_FLAGS(Common::ES_ESP, Common::EN_ANY)
+	},
+
 	{ AD_TABLE_END_MARKER, FLAGS(0, 0, 0, 0, 0, 0, 0) }
 };
 

Modified: scummvm/branches/gsoc2008-tfmx/engines/kyra/kyra_hof.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/kyra/kyra_hof.cpp	2008-07-09 23:05:47 UTC (rev 32979)
+++ scummvm/branches/gsoc2008-tfmx/engines/kyra/kyra_hof.cpp	2008-07-09 23:47:29 UTC (rev 32980)
@@ -2024,6 +2024,9 @@
 		break;
 	}
 
+	if (_flags.lang == _flags.replacedLang && _flags.fanLang != Common::UNK_LANG)
+		_flags.lang = _flags.fanLang;
+
 	ConfMan.set("language", Common::getLanguageCode(_flags.lang));
 
 	KyraEngine_v1::writeSettings();

Modified: scummvm/branches/gsoc2008-tfmx/engines/kyra/kyra_mr.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/kyra/kyra_mr.cpp	2008-07-09 23:05:47 UTC (rev 32979)
+++ scummvm/branches/gsoc2008-tfmx/engines/kyra/kyra_mr.cpp	2008-07-09 23:47:29 UTC (rev 32980)
@@ -1543,6 +1543,9 @@
 		break;
 	}
 
+	if (_flags.lang == _flags.replacedLang && _flags.fanLang != Common::UNK_LANG)
+		_flags.lang = _flags.fanLang;
+
 	ConfMan.set("language", Common::getLanguageCode(_flags.lang));
 
 	ConfMan.setBool("studio_audience", _configStudio);

Modified: scummvm/branches/gsoc2008-tfmx/engines/kyra/kyra_v1.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/kyra/kyra_v1.cpp	2008-07-09 23:05:47 UTC (rev 32979)
+++ scummvm/branches/gsoc2008-tfmx/engines/kyra/kyra_v1.cpp	2008-07-09 23:47:29 UTC (rev 32980)
@@ -173,36 +173,6 @@
 			_gameToLoad = -1;
 	}
 
-	_lang = 0;
-	Common::Language lang = Common::parseLanguage(ConfMan.get("language"));
-
-	if (_flags.gameID == GI_KYRA2 || _flags.gameID == GI_KYRA3) {
-		switch (lang) {
-		case Common::EN_ANY:
-		case Common::EN_USA:
-		case Common::EN_GRB:
-			_lang = 0;
-			break;
-
-		case Common::FR_FRA:
-			_lang = 1;
-			break;
-
-		case Common::DE_DEU:
-			_lang = 2;
-			break;
-
-		case Common::JA_JPN:
-			_lang = 3;
-			break;
-
-		default:
-			warning("unsupported language, switching back to English");
-			_lang = 0;
-			break;
-		}
-	}
-
 	return 0;
 }
 
@@ -277,6 +247,8 @@
 void KyraEngine_v1::registerDefaultSettings() {
 	if (_flags.gameID != GI_KYRA3)
 		ConfMan.registerDefault("cdaudio", (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98));
+	if (_flags.fanLang != Common::UNK_LANG)
+		ConfMan.registerDefault("subtitles", true);
 }
 
 void KyraEngine_v1::readSettings() {

Modified: scummvm/branches/gsoc2008-tfmx/engines/kyra/kyra_v1.h
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/kyra/kyra_v1.h	2008-07-09 23:05:47 UTC (rev 32979)
+++ scummvm/branches/gsoc2008-tfmx/engines/kyra/kyra_v1.h	2008-07-09 23:47:29 UTC (rev 32980)
@@ -44,6 +44,11 @@
 
 struct GameFlags {
 	Common::Language lang;
+
+	// language overwrites of fan translations (only needed for multilingual games)
+	Common::Language fanLang;
+	Common::Language replacedLang;
+
 	Common::Platform platform;
 
 	bool isDemo					: 1;
@@ -212,7 +217,6 @@
 
 	// detection
 	GameFlags _flags;
-	int _lang;
 
 	// opcode
 	virtual void setupOpcodeTable() = 0;

Modified: scummvm/branches/gsoc2008-tfmx/engines/kyra/kyra_v2.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/kyra/kyra_v2.cpp	2008-07-09 23:05:47 UTC (rev 32979)
+++ scummvm/branches/gsoc2008-tfmx/engines/kyra/kyra_v2.cpp	2008-07-09 23:47:29 UTC (rev 32980)
@@ -23,6 +23,8 @@
  *
  */
 
+#include "common/config-manager.h"
+
 #include "kyra/kyra_v2.h"
 #include "kyra/screen_v2.h"
 #include "kyra/debugger.h"
@@ -70,6 +72,36 @@
 	memset(&_mainCharacter.inventory, -1, sizeof(_mainCharacter.inventory));
 
 	_pauseStart = 0;
+
+	_lang = 0;
+	Common::Language lang = Common::parseLanguage(ConfMan.get("language"));
+	if (lang == _flags.fanLang && _flags.replacedLang != Common::UNK_LANG)
+		lang = _flags.replacedLang;
+
+	switch (lang) {
+	case Common::EN_ANY:
+	case Common::EN_USA:
+	case Common::EN_GRB:
+		_lang = 0;
+		break;
+
+	case Common::FR_FRA:
+		_lang = 1;
+		break;
+
+	case Common::DE_DEU:
+		_lang = 2;
+		break;
+
+	case Common::JA_JPN:
+		_lang = 3;
+		break;
+
+	default:
+		warning("unsupported language, switching back to English");
+		_lang = 0;
+		break;
+	}
 }
 
 KyraEngine_v2::~KyraEngine_v2() {

Modified: scummvm/branches/gsoc2008-tfmx/engines/kyra/kyra_v2.h
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/kyra/kyra_v2.h	2008-07-09 23:05:47 UTC (rev 32979)
+++ scummvm/branches/gsoc2008-tfmx/engines/kyra/kyra_v2.h	2008-07-09 23:47:29 UTC (rev 32980)
@@ -94,6 +94,9 @@
 	virtual void update() = 0;
 	virtual void updateWithText() = 0;
 
+	// detection
+	int _lang;
+
 	// MainMenu
 	MainMenu *_menu;
 

Modified: scummvm/branches/gsoc2008-tfmx/engines/m4/assets.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/m4/assets.cpp	2008-07-09 23:05:47 UTC (rev 32979)
+++ scummvm/branches/gsoc2008-tfmx/engines/m4/assets.cpp	2008-07-09 23:47:29 UTC (rev 32980)
@@ -201,6 +201,7 @@
 	Common::SeekableReadStream *spriteDataStream = sprite.getItemStream(3);
 	SpriteAssetFrame frame;
 	for (curFrame = 0; curFrame < _frameCount; curFrame++) {
+		frame.stream = 0;
 		frame.comp = 0;
 		frameOffset = spriteStream->readUint32LE();
 		_frameOffsets.push_back(frameOffset);

Modified: scummvm/branches/gsoc2008-tfmx/engines/m4/converse.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/m4/converse.cpp	2008-07-09 23:05:47 UTC (rev 32979)
+++ scummvm/branches/gsoc2008-tfmx/engines/m4/converse.cpp	2008-07-09 23:47:29 UTC (rev 32980)
@@ -379,7 +379,7 @@
 	uint32 header = convS->readUint32LE();
 	uint32 size;
 	uint32 chunk;
-	uint32 data;
+	uint32 data = 0;
 	uint32 i;
 	ConvEntry* curEntry = NULL;
 	ConvEntry* replyEntry = NULL;

Modified: scummvm/branches/gsoc2008-tfmx/engines/made/screen.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/made/screen.cpp	2008-07-09 23:05:47 UTC (rev 32979)
+++ scummvm/branches/gsoc2008-tfmx/engines/made/screen.cpp	2008-07-09 23:47:29 UTC (rev 32980)
@@ -822,6 +822,8 @@
 	if (((uint) index) > _spriteList.size()) {
 		SpriteListItem emptyItem;
 		emptyItem.index = 0;
+		emptyItem.xofs = 0;
+		emptyItem.yofs = 0;
 		return emptyItem;
 	} else {
 		return _spriteList[index - 1];

Modified: scummvm/branches/gsoc2008-tfmx/engines/parallaction/exec_br.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/parallaction/exec_br.cpp	2008-07-09 23:05:47 UTC (rev 32979)
+++ scummvm/branches/gsoc2008-tfmx/engines/parallaction/exec_br.cpp	2008-07-09 23:47:29 UTC (rev 32980)
@@ -100,8 +100,8 @@
 }
 
 void Parallaction_br::clearSubtitles() {
-	_gfx->freeLabels();
-	_subtitle[0] = _subtitle[1] = -1;
+	_gfx->hideLabel(_subtitle[0]);
+	_gfx->hideLabel(_subtitle[1]);
 }
 
 

Modified: scummvm/branches/gsoc2008-tfmx/engines/parallaction/gfxbase.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/parallaction/gfxbase.cpp	2008-07-09 23:05:47 UTC (rev 32979)
+++ scummvm/branches/gsoc2008-tfmx/engines/parallaction/gfxbase.cpp	2008-07-09 23:47:29 UTC (rev 32980)
@@ -92,6 +92,7 @@
 	// animation Z is not set here, but controlled by game scripts and user interaction.
 	// it is always >=0 and <screen height
 	obj->type = kGfxObjTypeAnim;
+	obj->transparentKey = 0;
 	_gfxobjList.push_back(obj);
 	return obj;
 }
@@ -103,6 +104,7 @@
 
 	obj->z = kGfxObjGetZ;	// this preset Z value ensures that get zones are drawn after doors but before animations
 	obj->type = kGfxObjTypeGet;
+	obj->transparentKey = 0;
 	_gfxobjList.push_back(obj);
 	return obj;
 }
@@ -113,6 +115,7 @@
 
 	obj->z = kGfxObjDoorZ;	// this preset Z value ensures that doors are drawn first
 	obj->type = kGfxObjTypeDoor;
+	obj->transparentKey = 0;
 	_gfxobjList.push_back(obj);
 	return obj;
 }
@@ -150,11 +153,32 @@
 	Common::sort(first, last, compareZ);
 }
 
-void Gfx::drawGfxObjects(Graphics::Surface &surf) {
 
+void Gfx::drawGfxObject(GfxObj *obj, Graphics::Surface &surf, bool scene) {
+	if (!obj->isVisible()) {
+		return;
+	}
+
 	Common::Rect rect;
 	byte *data;
 
+	uint scrollX = (scene) ? -_varScrollX : 0;
+
+	obj->getRect(obj->frame, rect);
+	rect.translate(obj->x + scrollX, obj->y);
+	data = obj->getData(obj->frame);
+
+	if (obj->getSize(obj->frame) == obj->getRawSize(obj->frame)) {
+		blt(rect, data, &surf, obj->layer, obj->transparentKey);
+	} else {
+		unpackBlt(rect, data, obj->getRawSize(obj->frame), &surf, obj->layer, obj->transparentKey);
+	}
+
+}
+
+
+void Gfx::drawGfxObjects(Graphics::Surface &surf) {
+
 	sortAnimations();
 	// TODO: some zones don't appear because of wrong masking (3 or 0?)
 	// TODO: Dr.Ki is not visible inside the club
@@ -164,17 +188,7 @@
 	GfxObjList::iterator e = _gfxobjList.end();
 
 	for (; b != e; b++) {
-		GfxObj *obj = *b;
-		if (obj->isVisible()) {
-			obj->getRect(obj->frame, rect);
-			rect.translate(obj->x - _varScrollX, obj->y);
-			data = obj->getData(obj->frame);
-			if (obj->getSize(obj->frame) == obj->getRawSize(obj->frame)) {
-				blt(rect, data, &surf, obj->layer, 0);
-			} else {
-				unpackBlt(rect, data, obj->getRawSize(obj->frame), &surf, obj->layer, 0);
-			}
-		}
+		drawGfxObject(*b, surf, true);
 	}
 }
 

Modified: scummvm/branches/gsoc2008-tfmx/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/parallaction/graphics.cpp	2008-07-09 23:05:47 UTC (rev 32979)
+++ scummvm/branches/gsoc2008-tfmx/engines/parallaction/graphics.cpp	2008-07-09 23:47:29 UTC (rev 32980)
@@ -356,17 +356,7 @@
 
 	Graphics::Surface *surf = g_system->lockScreen();
 	for (uint i = 0; i < _numItems; i++) {
-		GfxObj *obj = _items[i].data;
-
-		Common::Rect rect;
-		obj->getRect(obj->frame, rect);
-		rect.translate(obj->x, obj->y);
-
-		if (obj->getSize(obj->frame) == obj->getRawSize(obj->frame)) {
-			blt(rect, obj->getData(obj->frame), surf, LAYER_FOREGROUND, _items[i].transparentColor);
-		} else {
-			unpackBlt(rect, obj->getData(obj->frame), obj->getRawSize(obj->frame), surf, LAYER_FOREGROUND, _items[i].transparentColor);
-		}
+		drawGfxObject(_items[i].data, *surf, false);
 	}
 	g_system->unlockScreen();
 }
@@ -540,10 +530,9 @@
 	surf.fillRect(Common::Rect(w,h), LABEL_TRANSPARENT_COLOR);
 }
 
-Label *Gfx::renderFloatingLabel(Font *font, char *text) {
+uint Gfx::renderFloatingLabel(Font *font, char *text) {
 
-	Label *label = new Label;
-	Graphics::Surface *cnv = &label->_cnv;
+	Graphics::Surface *cnv = new Graphics::Surface;
 
 	uint w, h;
 
@@ -569,14 +558,74 @@
 		drawText(font, cnv, 0, 0, text, 0);
 	}
 
-	return label;
+	GfxObj *obj = new GfxObj(kGfxObjTypeLabel, new SurfaceToFrames(cnv), "floatingLabel");
+	obj->transparentKey = LABEL_TRANSPARENT_COLOR;
+	obj->layer = LAYER_FOREGROUND;
+
+	uint id = _labels.size();
+	_labels.insert_at(id, obj);
+
+	return id;
 }
 
+void Gfx::showFloatingLabel(uint label) {
+	assert(label < _labels.size());
+
+	hideFloatingLabel();
+
+	_labels[label]->x = -1000;
+	_labels[label]->y = -1000;
+	_labels[label]->setFlags(kGfxObjVisible);
+
+	_floatingLabel = label;
+}
+
+void Gfx::hideFloatingLabel() {
+	if (_floatingLabel != NO_FLOATING_LABEL) {
+		_labels[_floatingLabel]->clearFlags(kGfxObjVisible);
+	}
+	_floatingLabel = NO_FLOATING_LABEL;
+}
+
+
+void Gfx::updateFloatingLabel() {
+	if (_floatingLabel == NO_FLOATING_LABEL) {
+		return;
+	}
+
+	int16 _si, _di;
+
+	Common::Point	cursor;
+	_vm->_input->getCursorPos(cursor);
+
+	Common::Rect r;
+	_labels[_floatingLabel]->getRect(0, r);
+
+	if (_vm->_input->_activeItem._id != 0) {
+		_si = cursor.x + 16 - r.width()/2;
+		_di = cursor.y + 34;
+	} else {
+		_si = cursor.x + 8 - r.width()/2;
+		_di = cursor.y + 21;
+	}
+
+	if (_si < 0) _si = 0;
+	if (_di > 190) _di = 190;
+
+	if (r.width() + _si > _vm->_screenWidth)
+		_si = _vm->_screenWidth - r.width();
+
+	_labels[_floatingLabel]->x = _si;
+	_labels[_floatingLabel]->y = _di;
+}
+
+
+
+
 uint Gfx::createLabel(Font *font, const char *text, byte color) {
-	assert(_numLabels < MAX_NUM_LABELS);
+	assert(_labels.size() < MAX_NUM_LABELS);
 
-	Label *label = new Label;
-	Graphics::Surface *cnv = &label->_cnv;
+	Graphics::Surface *cnv = new Graphics::Surface;
 
 	uint w, h;
 
@@ -597,123 +646,65 @@
 		drawText(font, cnv, 0, 0, text, color);
 	}
 
-	uint id = _numLabels;
-	_labels[id] = label;
-	_numLabels++;
+	GfxObj *obj = new GfxObj(kGfxObjTypeLabel, new SurfaceToFrames(cnv), "label");
+	obj->transparentKey = LABEL_TRANSPARENT_COLOR;
+	obj->layer = LAYER_FOREGROUND;
 
+	int id = _labels.size();
+
+	_labels.insert_at(id, obj);
+
 	return id;
 }
 
 void Gfx::showLabel(uint id, int16 x, int16 y) {
-	assert(id < _numLabels);
-	_labels[id]->_visible = true;
+	assert(id < _labels.size());
+	_labels[id]->setFlags(kGfxObjVisible);
 
+	Common::Rect r;
+	_labels[id]->getRect(0, r);
+
 	if (x == CENTER_LABEL_HORIZONTAL) {
-		x = CLIP<int16>((_vm->_screenWidth - _labels[id]->_cnv.w) / 2, 0, _vm->_screenWidth/2);
+		x = CLIP<int16>((_vm->_screenWidth - r.width()) / 2, 0, _vm->_screenWidth/2);
 	}
 
 	if (y == CENTER_LABEL_VERTICAL) {
-		y = CLIP<int16>((_vm->_screenHeight - _labels[id]->_cnv.h) / 2, 0, _vm->_screenHeight/2);
+		y = CLIP<int16>((_vm->_screenHeight - r.height()) / 2, 0, _vm->_screenHeight/2);
 	}
 
-	_labels[id]->_pos.x = x;
-	_labels[id]->_pos.y = y;
+	_labels[id]->x = x;
+	_labels[id]->y = y;
 }
 
 void Gfx::hideLabel(uint id) {
-	assert(id < _numLabels);
-	_labels[id]->_visible = false;
+	assert(id < _labels.size());
+	_labels[id]->clearFlags(kGfxObjVisible);
 }
 
 void Gfx::freeLabels() {
-	for (uint i = 0; i < _numLabels; i++) {
+	for (uint i = 0; i < _labels.size(); i++) {
 		delete _labels[i];
 	}
-	_numLabels = 0;
+	_labels.clear();
 }
 
-
-void Gfx::setFloatingLabel(Label *label) {
-	_floatingLabel = label;
-
-	if (_floatingLabel) {
-		_floatingLabel->resetPosition();
-	}
-}
-
-void Gfx::updateFloatingLabel() {
-	if (!_floatingLabel) {
-		return;
-	}
-
-	int16 _si, _di;
-
-	Common::Point	cursor;
-	_vm->_input->getCursorPos(cursor);
-
-	if (_vm->_input->_activeItem._id != 0) {
-		_si = cursor.x + 16 - _floatingLabel->_cnv.w/2;
-		_di = cursor.y + 34;
-	} else {
-		_si = cursor.x + 8 - _floatingLabel->_cnv.w/2;
-		_di = cursor.y + 21;
-	}
-
-	if (_si < 0) _si = 0;
-	if (_di > 190) _di = 190;
-
-	if (_floatingLabel->_cnv.w + _si > _vm->_screenWidth)
-		_si = _vm->_screenWidth - _floatingLabel->_cnv.w;
-
-	_floatingLabel->_pos.x = _si;
-	_floatingLabel->_pos.y = _di;
-}
-
 void Gfx::drawLabels() {
-	if ((!_floatingLabel) && (_numLabels == 0)) {
+	if (_labels.size() == 0) {
 		return;
 	}
+
 	updateFloatingLabel();
 
 	Graphics::Surface* surf = g_system->lockScreen();
 
-	for (uint i = 0; i < _numLabels; i++) {
-		if (_labels[i]->_visible) {
-			Common::Rect r(_labels[i]->_cnv.w, _labels[i]->_cnv.h);
-			r.moveTo(_labels[i]->_pos);
-			blt(r, (byte*)_labels[i]->_cnv.getBasePtr(0, 0), surf, LAYER_FOREGROUND, LABEL_TRANSPARENT_COLOR);
-		}
+	for (uint i = 0; i < _labels.size(); i++) {
+		drawGfxObject(_labels[i], *surf, false);
 	}
 
-	if (_floatingLabel) {
-		Common::Rect r(_floatingLabel->_cnv.w, _floatingLabel->_cnv.h);
-		r.moveTo(_floatingLabel->_pos);
-        blt(r, (byte*)_floatingLabel->_cnv.getBasePtr(0, 0), surf, LAYER_FOREGROUND, LABEL_TRANSPARENT_COLOR);
-	}
-
 	g_system->unlockScreen();
 }
 
-Label::Label() {
-	resetPosition();
-	_visible = false;
-}
 
-Label::~Label() {
-	free();
-}
-
-void Label::free() {
-	_cnv.free();
-	resetPosition();
-}
-
-void Label::resetPosition() {
-	_pos.x = -1000;
-	_pos.y = -1000;
-}
-
-
 void Gfx::getStringExtent(Font *font, char *text, uint16 maxwidth, int16* width, int16* height) {
 
 	uint16 lines = 0;
@@ -790,8 +781,7 @@
 
 	_numBalloons = 0;
 	_numItems = 0;
-	_numLabels = 0;
-	_floatingLabel = 0;
+	_floatingLabel = NO_FLOATING_LABEL;
 
 	_screenX = 0;
 	_screenY = 0;
@@ -826,9 +816,9 @@
 	_items[id].data = frames;
 	_items[id].data->x = x;
 	_items[id].data->y = y;
+	_items[id].data->layer = LAYER_FOREGROUND;
+	_items[id].data->transparentKey = transparentColor;
 
-	_items[id].transparentColor = transparentColor;
-
 	_numItems++;
 
 	return id;
@@ -837,6 +827,7 @@
 void Gfx::setItemFrame(uint item, uint16 f) {
 	assert(item < _numItems);
 	_items[item].data->frame = f;
+	_items[item].data->setFlags(kGfxObjVisible);
 }
 
 Gfx::Balloon* Gfx::getBalloon(uint id) {

Modified: scummvm/branches/gsoc2008-tfmx/engines/parallaction/graphics.h
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/parallaction/graphics.h	2008-07-09 23:05:47 UTC (rev 32979)
+++ scummvm/branches/gsoc2008-tfmx/engines/parallaction/graphics.h	2008-07-09 23:47:29 UTC (rev 32980)
@@ -326,22 +326,8 @@
 #define CENTER_LABEL_HORIZONTAL	-1
 #define CENTER_LABEL_VERTICAL	-1
 
-struct Label {
-	Graphics::Surface	_cnv;
 
-	Common::Point		_pos;
-	bool				_visible;
 
-	Label();
-	~Label();
-
-	void free();
-	void resetPosition();
-};
-
-
-
-
 #define MAX_BALLOON_WIDTH 130
 
 class Parallaction;
@@ -357,7 +343,8 @@
 
 	kGfxObjTypeDoor = 0,
 	kGfxObjTypeGet = 1,
-	kGfxObjTypeAnim = 2
+	kGfxObjTypeAnim = 2,
+	kGfxObjTypeLabel = 3
 };
 
 enum {
@@ -381,6 +368,7 @@
 	uint type;
 	uint frame;
 	uint layer;
+	uint transparentKey;
 
 	GfxObj(uint type, Frames *frames, const char *name = NULL);
 	virtual ~GfxObj();
@@ -478,9 +466,12 @@
 	void clearGfxObjects();
 	void sortAnimations();
 
+
 	// labels
-	void setFloatingLabel(Label *label);
-	Label *renderFloatingLabel(Font *font, char *text);
+	void showFloatingLabel(uint label);
+	void hideFloatingLabel();
+
+	uint renderFloatingLabel(Font *font, char *text);
 	uint createLabel(Font *font, const char *text, byte color);
 	void showLabel(uint id, int16 x, int16 y);
 	void hideLabel(uint id);
@@ -572,20 +563,19 @@
 	uint	_numBalloons;
 
 	struct Item {
-		uint16 frame;
 		GfxObj *data;
-
-		byte transparentColor;
-		Common::Rect rect;
 	} _items[14];
 
 	uint	_numItems;
 
-	#define MAX_NUM_LABELS	5
-	Label*	_labels[MAX_NUM_LABELS];
-	uint	_numLabels;
-	Label	*_floatingLabel;
+	#define MAX_NUM_LABELS	20
+	#define NO_FLOATING_LABEL	1000
 
+	typedef Common::Array<GfxObj*> GfxObjArray;
+	GfxObjArray	_labels;
+
+	uint _floatingLabel;
+
 	void drawInventory();
 	void updateFloatingLabel();
 	void drawLabels();
@@ -601,6 +591,7 @@
 	void drawText(Font *font, Graphics::Surface* surf, uint16 x, uint16 y, const char *text, byte color);
 	void drawWrappedText(Font *font, Graphics::Surface* surf, char *text, byte color, int16 wrapwidth);
 
+	void drawGfxObject(GfxObj *obj, Graphics::Surface &surf, bool scene);
     void blt(const Common::Rect& r, byte *data, Graphics::Surface *surf, uint16 z, byte transparentColor);
 	void unpackBlt(const Common::Rect& r, byte *data, uint size, Graphics::Surface *surf, uint16 z, byte transparentColor);
 };

Modified: scummvm/branches/gsoc2008-tfmx/engines/parallaction/input.h
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/parallaction/input.h	2008-07-09 23:05:47 UTC (rev 32979)
+++ scummvm/branches/gsoc2008-tfmx/engines/parallaction/input.h	2008-07-09 23:47:29 UTC (rev 32980)
@@ -44,7 +44,7 @@
 	Common::Point	_mousePos;
 	int16		_inventoryIndex;
 	ZonePtr		_zone;
-	Label*			_label;
+	uint		_label;
 };
 
 class Input {

Modified: scummvm/branches/gsoc2008-tfmx/engines/parallaction/objects.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/parallaction/objects.cpp	2008-07-09 23:05:47 UTC (rev 32979)
+++ scummvm/branches/gsoc2008-tfmx/engines/parallaction/objects.cpp	2008-07-09 23:47:29 UTC (rev 32980)
@@ -182,7 +182,6 @@
 		break;
 	}
 
-	delete _label;
 }
 
 void Zone::getRect(Common::Rect& r) const {

Modified: scummvm/branches/gsoc2008-tfmx/engines/parallaction/objects.h
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/parallaction/objects.h	2008-07-09 23:05:47 UTC (rev 32979)
+++ scummvm/branches/gsoc2008-tfmx/engines/parallaction/objects.h	2008-07-09 23:47:29 UTC (rev 32980)
@@ -287,7 +287,7 @@
 	int16			_bottom;
 	uint32			_type;
 	uint32			_flags;
-	Label			*_label;
+	uint			_label;
 	uint16			field_2C;		// unused
 	uint16			field_2E;		// unused
 	TypeData		u;

Modified: scummvm/branches/gsoc2008-tfmx/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/parallaction/parallaction.cpp	2008-07-09 23:05:47 UTC (rev 32979)
+++ scummvm/branches/gsoc2008-tfmx/engines/parallaction/parallaction.cpp	2008-07-09 23:47:29 UTC (rev 32980)
@@ -290,12 +290,12 @@
 	switch (data->_event) {
 	case kEvEnterZone:
 		debugC(2, kDebugInput, "processInput: kEvEnterZone");
-		_gfx->setFloatingLabel(data->_label);
+		_gfx->showFloatingLabel(data->_label);
 		break;
 
 	case kEvExitZone:
 		debugC(2, kDebugInput, "processInput: kEvExitZone");
-		_gfx->setFloatingLabel(0);
+		_gfx->hideFloatingLabel();
 		break;
 
 	case kEvAction:
@@ -308,7 +308,7 @@
 
 	case kEvOpenInventory:
 		_input->stopHovering();
-		_gfx->setFloatingLabel(0);
+		_gfx->hideFloatingLabel();
 		if (hitZone(kZoneYou, data->_mousePos.x, data->_mousePos.y) == 0) {
 			setArrowCursor();
 		}

Modified: scummvm/branches/gsoc2008-tfmx/engines/parallaction/parallaction_ns.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/engines/parallaction/parallaction_ns.cpp	2008-07-09 23:05:47 UTC (rev 32979)
+++ scummvm/branches/gsoc2008-tfmx/engines/parallaction/parallaction_ns.cpp	2008-07-09 23:47:29 UTC (rev 32980)
@@ -187,7 +187,7 @@
 	debugC(1, kDebugInput, "setting mouse cursor to arrow");
 
 	// this stuff is needed to avoid artifacts with labels and selected items when switching cursors
-	_gfx->setFloatingLabel(0);
+	_gfx->hideFloatingLabel();
 	_input->_activeItem._id = 0;
 
 	_system->setMouseCursor(_mouseArrow, MOUSEARROW_WIDTH, MOUSEARROW_HEIGHT, 0, 0, 0);
@@ -298,7 +298,7 @@
 
 	_soundMan->playLocationMusic(location);
 
-	_gfx->setFloatingLabel(0);
+	_gfx->hideFloatingLabel();
 	_gfx->freeLabels();
 
 	_input->stopHovering();

Modified: scummvm/branches/gsoc2008-tfmx/tools/create_lure/create_lure_dat.cpp
===================================================================
--- scummvm/branches/gsoc2008-tfmx/tools/create_lure/create_lure_dat.cpp	2008-07-09 23:05:47 UTC (rev 32979)
+++ scummvm/branches/gsoc2008-tfmx/tools/create_lure/create_lure_dat.cpp	2008-07-09 23:47:29 UTC (rev 32980)
@@ -1312,14 +1312,14 @@
 
 const char *italianTextStrings[NUM_TEXT_ENTRIES] = {
 	"Prendi", NULL,	"Spingi", "Tira", "Aziona", "Apri", "Chiudi", "Blocca",
-	"Sblocca", "Usa", "Dai", "Parla con", "Ordina a", "Buy", "Guarda", "Osserva",
-	"Guarda tra", "Chiedi", NULL,  "Bevi", "Stato", "Vai a", "Ritorna",
+	"Sblocca", "Usa", "Dai", "Parla con", "Ordina a", "Compra", "Guarda", "Osserva",
+	"Guarda attraverso", "Chiedi", NULL,  "Bevi", "Stato", "Vai a", "Ritorna",
 	"Corrompi", "Esamina",
-	"Inform", "Reavvia", "Salva gioco", "Ripristina", "Abbandona", "Testo lento\x8B",
+	"Crediti", "Ricomincia", "Salva gioco", "Ripristina", "Abbandona", "Testo lento\x8B",
 	"Testo veloce\x8B",  "Sonoro acceso", "Sonoro spento",
 	"(niente)", " per ", " a ", " su ",
 	"e poi", "finito", "Sei sicuro (s/n)?",
-	"Stai portando ", "niente", "e hai ", "soldi", "soldis",
+	"Stai portando ", "niente", "Hai ", "soldo", "soldi",
 	NULL, "l' ", "la ", NULL, "le ", "i ", "il ", NULL, NULL, NULL
 };
 


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




More information about the Scummvm-git-logs mailing list