[Scummvm-cvs-logs] SF.net SVN: scummvm: [30286] scummvm/trunk/engines/lure

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Sun Jan 6 03:09:18 CET 2008


Revision: 30286
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30286&view=rev
Author:   dreammaster
Date:     2008-01-05 18:09:18 -0800 (Sat, 05 Jan 2008)

Log Message:
-----------
Fix to show talk dialogs in EGA mode using the EGA palette

Modified Paths:
--------------
    scummvm/trunk/engines/lure/surface.cpp
    scummvm/trunk/engines/lure/surface.h

Modified: scummvm/trunk/engines/lure/surface.cpp
===================================================================
--- scummvm/trunk/engines/lure/surface.cpp	2008-01-06 00:28:36 UTC (rev 30285)
+++ scummvm/trunk/engines/lure/surface.cpp	2008-01-06 02:09:18 UTC (rev 30286)
@@ -700,56 +700,12 @@
 	return (id >> 13) + 1;
 }
 
-TalkDialog::TalkDialog(uint16 characterId, uint16 destCharacterId, uint16 activeItemId, uint16 descId) {
-	debugC(ERROR_DETAILED, kLureDebugAnimations, "TalkDialog(chars=%xh/%xh, item=%d, str=%d", 
-		characterId, destCharacterId, activeItemId, descId);
-	StringData &strings = StringData::getReference();
+void TalkDialog::vgaTalkDialog(Surface *s) {
 	Resources &res = Resources::getReference();
-	char srcCharName[MAX_DESC_SIZE];
-	char destCharName[MAX_DESC_SIZE];
-	char itemName[MAX_DESC_SIZE];
-	int characterArticle = 0, hotspotArticle = 0;
 
-	_characterId = characterId;
-	_destCharacterId = destCharacterId;
-	_activeItemId = activeItemId;
-	_descId = descId;
-
-	HotspotData *talkingChar = res.getHotspot(characterId);
-	HotspotData *destCharacter = (destCharacterId == 0) ? NULL : 
-		res.getHotspot(destCharacterId);
-	HotspotData *itemHotspot = (activeItemId == 0) ? NULL :
-		res.getHotspot(activeItemId);
-	assert(talkingChar);
-
-	strings.getString(talkingChar->nameId & 0x1fff, srcCharName);
-
-	strcpy(destCharName, "");
-	if (destCharacter != NULL) {
-		strings.getString(destCharacter->nameId, destCharName);
-		characterArticle = getArticle(descId, destCharacter->nameId);
-	}
-	strcpy(itemName, "");
-	if (itemHotspot != NULL) {
-		strings.getString(itemHotspot->nameId & 0x1fff, itemName);
-		hotspotArticle = getArticle(descId, itemHotspot->nameId);
-	}
-
-	strings.getString(descId, _desc, itemName, destCharName, hotspotArticle, characterArticle);
-
-	// Apply word wrapping to figure out the needed size of the dialog
-	Surface::wordWrap(_desc, TALK_DIALOG_WIDTH - (TALK_DIALOG_EDGE_SIZE + 3) * 2,
-		_lines, _numLines);
-	_endLine = 0; _endIndex = 0;
-
-	debugC(ERROR_DETAILED, kLureDebugAnimations, "Creating talk dialog for %d lines", _numLines);
-
-	_surface = new Surface(TALK_DIALOG_WIDTH, 
-		(_numLines + 1) * FONT_HEIGHT + TALK_DIALOG_EDGE_SIZE * 4);
-
 	// Draw the dialog
 	byte *pSrc = res.getTalkDialogData().data();
-	byte *pDest = _surface->data().data();
+	byte *pDest = s->data().data();
 	int xPos, yPos;
 
 	// Handle the dialog top
@@ -796,7 +752,62 @@
 		*pDest++ = *pSrc++;
 		*pDest++ = *pSrc++;
 	}
+}
 
+TalkDialog::TalkDialog(uint16 characterId, uint16 destCharacterId, uint16 activeItemId, uint16 descId) {
+	debugC(ERROR_DETAILED, kLureDebugAnimations, "TalkDialog(chars=%xh/%xh, item=%d, str=%d", 
+		characterId, destCharacterId, activeItemId, descId);
+	StringData &strings = StringData::getReference();
+	Resources &res = Resources::getReference();
+	char srcCharName[MAX_DESC_SIZE];
+	char destCharName[MAX_DESC_SIZE];
+	char itemName[MAX_DESC_SIZE];
+	int characterArticle = 0, hotspotArticle = 0;
+	bool isEGA = LureEngine::getReference().isEGA();
+
+
+	_characterId = characterId;
+	_destCharacterId = destCharacterId;
+	_activeItemId = activeItemId;
+	_descId = descId;
+
+	HotspotData *talkingChar = res.getHotspot(characterId);
+	HotspotData *destCharacter = (destCharacterId == 0) ? NULL : 
+		res.getHotspot(destCharacterId);
+	HotspotData *itemHotspot = (activeItemId == 0) ? NULL :
+		res.getHotspot(activeItemId);
+	assert(talkingChar);
+
+	strings.getString(talkingChar->nameId & 0x1fff, srcCharName);
+
+	strcpy(destCharName, "");
+	if (destCharacter != NULL) {
+		strings.getString(destCharacter->nameId, destCharName);
+		characterArticle = getArticle(descId, destCharacter->nameId);
+	}
+	strcpy(itemName, "");
+	if (itemHotspot != NULL) {
+		strings.getString(itemHotspot->nameId & 0x1fff, itemName);
+		hotspotArticle = getArticle(descId, itemHotspot->nameId);
+	}
+
+	strings.getString(descId, _desc, itemName, destCharName, hotspotArticle, characterArticle);
+
+	// Apply word wrapping to figure out the needed size of the dialog
+	Surface::wordWrap(_desc, TALK_DIALOG_WIDTH - (TALK_DIALOG_EDGE_SIZE + 3) * 2,
+		_lines, _numLines);
+	_endLine = 0; _endIndex = 0;
+
+	debugC(ERROR_DETAILED, kLureDebugAnimations, "Creating talk dialog for %d lines", _numLines);
+
+	_surface = new Surface(TALK_DIALOG_WIDTH, 
+		(_numLines + 1) * FONT_HEIGHT + TALK_DIALOG_EDGE_SIZE * 4);
+
+	if (isEGA)
+		_surface->createDialog();
+	else
+		vgaTalkDialog(_surface);
+
 	_wordCountdown = 0;
 
 	// Write out the character name

Modified: scummvm/trunk/engines/lure/surface.h
===================================================================
--- scummvm/trunk/engines/lure/surface.h	2008-01-06 00:28:36 UTC (rev 30285)
+++ scummvm/trunk/engines/lure/surface.h	2008-01-06 02:09:18 UTC (rev 30286)
@@ -111,6 +111,7 @@
 	uint16 _descId;
 
 	int getArticle(uint16 msgId, uint16 objId);
+	void vgaTalkDialog(Surface *s);
 public:
 	TalkDialog(uint16 characterId, uint16 destCharacterId, uint16 activeItemId, uint16 descId);
 	~TalkDialog();


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