[Scummvm-cvs-logs] SF.net SVN: scummvm: [32529] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Wed Jun 4 11:07:55 CEST 2008


Revision: 32529
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32529&view=rev
Author:   peres001
Date:     2008-06-04 02:07:55 -0700 (Wed, 04 Jun 2008)

Log Message:
-----------
* Implemented character change opcodes in BRA
* Fixed loading of dialogue characters in BRA

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/disk.h
    scummvm/trunk/engines/parallaction/disk_br.cpp
    scummvm/trunk/engines/parallaction/exec_br.cpp
    scummvm/trunk/engines/parallaction/parallaction.h
    scummvm/trunk/engines/parallaction/parallaction_br.cpp
    scummvm/trunk/engines/parallaction/parser.h
    scummvm/trunk/engines/parallaction/parser_br.cpp

Modified: scummvm/trunk/engines/parallaction/disk.h
===================================================================
--- scummvm/trunk/engines/parallaction/disk.h	2008-06-04 09:02:23 UTC (rev 32528)
+++ scummvm/trunk/engines/parallaction/disk.h	2008-06-04 09:07:55 UTC (rev 32529)
@@ -209,7 +209,7 @@
 protected:
 	void errorFileNotFound(const char *s);
 	Font *createFont(const char *name, Common::ReadStream &stream);
-	Sprites*	createSprites(const char *name);
+	Sprites*	createSprites(Common::ReadStream &stream);
 	void loadBitmap(Common::SeekableReadStream &stream, Graphics::Surface &surf, byte *palette);
 
 public:

Modified: scummvm/trunk/engines/parallaction/disk_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/disk_br.cpp	2008-06-04 09:02:23 UTC (rev 32528)
+++ scummvm/trunk/engines/parallaction/disk_br.cpp	2008-06-04 09:07:55 UTC (rev 32529)
@@ -139,12 +139,19 @@
 }
 
 Frames* DosDisk_br::loadTalk(const char *name) {
-	debugC(5, kDebugDisk, "DosDisk_br::loadTalk");
+	debugC(5, kDebugDisk, "DosDisk_br::loadTalk(%s)", name);
 
+	Common::File stream;
+
 	char path[PATH_LEN];
-	sprintf(path, "%s/tal/%s.tal", _partPath, name);
+	sprintf(path, "%s/tal/%s", _partPath, name);
+	if (!stream.open(path)) {
+		sprintf(path, "%s/tal/%s.tal", _partPath, name);
+		if (!stream.open(path))
+			errorFileNotFound(path);
+	}
 
-	return createSprites(path);
+	return createSprites(stream);
 }
 
 Script* DosDisk_br::loadLocation(const char *name) {
@@ -252,13 +259,8 @@
 	return new SurfaceToFrames(surf);
 }
 
-Sprites* DosDisk_br::createSprites(const char *path) {
+Sprites* DosDisk_br::createSprites(Common::ReadStream &stream) {
 
-	Common::File	stream;
-	if (!stream.open(path)) {
-		errorFileNotFound(path);
-	}
-
 	uint16 num = stream.readUint16LE();
 
 	Sprites *sprites = new Sprites(num);
@@ -284,7 +286,12 @@
 	char path[PATH_LEN];
 	sprintf(path, "%s/ani/%s", _partPath, name);
 
-	return createSprites(path);
+	Common::File stream;
+	if (!stream.open(path))
+		errorFileNotFound(path);
+
+
+	return createSprites(stream);
 }
 
 // Slides in Nippon Safes are basically screen-sized pictures with valid

Modified: scummvm/trunk/engines/parallaction/exec_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/exec_br.cpp	2008-06-04 09:02:23 UTC (rev 32528)
+++ scummvm/trunk/engines/parallaction/exec_br.cpp	2008-06-04 09:07:55 UTC (rev 32529)
@@ -176,7 +176,8 @@
 
 
 DECLARE_COMMAND_OPCODE(character) {
-	warning("Parallaction_br::cmdOp_character not yet implemented");
+	debugC(9, kDebugExec, "Parallaction_br::cmdOp_character(%s)", _cmdRunCtxt.cmd->u._string);
+	changeCharacter(_cmdRunCtxt.cmd->u._string);
 }
 
 

Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h	2008-06-04 09:02:23 UTC (rev 32528)
+++ scummvm/trunk/engines/parallaction/parallaction.h	2008-06-04 09:07:55 UTC (rev 32529)
@@ -654,6 +654,7 @@
 public:
 	typedef void (Parallaction_br::*Callable)(void*);
 	virtual	void callFunction(uint index, void* parm);
+	void		changeCharacter(const char *name);
 
 public:
 	Table		*_countersNames;
@@ -688,7 +689,6 @@
 	void setInventoryCursor(int pos);
 
 	void		changeLocation(char *location);
-	void		changeCharacter(const char *name);
 	void 		runPendingZones();
 
 	void		initPart();

Modified: scummvm/trunk/engines/parallaction/parallaction_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_br.cpp	2008-06-04 09:02:23 UTC (rev 32528)
+++ scummvm/trunk/engines/parallaction/parallaction_br.cpp	2008-06-04 09:07:55 UTC (rev 32529)
@@ -202,7 +202,7 @@
 	if (_activeZone) {
 		z = _activeZone;	// speak Zone or sound
 		_activeZone = nullZonePtr;
-//		runZone(z);			// FIXME: BRA doesn't handle sound yet
+		runZone(z);			// FIXME: BRA doesn't handle sound yet
 	}
 
 	if (_activeZone2) {
@@ -281,7 +281,13 @@
 
 
 void Parallaction_br::changeCharacter(const char *name) {
+	const char *charName = _char.getName();
+	if (!stricmp(charName, name)) {
+		return;
+	}
 
+	_char.setName(name);
+	_char._talk = _disk->loadTalk(name);
 }
 
 

Modified: scummvm/trunk/engines/parallaction/parser.h
===================================================================
--- scummvm/trunk/engines/parallaction/parser.h	2008-06-04 09:02:23 UTC (rev 32528)
+++ scummvm/trunk/engines/parallaction/parser.h	2008-06-04 09:07:55 UTC (rev 32529)
@@ -131,6 +131,7 @@
 		char *bgName;
 		char *maskName;
 		char *pathName;
+		char *characterName;
 	} ctxt;
 
 	void warning_unexpected();

Modified: scummvm/trunk/engines/parallaction/parser_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parser_br.cpp	2008-06-04 09:02:23 UTC (rev 32528)
+++ scummvm/trunk/engines/parallaction/parser_br.cpp	2008-06-04 09:07:55 UTC (rev 32529)
@@ -442,7 +442,7 @@
 DECLARE_LOCATION_PARSER(character)  {
 	debugC(7, kDebugParser, "LOCATION_PARSER(character) ");
 
-//	changeCharacter(character);
+	ctxt.characterName = strdup(_tokens[0]);
 }
 
 
@@ -1113,15 +1113,21 @@
 	ctxt.bgName = 0;
 	ctxt.maskName = 0;
 	ctxt.pathName = 0;
+	ctxt.characterName = 0;
 
 	LocationParser_ns::parse(script);
 
 	_vm->_gfx->setBackground(kBackgroundLocation, ctxt.bgName, ctxt.maskName, ctxt.pathName);
 	_vm->_pathBuffer = &_vm->_gfx->_backgroundInfo.path;
 
+	if (ctxt.characterName) {
+		_vm->changeCharacter(ctxt.characterName);
+	}
+
 	free(ctxt.bgName);
 	free(ctxt.maskName);
 	free(ctxt.pathName);
+	free(ctxt.characterName);
 
 }
 


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