[Scummvm-cvs-logs] scummvm master -> bb31c435bf6502f4e1f94b3de9f046c054031a98

bluegr bluegr at gmail.com
Wed Dec 3 00:45:07 CET 2014


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
fd2750a711 ZVISION: Remove dead code
10444ef568 ZVISION: Use integers for rectangles in the menu code
bb31c435bf ZVISION: Remove more dead code, and move some debugger functions


Commit: fd2750a71152d09557709a49f055b50937919326
    https://github.com/scummvm/scummvm/commit/fd2750a71152d09557709a49f055b50937919326
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-12-03T01:41:06+02:00

Commit Message:
ZVISION: Remove dead code

Changed paths:
  R engines/zvision/utility/single_value_container.cpp
  R engines/zvision/utility/single_value_container.h
    engines/zvision/module.mk



diff --git a/engines/zvision/module.mk b/engines/zvision/module.mk
index f2455a5..140074c 100644
--- a/engines/zvision/module.mk
+++ b/engines/zvision/module.mk
@@ -47,7 +47,6 @@ MODULE_OBJS := \
 	text/text.o \
 	utility/clock.o \
 	utility/lzss_read_stream.o \
-	utility/single_value_container.o \
 	utility/utility.o \
 	utility/win_keys.o \
 	video/video.o \
