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

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Mon Aug 7 15:16:16 CEST 2006


Revision: 23690
Author:   dreammaster
Date:     2006-08-07 06:16:07 -0700 (Mon, 07 Aug 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=23690&view=rev

Log Message:
-----------
Dialog::showMessage transferred over to the Hotspot class. Also enhanced TalkDialog to handle being passed a destination character and active item

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	2006-08-07 13:13:20 UTC (rev 23689)
+++ scummvm/trunk/engines/lure/surface.cpp	2006-08-07 13:16:07 UTC (rev 23690)
@@ -409,81 +409,41 @@
 
 void Dialog::show(uint16 stringId) {
 	char buffer[MAX_DESC_SIZE];
-	Resources &res = Resources::getReference();
-	Room &r = Room::getReference();
 	StringData &sl = StringData::getReference();
 
-	const char *actionName = res.getCurrentActionStr();
-	char hotspotName[MAX_HOTSPOT_NAME_SIZE];
-	if (r.hotspotId() == 0) 
-		strcpy(hotspotName, "");
-	else
-		sl.getString(r.hotspot().nameId, hotspotName, NULL, NULL);
-
-	sl.getString(stringId, buffer, hotspotName, actionName);
+	sl.getString(stringId, buffer);
 	show(buffer);
 }
 
-void Dialog::showMessage(uint16 messageId, uint16 characterId) {
+/*--------------------------------------------------------------------------*/
+
+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();
-	MemoryBlock *data = res.messagesData();
-	Hotspot *charHotspot = res.getActiveHotspot(characterId);
-	Hotspot *hotspot;
-	uint16 *v = (uint16 *) data->data();
-	uint16 v2, idVal;
-	messageId &= 0x7fff;
+	char srcCharName[MAX_DESC_SIZE];
+	char destCharName[MAX_DESC_SIZE];
+	char itemName[MAX_DESC_SIZE];
 
-	// Skip through header to find table for given character
-	while (READ_LE_UINT16(v) != characterId) v += 2;
+	HotspotData *talkingChar = res.getHotspot(characterId);
+	HotspotData *destCharacter = (destCharacterId == 0) ? NULL : 
+		res.getHotspot(destCharacterId);
+	HotspotData *itemHotspot = (activeItemId == 0) ? NULL :
+		res.getHotspot(activeItemId);
+	assert(talkingChar);
 
-	// Scan through secondary list
-	++v;
-	v = (uint16 *) (data->data() + READ_LE_UINT16(v));
-	v2 = 0;
-	while ((idVal = READ_LE_UINT16(v)) != 0xffff) {
-		++v;
-		if (READ_LE_UINT16(v) == messageId) break;
-		++v;
-	}
+	strings.getString(talkingChar->nameId, srcCharName);
 
-	// default response if a specific response not found
-	if (idVal == 0xffff) idVal = 0x8c4; 
-	
-	if (idVal == 0x76) {
-		// Special code id for showing the puzzled talk bubble
-		if (!charHotspot) return;
-		hotspot = new Hotspot(charHotspot, PUZZLED_ANIM_ID);
-		res.addHotspot(hotspot);
+	strcpy(destCharName, "");
+	if (destCharacter != NULL)
+		strings.getString(destCharacter->nameId, destCharName);
+	strcpy(itemName, "");
+	if (itemHotspot != NULL)
+		strings.getStringWithArticle(itemHotspot->nameId, itemName);
 
-	} else if (idVal == 0x120) {
-		// Special code id for showing the exclamation talk bubble
-		if (!charHotspot) return;
-		hotspot = new Hotspot(charHotspot, EXCLAMATION_ANIM_ID);
-		res.addHotspot(hotspot);
+	strings.getString(descId, _desc, itemName, destCharName);
 
-	} else if (idVal >= 0x8000) {
-		// Handle string display
-		idVal &= 0x7fff;
-		Dialog::show(idVal);
-		
-	} else if (idVal != 0) {
-		// Handle message as a talking dialog (the character talking to themselves)
-		
-		if (!charHotspot) return;
-		charHotspot->converse(NOONE_ID, idVal, false);
-	}
-}
-
-/*--------------------------------------------------------------------------*/
-
-TalkDialog::TalkDialog(uint16 characterId, uint16 descId) {
-	StringData &strings = StringData::getReference();
-	Resources &res = Resources::getReference();
-	HotspotData *character = res.getHotspot(characterId);
-	char charName[MAX_DESC_SIZE];
-	strings.getString(character->nameId, charName, NULL, NULL);
-	strings.getString(descId, _desc, NULL, NULL);
-
 	// Apply word wrapping to figure out the needed size of the dialog
 	Surface::wordWrap(_desc, TALK_DIALOG_WIDTH - TALK_DIALOG_EDGE_SIZE * 2 - 2,
 		_lines, _numLines);
@@ -542,9 +502,9 @@
 	}
 
 	// Write out the character name
-	uint16 charWidth = Surface::textWidth(charName);
+	uint16 charWidth = Surface::textWidth(srcCharName);
 	_surface->writeString((TALK_DIALOG_WIDTH-charWidth)/2, TALK_DIALOG_EDGE_SIZE + 2,
-		charName, true, DIALOG_WHITE_COLOUR);
+		srcCharName, true, DIALOG_WHITE_COLOUR);
 
 	// TEMPORARY CODE - write out description. More properly, the text is meant to
 	// be displayed slowly, word by word

Modified: scummvm/trunk/engines/lure/surface.h
===================================================================
--- scummvm/trunk/engines/lure/surface.h	2006-08-07 13:13:20 UTC (rev 23689)
+++ scummvm/trunk/engines/lure/surface.h	2006-08-07 13:16:07 UTC (rev 23690)
@@ -76,7 +76,6 @@
 public:
 	static void show(const char *text);
 	static void show(uint16 stringId);
-	static void showMessage(uint16 messageId, uint16 characterId);
 };
 
 class TalkDialog {
@@ -86,7 +85,7 @@
 	char **_lines;
 	uint8 _numLines;
 public:
-	TalkDialog(uint16 characterId, uint16 descId);
+	TalkDialog(uint16 characterId, uint16 destCharacterId, uint16 activeItemId, uint16 descId);
 	~TalkDialog();
 
 	char *desc() { return _desc; }


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