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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Tue Feb 20 10:17:29 CET 2007


Revision: 25738
          http://scummvm.svn.sourceforge.net/scummvm/?rev=25738&view=rev
Author:   peres001
Date:     2007-02-20 01:17:28 -0800 (Tue, 20 Feb 2007)

Log Message:
-----------
cleanup and small fixes

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/animation.cpp
    scummvm/trunk/engines/parallaction/location.cpp
    scummvm/trunk/engines/parallaction/parallaction.cpp
    scummvm/trunk/engines/parallaction/parallaction.h
    scummvm/trunk/engines/parallaction/parser.cpp
    scummvm/trunk/engines/parallaction/parser.h

Modified: scummvm/trunk/engines/parallaction/animation.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/animation.cpp	2007-02-20 09:10:21 UTC (rev 25737)
+++ scummvm/trunk/engines/parallaction/animation.cpp	2007-02-20 09:17:28 UTC (rev 25738)
@@ -269,8 +269,7 @@
 
 	_numLocals = 0;
 
-	LocScript *script = new LocScript(src);
-//	scriptFillBuffers(file);
+	Script *script = new Script(src);
 
 	fillBuffers(*script);
 
@@ -291,12 +290,14 @@
 		vCC = (Instruction*)memAlloc(sizeof(Instruction));
 		memset(vCC, 0, sizeof(Instruction));
 		fillBuffers(*script);
-		//	scriptFillBuffers(file);
 	}
 
 	vCC->_index = INST_END;
 	addNode(vD0, &vCC->_node);
 
+	delete script;
+	delete src;
+
 	a->_program->_ip = (Instruction*)a->_program->_node._next;
 
 	return;

Modified: scummvm/trunk/engines/parallaction/location.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/location.cpp	2007-02-20 09:10:21 UTC (rev 25737)
+++ scummvm/trunk/engines/parallaction/location.cpp	2007-02-20 09:17:28 UTC (rev 25738)
@@ -76,8 +76,7 @@
 	uint32 count = file->_endOffset - file->_offset;
 	location_src = (char*)memAlloc(0x4000);
 
-	_locationScript = new LocScript(location_src);
-//	parseInit(location_src);
+	_locationScript = new Script(location_src);
 
 	readArchivedFile(file, location_src, count);
 	closeArchivedFile(file);
@@ -192,6 +191,10 @@
 
 	resolveLocationForwards();
 	_vm->_graphics->freeCnv(&Graphics::_font);
+
+	delete _locationScript;
+	_locationScript = NULL;
+
 	memFree(location_src);
 
 	return;

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2007-02-20 09:10:21 UTC (rev 25737)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2007-02-20 09:17:28 UTC (rev 25738)
@@ -165,6 +165,8 @@
 	_activeItem._id = 0;
 	_procCurrentHoverItem = -1;
 
+	_locationScript = NULL;
+
 	_musicData1 = 0;
 	strcpy(_characterName1, "null");
 

Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h	2007-02-20 09:10:21 UTC (rev 25737)
+++ scummvm/trunk/engines/parallaction/parallaction.h	2007-02-20 09:17:28 UTC (rev 25738)
@@ -269,7 +269,7 @@
 
 	InventoryItem	_activeItem;
 
-	LocScript	*_locationScript;
+	Script	*_locationScript;
 
 protected:		// data
 