diff --git a/engines/zvision/utility/single_value_container.cpp b/engines/zvision/utility/single_value_container.cpp
deleted file mode 100644
index 774f4b7..0000000
--- a/engines/zvision/utility/single_value_container.cpp
+++ /dev/null
@@ -1,344 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "common/scummsys.h"
-#include "common/textconsole.h"
-#include "common/str.h"
-
-#include "zvision/utility/single_value_container.h"
-
-namespace ZVision {
-
-SingleValueContainer::SingleValueContainer(ValueType type) : _objectType(type) { }
-
-SingleValueContainer::SingleValueContainer(bool value) : _objectType(BOOL) {
-	_value.boolVal = value;
-}
-
-SingleValueContainer::SingleValueContainer(byte value) : _objectType(BYTE) {
-	_value.byteVal = value;
-}
-
-SingleValueContainer::SingleValueContainer(int16 value) : _objectType(INT16) {
-	_value.int16Val = value;
-}
-
-SingleValueContainer::SingleValueContainer(uint16 value) : _objectType(UINT16) {
-	_value.uint16Val = value;
-}
-
-SingleValueContainer::SingleValueContainer(int32 value) : _objectType(INT32) {
-	_value.int32Val = value;
-}
-
-SingleValueContainer::SingleValueContainer(uint32 value) : _objectType(UINT32) {
-	_value.uint32Val = value;
-}
-
-SingleValueContainer::SingleValueContainer(float value) : _objectType(FLOAT) {
-	_value.floatVal = value;
-}
-
-SingleValueContainer::SingleValueContainer(double value) : _objectType(DOUBLE) {
-	_value.doubleVal = value;
-}
-
-SingleValueContainer::SingleValueContainer(Common::String value) : _objectType(BYTE) {
-	_value.stringVal = new char[value.size() + 1];
-	memcpy(_value.stringVal, value.c_str(), value.size() + 1);
-}
-
-SingleValueContainer::SingleValueContainer(const SingleValueContainer &other) {
-	_objectType = other._objectType;
-
-	switch (_objectType) {
-	case BOOL:
-		_value.boolVal = other._value.boolVal;
-		break;
-	case BYTE:
-		_value.byteVal = other._value.byteVal;
-		break;
-	case INT16:
-		_value.int16Val = other._value.int16Val;
-		break;
-	case UINT16:
-		_value.uint16Val = other._value.uint16Val;
-		break;
-	case INT32:
-		_value.int32Val = other._value.int32Val;
-		break;
-	case UINT32:
-		_value.uint32Val = other._value.uint32Val;
-		break;
-	case FLOAT:
-		_value.floatVal = other._value.floatVal;
-		break;
-	case DOUBLE:
-		_value.doubleVal = other._value.doubleVal;
-		break;
-	case STRING:
-		uint32 length = strlen(other._value.stringVal);
-		_value.stringVal = new char[length + 1];
-		memcpy(_value.stringVal, other._value.stringVal, length + 1);
-		break;
-	}
-}
-
-SingleValueContainer::~SingleValueContainer() {
-	deleteCharPointer();
-}
-
-void SingleValueContainer::deleteCharPointer() {
-	if (_objectType == STRING)
-		delete[] _value.stringVal;
-}
-
-SingleValueContainer &SingleValueContainer::operator=(const bool &rhs) {
-	if (_objectType == BOOL) {
-		_value.boolVal = rhs;
-		return *this;
-	}
-
-	deleteCharPointer();
-	_objectType = BOOL;
-	_value.boolVal = rhs;
-
-	return *this;
-}
-
-SingleValueContainer &SingleValueContainer::operator=(const byte &rhs) {
-	if (_objectType == BYTE) {
-		_value.byteVal = rhs;
-		return *this;
-	}
-
-	deleteCharPointer();
-	_objectType = BYTE;
-	_value.byteVal = rhs;
-
-	return *this;
-}
-
-SingleValueContainer &SingleValueContainer::operator=(const int16 &rhs) {
-	if (_objectType == INT16) {
-		_value.int16Val = rhs;
-		return *this;
-	}
-
-	deleteCharPointer();
-	_objectType = INT16;
-	_value.int16Val = rhs;
-
-	return *this;
-}
-
-SingleValueContainer &SingleValueContainer::operator=(const uint16 &rhs) {
-	if (_objectType == UINT16) {
-		_value.uint16Val = rhs;
-		return *this;
-	}
-
-	deleteCharPointer();
-	_objectType = UINT16;
-	_value.uint16Val = rhs;
-
-	return *this;
-}
-
-SingleValueContainer &SingleValueContainer::operator=(const int32 &rhs) {
-	if (_objectType == INT32) {
-		_value.int32Val = rhs;
-		return *this;
-	}
-
-	deleteCharPointer();
-	_objectType = INT32;
-	_value.int32Val = rhs;
-
-	return *this;
-}
-
-SingleValueContainer &SingleValueContainer::operator=(const uint32 &rhs) {
-	if (_objectType == UINT32) {
-		_value.uint32Val = rhs;
-		return *this;
-	}
-
-	deleteCharPointer();
-	_objectType = UINT32;
-	_value.uint32Val = rhs;
-
-	return *this;
-}
-
-SingleValueContainer &SingleValueContainer::operator=(const float &rhs) {
-	if (_objectType == FLOAT) {
-		_value.floatVal = rhs;
-		return *this;
-	}
-
-	deleteCharPointer();
-	_objectType = FLOAT;
-	_value.floatVal = rhs;
-
-	return *this;
-}
-
-SingleValueContainer &SingleValueContainer::operator=(const double &rhs) {
-	if (_objectType == DOUBLE) {
-		_value.doubleVal = rhs;
-		return *this;
-	}
-
-	deleteCharPointer();
-	_objectType = DOUBLE;
-	_value.doubleVal = rhs;
-
-	return *this;
-}
-
-SingleValueContainer &SingleValueContainer::operator=(const Common::String &rhs) {
-	if (_objectType != STRING) {
-		_objectType = STRING;
-		_value.stringVal = new char[rhs.size() + 1];
-		memcpy(_value.stringVal, rhs.c_str(), rhs.size() + 1);
-
-		return *this;
-	}
-
-	uint32 length = strlen(_value.stringVal);
-	if (length <= rhs.size() + 1) {
-		memcpy(_value.stringVal, rhs.c_str(), rhs.size() + 1);
-	} else {
-		delete[] _value.stringVal;
-		_value.stringVal = new char[rhs.size() + 1];
-		memcpy(_value.stringVal, rhs.c_str(), rhs.size() + 1);
-	}
-
-	return *this;
-}
-
-SingleValueContainer &SingleValueContainer::operator=(const SingleValueContainer &rhs) {
-	switch (_objectType) {
-	case BOOL:
-		return operator=(rhs._value.boolVal);
-	case BYTE:
-		return operator=(rhs._value.byteVal);
-	case INT16:
-		return operator=(rhs._value.int16Val);
-	case UINT16:
-		return operator=(rhs._value.uint16Val);
-	case INT32:
-		return operator=(rhs._value.int32Val);
-	case UINT32:
-		return operator=(rhs._value.uint32Val);
-	case FLOAT:
-		return operator=(rhs._value.floatVal);
-	case DOUBLE:
-		return operator=(rhs._value.doubleVal);
-	case STRING:
-		uint32 length = strlen(rhs._value.stringVal);
-
-		_value.stringVal = new char[length + 1];
-		memcpy(_value.stringVal, rhs._value.stringVal, length + 1);
-
-		return *this;
-	}
-
-	return *this;
-}
-
-bool SingleValueContainer::getBoolValue(bool *returnValue) const {
-	if (_objectType !=  BOOL) {
-		warning("'Object' is not storing a bool.");
-		return false;
-	}
-
-	*returnValue = _value.boolVal;
-	return true;
-}
-
-bool SingleValueContainer::getByteValue(byte *returnValue) const {
-	if (_objectType !=  BYTE)
-		warning("'Object' is not storing a byte.");
-
-	*returnValue = _value.byteVal;
-	return true;
-}
-
-bool SingleValueContainer::getInt16Value(int16 *returnValue) const {
-	if (_objectType !=  INT16)
-		warning("'Object' is not storing an int16.");
-
-	*returnValue = _value.int16Val;
-	return true;
-}
-
-bool SingleValueContainer::getUInt16Value(uint16 *returnValue) const {
-	if (_objectType !=  UINT16)
-		warning("'Object' is not storing a uint16.");
-
-	*returnValue = _value.uint16Val;
-	return true;
-}
-
-bool SingleValueContainer::getInt32Value(int32 *returnValue) const {
-	if (_objectType !=  INT32)
-		warning("'Object' is not storing an int32.");
-
-	*returnValue = _value.int32Val;
-	return true;
-}
-
-bool SingleValueContainer::getUInt32Value(uint32 *returnValue) const {
-	if (_objectType !=  UINT32)
-		warning("'Object' is not storing a uint32.");
-
-	*returnValue = _value.uint32Val;
-	return true;
-}
-
-bool SingleValueContainer::getFloatValue(float *returnValue) const {
-	if (_objectType !=  FLOAT)
-		warning("'Object' is not storing a float.");
-
-	*returnValue = _value.floatVal;
-	return true;
-}
-
-bool SingleValueContainer::getDoubleValue(double *returnValue) const {
-	if (_objectType !=  DOUBLE)
-		warning("'Object' is not storing a double.");
-
-	*returnValue = _value.doubleVal;
-	return true;
-}
-
-bool SingleValueContainer::getStringValue(Common::String *returnValue) const {
-	if (_objectType !=  STRING)
-		warning("'Object' is not storing a Common::String.");
-
-	*returnValue = _value.stringVal;
-	return true;
-}
-
-} // End of namespace ZVision
diff --git a/engines/zvision/utility/single_value_container.h b/engines/zvision/utility/single_value_container.h
deleted file mode 100644
index ac6e990..0000000
--- a/engines/zvision/utility/single_value_container.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef ZVISION_SINGLE_VALUE_CONTAINER_H
-#define ZVISION_SINGLE_VALUE_CONTAINER_H
-
-namespace Common {
-class String;
-}
-
-namespace ZVision {
-
-/**
- * A generic single value storage class. It is useful for storing different
- * value types in a single List, Hashmap, etc.
- */
-class SingleValueContainer {
-public:
-	enum ValueType {
-		BOOL,
-		BYTE,
-		INT16,
-		UINT16,
-		INT32,
-		UINT32,
-		FLOAT,
-		DOUBLE,
-		STRING
-	};
-
-	// Constructors
-	explicit SingleValueContainer(ValueType type);
-	explicit SingleValueContainer(bool value);
-	explicit SingleValueContainer(byte value);
-	explicit SingleValueContainer(int16 value);
-	explicit SingleValueContainer(uint16 value);
-	explicit SingleValueContainer(int32 value);
-	explicit SingleValueContainer(uint32 value);
-	explicit SingleValueContainer(float value);
-	explicit SingleValueContainer(double value);
-	explicit SingleValueContainer(Common::String value);
-
-	// Copy constructor
-	explicit SingleValueContainer(const SingleValueContainer &other);
-
-	// Destructor
-	~SingleValueContainer();
-
-private:
-	ValueType _objectType;
-
-	union {
-		bool boolVal;
-		byte byteVal;
-		int16 int16Val;
-		uint16 uint16Val;
-		int32 int32Val;
-		uint32 uint32Val;
-		float floatVal;
-		double doubleVal;
-		char *stringVal;
-	} _value;
-
-public:
-	SingleValueContainer &operator=(const bool &rhs);
-	SingleValueContainer &operator=(const byte &rhs);
-	SingleValueContainer &operator=(const int16 &rhs);
-	SingleValueContainer &operator=(const uint16 &rhs);
-	SingleValueContainer &operator=(const int32 &rhs);
-	SingleValueContainer &operator=(const uint32 &rhs);
-	SingleValueContainer &operator=(const float &rhs);
-	SingleValueContainer &operator=(const double &rhs);
-	SingleValueContainer &operator=(const Common::String &rhs);
-
-	SingleValueContainer &operator=(const SingleValueContainer &rhs);
-
-	/**
-	 * Retrieve a bool from the container. If the container is not storing a
-	 * bool, this will return false and display a warning().
-	 *
-	 * @param returnValue    Pointer to where you want the value stored
-	 * @return               Value indicating whether the value assignment was successful
-	 */
-	bool getBoolValue(bool *returnValue) const;
-	/**
-	 * Retrieve a byte from the container. If the container is not storing a
-	 * byte, this will return false and display a warning().
-	 *
-	 * @param returnValue    Pointer to where you want the value stored
-	 * @return               Value indicating whether the value assignment was successful
-	 */
-	bool getByteValue(byte *returnValue) const;
-	/**
-	 * Retrieve an int16 from the container. If the container is not storing an
-	 * int16, this will return false and display a warning().
-	 *
-	 * @param returnValue    Pointer to where you want the value stored
-	 * @return               Value indicating whether the value assignment was successful
-	 */
-	bool getInt16Value(int16 *returnValue) const;
-	/**
-	 * Retrieve a uint16 from the container. If the container is not storing a
-	 * uint16, this will return false and display a warning().
-	 *
-	 * @param returnValue    Pointer to where you want the value stored
-	 * @return               Value indicating whether the value assignment was successful
-	 */
-	bool getUInt16Value(uint16 *returnValue) const;
-	/**
-	 * Retrieve an int32 from the container. If the container is not storing an
-	 * int32, this will return false and display a warning().
-	 *
-	 * @param returnValue    Pointer to where you want the value stored
-	 * @return               Value indicating whether the value assignment was successful
-	 */
-	bool getInt32Value(int32 *returnValue) const;
-	/**
-	 * Retrieve a uint32 from the container. If the container is not storing a
-	 * uint32, this will return false and display a warning().
-	 *
-	 * @param returnValue    Pointer to where you want the value stored
-	 * @return               Value indicating whether the value assignment was successful
-	 */
-	bool getUInt32Value(uint32 *returnValue) const;
-	/**
-	 * Retrieve a float from the container. If the container is not storing a
-	 * float, this will return false and display a warning().
-	 *
-	 * @param returnValue    Pointer to where you want the value stored
-	 * @return               Value indicating whether the value assignment was successful
-	 */
-	bool getFloatValue(float *returnValue) const;
-	/**
-	 * Retrieve a double from the container. If the container is not storing a
-	 * double, this will return false and display a warning().
-	 *
-	 * @param returnValue    Pointer to where you want the value stored
-	 * @return               Value indicating whether the value assignment was successful
-	 */
-	bool getDoubleValue(double *returnValue) const;
-	/**
-	 * Retrieve a String from the container. If the container is not storing a
-	 * string, this will return false and display a warning().
-	 *
-	 * Caution: Strings are internally stored as char[]. getStringValue uses
-	 * Common::String::operator=(char *) to do the assigment, which uses both
-	 * strlen() AND memmove().
-	 *
-	 * @param returnValue    Pointer to where you want the value stored
-	 * @return               Value indicating whether the value assignment was successful
-	 */
-	bool getStringValue(Common::String *returnValue) const;
-
-private:
-	/**
-	 * Helper method for destruction and assignment. It checks to see
-	 * if the char pointer is being used, and if so calls delete on it
-	 */
-	void deleteCharPointer();
-};
-
-} // End of namespace ZVision
-
-#endif


Commit: 10444ef5683f420f08cfc276349a5771dd0d04e5
    https://github.com/scummvm/scummvm/commit/10444ef5683f420f08cfc276349a5771dd0d04e5
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-12-03T01:42:04+02:00

Commit Message:
ZVISION: Use integers for rectangles in the menu code

Changed paths:
    engines/zvision/core/menu.h



diff --git a/engines/zvision/core/menu.h b/engines/zvision/core/menu.h
index 7301323..ebe0bb5 100644
--- a/engines/zvision/core/menu.h
+++ b/engines/zvision/core/menu.h
@@ -82,7 +82,7 @@ private:
 	int mouseOnItem;
 
 	bool   scrolled[3];
-	float scrollPos[3];
+	int16 scrollPos[3];
 
 	enum {
 		menu_ITEM = 0,
@@ -111,7 +111,7 @@ private:
 	int mouseOnItem;
 
 	bool   scrolled;
-	float scrollPos;
+	int16 scrollPos;
 
 	bool redraw;
 


Commit: bb31c435bf6502f4e1f94b3de9f046c054031a98
    https://github.com/scummvm/scummvm/commit/bb31c435bf6502f4e1f94b3de9f046c054031a98
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-12-03T01:43:51+02:00

Commit Message:
ZVISION: Remove more dead code, and move some debugger functions

Changed paths:
    engines/zvision/core/console.cpp
    engines/zvision/core/console.h
    engines/zvision/sound/zork_raw.cpp
    engines/zvision/utility/utility.cpp
    engines/zvision/utility/utility.h



diff --git a/engines/zvision/core/console.cpp b/engines/zvision/core/console.cpp
index 201d1c9..f8e2833 100644
--- a/engines/zvision/core/console.cpp
+++ b/engines/zvision/core/console.cpp
@@ -44,7 +44,6 @@
 namespace ZVision {
 
 Console::Console(ZVision *engine) : GUI::Debugger(), _engine(engine) {
-	registerCmd("loadimage", WRAP_METHOD(Console, cmdLoadImage));
 	registerCmd("loadvideo", WRAP_METHOD(Console, cmdLoadVideo));
 	registerCmd("loadsound", WRAP_METHOD(Console, cmdLoadSound));
 	registerCmd("raw2wav", WRAP_METHOD(Console, cmdRawToWav));
@@ -55,18 +54,6 @@ Console::Console(ZVision *engine) : GUI::Debugger(), _engine(engine) {
 	registerCmd("changelocation", WRAP_METHOD(Console, cmdChangeLocation));
 	registerCmd("dumpfile", WRAP_METHOD(Console, cmdDumpFile));
 	registerCmd("parseallscrfiles", WRAP_METHOD(Console, cmdParseAllScrFiles));
-	registerCmd("rendertext", WRAP_METHOD(Console, cmdRenderText));
-}
-
-bool Console::cmdLoadImage(int argc, const char **argv) {
-//	if (argc == 4)
-//		_engine->getRenderManager()->renderImageToScreen(argv[1], atoi(argv[2]), atoi(argv[3]));
-//	else {
-//		DebugPrintf("Use loadimage <fileName> <destinationX> <destinationY> to load an image to the screen\n");
-//		return true;
-//	}
-
-	return true;
 }
 
 bool Console::cmdLoadVideo(int argc, const char **argv) {
@@ -117,7 +104,42 @@ bool Console::cmdRawToWav(int argc, const char **argv) {
 		return true;
 	}
 
-	convertRawToWav(argv[1], _engine, argv[2]);
+	Common::File file;
+	if (!file.open(argv[1]))
+		return true;
+
+	Audio::AudioStream *audioStream = makeRawZorkStream(argv[1], _engine);
+
+	Common::DumpFile output;
+	output.open(argv[2]);
+
+	output.writeUint32BE(MKTAG('R', 'I', 'F', 'F'));
+	output.writeUint32LE(file.size() * 2 + 36);
+	output.writeUint32BE(MKTAG('W', 'A', 'V', 'E'));
+	output.writeUint32BE(MKTAG('f', 'm', 't', ' '));
+	output.writeUint32LE(16);
+	output.writeUint16LE(1);
+	uint16 numChannels;
+	if (audioStream->isStereo()) {
+		numChannels = 2;
+		output.writeUint16LE(2);
+	} else {
+		numChannels = 1;
+		output.writeUint16LE(1);
+	}
+	output.writeUint32LE(audioStream->getRate());
+	output.writeUint32LE(audioStream->getRate() * numChannels * 2);
+	output.writeUint16LE(numChannels * 2);
+	output.writeUint16LE(16);
+	output.writeUint32BE(MKTAG('d', 'a', 't', 'a'));
+	output.writeUint32LE(file.size() * 2);
+	int16 *buffer = new int16[file.size()];
+	audioStream->readBuffer(buffer, file.size());
+	output.write(buffer, file.size() * 2);
+
+	delete[] buffer;
+
+
 	return true;
 }
 
@@ -186,7 +208,22 @@ bool Console::cmdDumpFile(int argc, const char **argv) {
 		return true;
 	}
 
-	writeFileContentsToFile(argv[1], argv[1]);
+	Common::File f;
+	if (!f.open(argv[1])) {
+		return true;
+	}
+
+	byte *buffer = new byte[f.size()];
+	f.read(buffer, f.size());
+
+	Common::DumpFile dumpFile;
+	dumpFile.open(argv[1]);
+
+	dumpFile.write(buffer, f.size());
+	dumpFile.flush();
+	dumpFile.close();
+
+	delete[] buffer;
 
 	return true;
 }
@@ -201,16 +238,4 @@ bool Console::cmdParseAllScrFiles(int argc, const char **argv) {
 	return true;
 }
 
-bool Console::cmdRenderText(int argc, const char **argv) {
-	if (argc != 7) {
-		debugPrintf("Use rendertext <text> <fontNumber> <destX> <destY> <maxWidth> <1 or 0: wrap> to render text\n");
-		return true;
-	}
-
-	//StringManager::TextStyle style = _engine->getStringManager()->getTextStyle(atoi(argv[2]));
-	//_engine->getRenderManager()->renderTextToWorkingWindow(333, Common::String(argv[1]), style.font, atoi(argv[3]), atoi(argv[4]), style.color, atoi(argv[5]), -1, Graphics::kTextAlignLeft, atoi(argv[6]) == 0 ? false : true);
-
-	return true;
-}
-
 } // End of namespace ZVision
diff --git a/engines/zvision/core/console.h b/engines/zvision/core/console.h
index 29523c5..994e05b 100644
--- a/engines/zvision/core/console.h
+++ b/engines/zvision/core/console.h
@@ -37,7 +37,6 @@ public:
 private:
 	ZVision *_engine;
 
-	bool cmdLoadImage(int argc, const char **argv);
 	bool cmdLoadVideo(int argc, const char **argv);
 	bool cmdLoadSound(int argc, const char **argv);
 	bool cmdRawToWav(int argc, const char **argv);
@@ -48,7 +47,6 @@ private:
 	bool cmdChangeLocation(int argc, const char **argv);
 	bool cmdDumpFile(int argc, const char **argv);
 	bool cmdParseAllScrFiles(int argc, const char **argv);
-	bool cmdRenderText(int argc, const char **argv);
 };
 
 } // End of namespace ZVision