Modified: scummvm/trunk/engines/parallaction/parser.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parser.cpp	2007-02-20 09:10:21 UTC (rev 25737)
+++ scummvm/trunk/engines/parallaction/parser.cpp	2007-02-20 09:17:28 UTC (rev 25738)
@@ -28,43 +28,15 @@
 namespace Parallaction {
 
 char			_tokens[20][40];
-/*
-static char    *_src = NULL;
 
+Script::Script(const char* s) : _src(s) {
 
-
-void parseInit(char *s) {
-	_src = s;
 }
 
-char *parseNextLine(char *s, uint16 count) {
+char *Script::readLine(char *buf, size_t bufSize) {
 
 	uint16 _si;
 	char v2 = 0;
-	for ( _si = 0; _si<count; _si++) {
-
-		v2 = *_src++;
-		if (v2 == 0xA || v2 == -1) break;
-		if (v2 != -1 && _si < count) s[_si] = v2;
-	}
-
-	if (_si == 0 && v2 == -1)
-		return 0;
-
-	s[_si] = 0xA;
-	s[_si+1] = '\0';
-
-	return s;
-}
-*/
-LocScript::LocScript(const char* s) : _src(s) {
-
-}
-
-char *LocScript::readLine(char *buf, size_t bufSize) {
-
-	uint16 _si;
-	char v2 = 0;
 	for ( _si = 0; _si<bufSize; _si++) {
 
 		v2 = *_src++;
@@ -82,24 +54,24 @@
 
 }
 
-uint32 LocScript::read(void *dataPtr, uint32 dataSize) {
-	error("binary read not supported on LocScript streams");
+uint32 Script::read(void *dataPtr, uint32 dataSize) {
+	error("binary read not supported on Script streams");
 }
 
-bool LocScript::eos() const {
-	error("EoS not supported on LocScript streams");
+bool Script::eos() const {
+	error("EoS not supported on Script streams");
 }
 
-uint32 LocScript::pos() const {
-	error("position not supported on LocScript streams");
+uint32 Script::pos() const {
+	error("position not supported on Script streams");
 }
 
-uint32 LocScript::size() const {
-	error("can't get size of LocScript streams");
+uint32 Script::size() const {
+	error("can't get size of Script streams");
 }
 
-void LocScript::seek(int32 offset, int whence) {
-	error("seek not supported on LocScript streams");
+void Script::seek(int32 offset, int whence) {
+	error("seek not supported on Script streams");
 }
 
 //	looks for next token in a string
@@ -199,49 +171,5 @@
 
 	return fillTokens(line);
 }
-/*
-//
-//	FIXME
-//	this function does the same Job as fillBuffers, except that
-//	it gets input from a SeekableStream instead of a memory buffer
-//
-uint16 tableFillBuffers(Common::SeekableReadStream &stream) {
 
-	clearTokens();
-
-	char buf[200];
-	char *line = NULL;
-	do {
-		line = stream.readLine(buf, 200);
-		if (line == NULL) {
-			return 0;
-		}
-		line = Common::ltrim(line);
-	} while (strlen(line) == 0 || line[0] == '#');
-
-	return fillTokens(line);
-}
-
-
-//	FIXME
-//	this function does the same Job as fillBuffers, except that
-//	it gets input from an ArchivedFile instead of a memory buffer
-//
-uint16 scriptFillBuffers(ArchivedFile *file) {
-
-	clearTokens();
-
-	char buf[200];
-	char *line = NULL;
-	do {
-		line = readArchivedFileText(buf, 200, file);
-		if (line == NULL) {
-			return 0;
-		}
-		line = Common::ltrim(line);
-	} while (strlen(line) == 0 || line[0] == '#');
-
-	return fillTokens(line);
-}
-*/
 } // namespace Parallaction

Modified: scummvm/trunk/engines/parallaction/parser.h
===================================================================
--- scummvm/trunk/engines/parallaction/parser.h	2007-02-20 09:10:21 UTC (rev 25737)
+++ scummvm/trunk/engines/parallaction/parser.h	2007-02-20 09:17:28 UTC (rev 25738)
@@ -36,18 +36,14 @@
 uint16 fillBuffers(Common::SeekableReadStream &stream, bool errorOnEOF = false);
 char   *parseNextToken(char *s, char *tok, uint16 count, const char *brk);
 
-//uint16  tableFillBuffers(Common::SeekableReadStream &stream);
-//uint16	scriptFillBuffers(ArchivedFile *file);
-
-
 extern char _tokens[][40];
 
-class LocScript : public Common::SeekableReadStream {
+class Script : public Common::SeekableReadStream {
 
 	const char*	_src;
 
 public:
-	LocScript(const char* s);
+	Script(const char* s);
 
 	uint32 read(void *dataPtr, uint32 dataSize);
 


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