diff --git a/engines/zvision/sound/zork_raw.cpp b/engines/zvision/sound/zork_raw.cpp
index 485e0b8..c26c33a 100644
--- a/engines/zvision/sound/zork_raw.cpp
+++ b/engines/zvision/sound/zork_raw.cpp
@@ -21,23 +21,21 @@
  */
 
 #include "common/scummsys.h"
-
-#include "zvision/sound/zork_raw.h"
-
-#include "zvision/zvision.h"
-#include "zvision/detection.h"
-#include "zvision/utility/utility.h"
-
 #include "common/file.h"
 #include "common/str.h"
 #include "common/stream.h"
 #include "common/memstream.h"
 #include "common/bufferedstream.h"
 #include "common/util.h"
-
+#include "common/tokenizer.h"
 #include "audio/audiostream.h"
 #include "audio/decoders/raw.h"
 
+#include "zvision/sound/zork_raw.h"
+#include "zvision/zvision.h"
+#include "zvision/detection.h"
+#include "zvision/utility/utility.h"
+
 namespace ZVision {
 
 const int16 RawChunkStream::_stepAdjustmentTable[8] = { -1, -1, -1, 1, 4, 7, 10, 12};
@@ -255,7 +253,13 @@ Audio::RewindableAudioStream *makeRawZorkStream(const Common::String &filePath,
 	Common::File *file = new Common::File();
 	assert(engine->getSearchManager()->openFile(*file, filePath));
 
-	Common::String fileName = getFileName(filePath);
+	// Get the file name
+	Common::StringTokenizer tokenizer(filePath, "/\\");
+	Common::String fileName;
+	while (!tokenizer.empty()) {
+		fileName = tokenizer.nextToken();
+	}
+
 	fileName.toLowercase();
 
 	SoundParams soundParams = {};
diff --git a/engines/zvision/utility/utility.cpp b/engines/zvision/utility/utility.cpp
index 517c89a..2388fe8 100644
--- a/engines/zvision/utility/utility.cpp
+++ b/engines/zvision/utility/utility.cpp
@@ -32,25 +32,6 @@
 
 namespace ZVision {
 
-void writeFileContentsToFile(const Common::String &sourceFile, const Common::String &destFile) {
-	Common::File f;
-	if (!f.open(sourceFile)) {
-		return;
-	}
-
-	byte *buffer = new byte[f.size()];
-	f.read(buffer, f.size());
-
-	Common::DumpFile dumpFile;
-	dumpFile.open(destFile);
-
-	dumpFile.write(buffer, f.size());
-	dumpFile.flush();
-	dumpFile.close();
-
-	delete[] buffer;
-}
-
 void trimCommentsAndWhiteSpace(Common::String *string) {
 	for (int i = string->size() - 1; i >= 0; i--) {
 		if ((*string)[i] == '#') {
@@ -76,161 +57,4 @@ void tryToDumpLine(const Common::String &key,
 	}
 }
 
-void dumpEveryResultAction(const Common::String &destFile) {
-	Common::HashMap<Common::String, byte> count;
-	Common::HashMap<Common::String, bool> fileAlreadyUsed;
-
-	Common::DumpFile output;
-	output.open(destFile);
-
-	// Find scr files
-	Common::ArchiveMemberList list;
-	SearchMan.listMatchingMembers(list, "*.scr");
-
-	for (Common::ArchiveMemberList::iterator iter = list.begin(); iter != list.end(); ++iter) {
-		Common::SeekableReadStream *stream = (*iter)->createReadStream();
-
-		Common::String line = stream->readLine();
-		trimCommentsAndWhiteSpace(&line);
-
-		while (!stream->eos()) {
-			if (line.matchString("*:add*", true)) {
-				tryToDumpLine("add", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:animplay*", true)) {
-				tryToDumpLine("animplay", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:animpreload*", true)) {
-				tryToDumpLine("animpreload", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:animunload*", true)) {
-				tryToDumpLine("animunload", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:attenuate*", true)) {
-				tryToDumpLine("attenuate", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:assign*", true)) {
-				tryToDumpLine("assign", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:change_location*", true)) {
-				tryToDumpLine("change_location", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:crossfade*", true) && !fileAlreadyUsed["add"]) {
-				tryToDumpLine("crossfade", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:debug*", true)) {
-				tryToDumpLine("debug", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:delay_render*", true)) {
-				tryToDumpLine("delay_render", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:disable_control*", true)) {
-				tryToDumpLine("disable_control", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:disable_venus*", true)) {
-				tryToDumpLine("disable_venus", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:display_message*", true)) {
-				tryToDumpLine("display_message", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:dissolve*", true)) {
-				tryToDumpLine("dissolve", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:distort*", true)) {
-				tryToDumpLine("distort", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:enable_control*", true)) {
-				tryToDumpLine("enable_control", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:flush_mouse_events*", true)) {
-				tryToDumpLine("flush_mouse_events", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:inventory*", true)) {
-				tryToDumpLine("inventory", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:kill*", true)) {
-				tryToDumpLine("kill", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:menu_bar_enable*", true)) {
-				tryToDumpLine("menu_bar_enable", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:music*", true)) {
-				tryToDumpLine("music", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:pan_track*", true)) {
-				tryToDumpLine("pan_track", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:playpreload*", true)) {
-				tryToDumpLine("playpreload", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:preferences*", true)) {
-				tryToDumpLine("preferences", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:quit*", true)) {
-				tryToDumpLine("quit", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:random*", true)) {
-				tryToDumpLine("random", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:region*", true)) {
-				tryToDumpLine("region", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:restore_game*", true)) {
-				tryToDumpLine("restore_game", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:rotate_to*", true)) {
-				tryToDumpLine("rotate_to", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:save_game*", true)) {
-				tryToDumpLine("save_game", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:set_partial_screen*", true)) {
-				tryToDumpLine("set_partial_screen", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:set_screen*", true)) {
-				tryToDumpLine("set_screen", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:set_venus*", true)) {
-				tryToDumpLine("set_venus", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:stop*", true)) {
-				tryToDumpLine("stop", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:streamvideo*", true)) {
-				tryToDumpLine("streamvideo", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:syncsound*", true)) {
-				tryToDumpLine("syncsound", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:timer*", true)) {
-				tryToDumpLine("timer", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:ttytext*", true)) {
-				tryToDumpLine("ttytext", line, &count, &fileAlreadyUsed, output);
-			} else if (line.matchString("*:universe_music*", true)) {
-				tryToDumpLine("universe_music", line, &count, &fileAlreadyUsed, output);
-			}
-
-			line = stream->readLine();
-			trimCommentsAndWhiteSpace(&line);
-		}
-
-		for (Common::HashMap<Common::String, bool>::iterator fileUsedIter = fileAlreadyUsed.begin(); fileUsedIter != fileAlreadyUsed.end(); ++fileUsedIter) {
-			fileUsedIter->_value = false;
-		}
-	}
-
-	output.close();
-}
-
-Common::String getFileName(const Common::String &fullPath) {
-	Common::StringTokenizer tokenizer(fullPath, "/\\");
-	Common::String token;
-	while (!tokenizer.empty()) {
-		token = tokenizer.nextToken();
-	}
-
-	return token;
-}
-
-void convertRawToWav(const Common::String &inputFile, ZVision *engine, const Common::String &outputFile) {
-	Common::File file;
-	if (!file.open(inputFile))
-		return;
-
-	Audio::AudioStream *audioStream = makeRawZorkStream(inputFile, engine);
-
-	Common::DumpFile output;
-	output.open(outputFile);
-
-	output.writeUint32BE(MKTAG('R', 'I', 'F', 'F'));
-	output.writeUint32LE(file.size() * 2 + 36);
-	output.writeUint32BE(MKTAG('W', 'A', 'V', 'E'));
-	output.writeUint32BE(MKTAG('f', 'm', 't', ' '));
-	output.writeUint32LE(16);
-	output.writeUint16LE(1);
-	uint16 numChannels;
-	if (audioStream->isStereo()) {
-		numChannels = 2;
-		output.writeUint16LE(2);
-	} else {
-		numChannels = 1;
-		output.writeUint16LE(1);
-	}
-	output.writeUint32LE(audioStream->getRate());
-	output.writeUint32LE(audioStream->getRate() * numChannels * 2);
-	output.writeUint16LE(numChannels * 2);
-	output.writeUint16LE(16);
-	output.writeUint32BE(MKTAG('d', 'a', 't', 'a'));
-	output.writeUint32LE(file.size() * 2);
-	int16 *buffer = new int16[file.size()];
-	audioStream->readBuffer(buffer, file.size());
-	output.write(buffer, file.size() * 2);
-
-	delete[] buffer;
-}
-
 } // End of namespace ZVision
diff --git a/engines/zvision/utility/utility.h b/engines/zvision/utility/utility.h
index 0741cc0..0ca26b9 100644
--- a/engines/zvision/utility/utility.h
+++ b/engines/zvision/utility/utility.h
@@ -34,15 +34,6 @@ namespace ZVision {
 class ZVision;
 
 /**
- * Opens the sourceFile utilizing Common::File (aka SearchMan) and writes the
- * contents to destFile. destFile is created in the working directory
- *
- * @param sourceFile    The 'file' you want the contents of
- * @param destFile      The name of the file where the content will be written to
- */
-void writeFileContentsToFile(const Common::String &sourceFile, const Common::String &destFile);
-
-/**
  * Removes any line comments using '#' as a sequence start.
  * Then removes any trailing and leading 'whitespace' using String::trim()
  * Note: String::trim uses isspace() to determine what is whitespace and what is not.
@@ -51,63 +42,6 @@ void writeFileContentsToFile(const Common::String &sourceFile, const Common::Str
  */
 void trimCommentsAndWhiteSpace(Common::String *string);
 
-/**
- * Searches through all the .scr files and dumps 'numberOfExamplesPerType' examples of each type of ResultAction
- * ZVision::initialize() must have been called before this function can be used.
- *
- * @param destFile    Where to write the examples
- */
-void dumpEveryResultAction(const Common::String &destFile);
-
-/**
- * Removes all duplicate entries from container. Relative order will be preserved.
- *
- * @param container    The Array to remove duplicate entries from
- */
-template<class T>
-void removeDuplicateEntries(Common::Array<T> &container) {
-	// Length of modified array
-	uint newLength = 1;
-	uint j;
-
-	for (uint i = 1; i < container.size(); i++) {
-		for (j = 0; j < newLength; j++) {
-			if (container[i] == container[j]) {
-				break;
-			}
-		}
-
-		// If none of the values in index[0..j] of container are the same as array[i],
-		// then copy the current value to corresponding new position in array
-		if (j == newLength) {
-			container[newLength++] = container[i];
-		}
-	}
-
-	// Actually remove the unneeded space
-	while (container.size() < newLength) {
-		container.pop_back();
-	}
-}
-
-/**
- * Gets the name of the file (including extension). Forward or back slashes
- * are interpreted as directory changes
- *
- * @param fullPath    A full or partial path to the file. Ex: folderOne/folderTwo/file.txt
- * @return            The name of the file without any preceding directories. Ex: file.txt
- */
-Common::String getFileName(const Common::String &fullPath);
-
-/**
- * Converts a ZVision .RAW file to a .WAV
- * The .WAV will be created in the working directory and will overwrite any existing file
- *
- * @param inputFile     The path to the input .RAW file
- * @param outputFile    The name of the output .WAV file
- */
-void convertRawToWav(const Common::String &inputFile, ZVision *engine, const Common::String &outputFile);
-
 } // End of namespace ZVision
 
 #endif






More information about the Scummvm-git-logs mailing list