[Scummvm-cvs-logs] SF.net SVN: scummvm:[53197] scummvm/trunk/engines/sword25

sev at users.sourceforge.net sev at users.sourceforge.net
Wed Oct 13 00:17:11 CEST 2010


Revision: 53197
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53197&view=rev
Author:   sev
Date:     2010-10-12 22:17:11 +0000 (Tue, 12 Oct 2010)

Log Message:
-----------
SWORD25: Converted the math folder files

Modified Paths:
--------------
    scummvm/trunk/engines/sword25/kernel/inputpersistenceblock.cpp
    scummvm/trunk/engines/sword25/kernel/inputpersistenceblock.h
    scummvm/trunk/engines/sword25/kernel/kernel.h
    scummvm/trunk/engines/sword25/math/geometry_script.cpp
    scummvm/trunk/engines/sword25/math/line.h
    scummvm/trunk/engines/sword25/math/polygon.cpp
    scummvm/trunk/engines/sword25/math/polygon.h
    scummvm/trunk/engines/sword25/math/rect.h
    scummvm/trunk/engines/sword25/math/region.cpp
    scummvm/trunk/engines/sword25/math/region.h
    scummvm/trunk/engines/sword25/math/regionregistry.cpp
    scummvm/trunk/engines/sword25/math/regionregistry.h
    scummvm/trunk/engines/sword25/math/vertex.cpp
    scummvm/trunk/engines/sword25/math/vertex.h
    scummvm/trunk/engines/sword25/math/walkregion.cpp
    scummvm/trunk/engines/sword25/math/walkregion.h
    scummvm/trunk/engines/sword25/script/luascript.cpp

Modified: scummvm/trunk/engines/sword25/kernel/inputpersistenceblock.cpp
===================================================================
--- scummvm/trunk/engines/sword25/kernel/inputpersistenceblock.cpp	2010-10-12 22:17:00 UTC (rev 53196)
+++ scummvm/trunk/engines/sword25/kernel/inputpersistenceblock.cpp	2010-10-12 22:17:11 UTC (rev 53197)
@@ -40,23 +40,21 @@
 
 #include "sword25/kernel/inputpersistenceblock.h"
 
-using namespace std;
+namespace Sword25 {
 
 // -----------------------------------------------------------------------------
-// Construction / Destruction
+// Constructor / Destructor
 // -----------------------------------------------------------------------------
 
 BS_InputPersistenceBlock::BS_InputPersistenceBlock(const void * Data, unsigned int DataLength) :
-	m_Data(static_cast<const unsigned char *>(Data), static_cast<const unsigned char *>(Data) + DataLength),
-	m_ErrorState(NONE)
-{
+		m_Data(static_cast<const unsigned char *>(Data), DataLength),
+		m_ErrorState(NONE) {
 	m_Iter = m_Data.begin();
 }
 
 // -----------------------------------------------------------------------------
 
-BS_InputPersistenceBlock::~BS_InputPersistenceBlock()
-{
+BS_InputPersistenceBlock::~BS_InputPersistenceBlock() {
 	if (m_Iter != m_Data.end()) BS_LOG_WARNINGLN("Persistence block was not read to the end.");
 }
 
@@ -64,80 +62,69 @@
 // Reading
 // -----------------------------------------------------------------------------
 
-void BS_InputPersistenceBlock::Read(signed int & Value)
-{
-	if (CheckMarker(SINT_MARKER))
-	{
+void BS_InputPersistenceBlock::Read(int16 &Value) {
+	signed int v;
+	Read(v);
+	Value = static_cast<int16>(v);
+}
+
+// -----------------------------------------------------------------------------
+
+void BS_InputPersistenceBlock::Read(signed int &Value) {
+	if (CheckMarker(SINT_MARKER)) {
 		RawRead(&Value, sizeof(signed int));
 		Value = ConvertEndianessFromStorageToSystem(Value);
-	}
-	else
-	{
+	} else {
 		Value = 0;
 	}
 }
 
 // -----------------------------------------------------------------------------
 
-void BS_InputPersistenceBlock::Read(unsigned int & Value)
-{
-	if (CheckMarker(UINT_MARKER))
-	{
+void BS_InputPersistenceBlock::Read(unsigned int &Value) {
+	if (CheckMarker(UINT_MARKER)) {
 		RawRead(&Value, sizeof(unsigned int));
 		Value = ConvertEndianessFromStorageToSystem(Value);
-	}
-	else
-	{
+	} else {
 		Value = 0;
 	}
 }
 
 // -----------------------------------------------------------------------------
 
-void BS_InputPersistenceBlock::Read(float & Value)
-{
-	if (CheckMarker(FLOAT_MARKER))
-	{
+void BS_InputPersistenceBlock::Read(float &Value) {
+	if (CheckMarker(FLOAT_MARKER)) {
 		RawRead(&Value, sizeof(float));
 		Value = ConvertEndianessFromStorageToSystem(Value);
-	}
-	else
-	{
+	} else {
 		Value = 0.0f;
 	}
 }
 
 // -----------------------------------------------------------------------------
 
-void BS_InputPersistenceBlock::Read(bool & Value)
-{
-	if (CheckMarker(BOOL_MARKER))
-	{
+void BS_InputPersistenceBlock::Read(bool &Value) {
+	if (CheckMarker(BOOL_MARKER)) {
 		unsigned int UIntBool;
 		RawRead(&UIntBool, sizeof(float));
 		UIntBool = ConvertEndianessFromStorageToSystem(UIntBool);
 		Value = UIntBool == 0 ? false : true;
-	}
-	else
-	{
+	} else {
 		Value = 0.0f;
 	}
 }
 
 // -----------------------------------------------------------------------------
 
-void BS_InputPersistenceBlock::Read(std::string & Value)
-{
+void BS_InputPersistenceBlock::Read(Common::String &Value) {
 	Value = "";
 	
-	if (CheckMarker(STRING_MARKER))
-	{
+	if (CheckMarker(STRING_MARKER)) {
 		unsigned int Size;
 		Read(Size);
 
-		if (CheckBlockSize(Size))
-		{
-			Value = std::string(reinterpret_cast<const char *>(&*m_Iter), Size);
+		if (CheckBlockSize(Size)) {
+			Value = Common::String(reinterpret_cast<const char *>(&*m_Iter), Size);
 			m_Iter += Size;
 		}
 	}
@@ -145,16 +132,13 @@
 
 // -----------------------------------------------------------------------------
 
-void BS_InputPersistenceBlock::Read(vector<unsigned char> & Value)
-{
-	if (CheckMarker(BLOCK_MARKER))
-	{
+void BS_InputPersistenceBlock::Read(Common::Array<unsigned char> &Value) {
+	if (CheckMarker(BLOCK_MARKER)) {
 		unsigned int Size;
 		Read(Size);
 
-		if (CheckBlockSize(Size))
-		{
-			Value = vector<unsigned char>(m_Iter, m_Iter + Size);
+		if (CheckBlockSize(Size)) {
+			Value = Common::Array<unsigned char>(m_Iter, Size);
 			m_Iter += Size;
 		}
 	}
@@ -162,10 +146,8 @@
 
 // -----------------------------------------------------------------------------
 
-void BS_InputPersistenceBlock::RawRead(void * DestPtr, size_t Size)
-{
-	if (CheckBlockSize(Size))
-	{
+void BS_InputPersistenceBlock::RawRead(void * DestPtr, size_t Size) {
+	if (CheckBlockSize(Size)) {
 		memcpy(DestPtr, &*m_Iter, Size);
 		m_Iter += Size;
 	}
@@ -173,14 +155,10 @@
 
 // -----------------------------------------------------------------------------
 
-bool BS_InputPersistenceBlock::CheckBlockSize(int Size)
-{
-	if (m_Data.end() - m_Iter >= Size)
-	{
+bool BS_InputPersistenceBlock::CheckBlockSize(int Size) {
+	if (m_Data.end() - m_Iter >= Size) {
 		return true;
-	}
-	else
-	{
+	} else {
 		m_ErrorState = END_OF_DATA;
 		BS_LOG_ERRORLN("Unexpected end of persistence block.");
 		return false;
@@ -189,18 +167,16 @@
 
 // -----------------------------------------------------------------------------
 
-bool BS_InputPersistenceBlock::CheckMarker(unsigned char Marker)
-{
+bool BS_InputPersistenceBlock::CheckMarker(unsigned char Marker) {
 	if (!IsGood() || !CheckBlockSize(1)) return false;
 
-	if (*m_Iter++ == Marker)
-	{
+	if (*m_Iter++ == Marker) {
 		return true;
-	}
-	else
-	{
+	} else {
 		m_ErrorState = OUT_OF_SYNC;
 		BS_LOG_ERRORLN("Wrong type marker found in persistence block.");
 		return false;
 	}
 }
+
+} // End of namespace Sword25

Modified: scummvm/trunk/engines/sword25/kernel/inputpersistenceblock.h
===================================================================
--- scummvm/trunk/engines/sword25/kernel/inputpersistenceblock.h	2010-10-12 22:17:00 UTC (rev 53196)
+++ scummvm/trunk/engines/sword25/kernel/inputpersistenceblock.h	2010-10-12 22:17:11 UTC (rev 53197)
@@ -62,12 +62,13 @@
 	BS_InputPersistenceBlock(const void *Data, unsigned int DataLength);
 	virtual ~BS_InputPersistenceBlock();
 
+	void Read(int16 &Value);
 	void Read(signed int &Value);
 	void Read(unsigned int &Value);
 	void Read(float &Value);
 	void Read(bool &Value);
-	void Read(std::string &Value);
-	void Read(std::vector<unsigned char> &Value);
+	void Read(Common::String &Value);
+	void Read(Common::Array<unsigned char> &Value);
 
 	bool IsGood() const { return m_ErrorState == NONE; }
 	ErrorState GetErrorState() const { return m_ErrorState; }

Modified: scummvm/trunk/engines/sword25/kernel/kernel.h
===================================================================
--- scummvm/trunk/engines/sword25/kernel/kernel.h	2010-10-12 22:17:00 UTC (rev 53196)
+++ scummvm/trunk/engines/sword25/kernel/kernel.h	2010-10-12 22:17:11 UTC (rev 53197)
@@ -339,6 +339,18 @@
 	BS_Service* (*CreateMethod)(BS_Kernel *);
 };
 
+template<class T>
+void ReverseArray(Common::Array<T> Arr) {
+	if (Arr.size() < 2)
+		return;
+
+	for (uint i = 0; i < (Arr.size() / 2 - 1); ++i) {
+		T temp = Arr[i];
+		Arr[i] = Arr[Arr.size() - i - 1];
+		Arr[Arr.size() - i - 1] = temp;
+	}
 }
 
+} // End of namespace Sword25
+
 #endif

Modified: scummvm/trunk/engines/sword25/math/geometry_script.cpp
===================================================================
--- scummvm/trunk/engines/sword25/math/geometry_script.cpp	2010-10-12 22:17:00 UTC (rev 53196)
+++ scummvm/trunk/engines/sword25/math/geometry_script.cpp	2010-10-12 22:17:11 UTC (rev 53197)
@@ -36,11 +36,7 @@
 // Includes
 // -----------------------------------------------------------------------------
 
-#include "sword25/kernel/memlog_off.h"
-#include <memory>
-#include <vector>
-#include "sword25/kernel/memlog_on.h"
-
+#include "common/array.h"
 #include "sword25/gfx/graphicengine.h"
 #include "sword25/kernel/common.h"
 #include "sword25/kernel/kernel.h"
@@ -55,21 +51,20 @@
 
 // -----------------------------------------------------------------------------
 
-using namespace std;
+namespace Sword25 {
 
 // -----------------------------------------------------------------------------
 // Constants
 // -----------------------------------------------------------------------------
 
-// Die Strings werden als #defines definiert um Stringkomposition zur Compilezeit zu erm\xF6glichen.
+// These strings are defined as #defines to enable compile-time string composition
 #define REGION_CLASS_NAME "Geo.Region"
 #define WALKREGION_CLASS_NAME "Geo.WalkRegion"
 
 // -----------------------------------------------------------------------------
 
-// Wie luaL_checkudata, nur ohne dass kein Fehler erzeugt wird.
-static void * my_checkudata (lua_State *L, int ud, const char *tname)
-{
+// How luaL_checkudata, only without that no error is generated.
+static void *my_checkudata(::lua_State *L, int ud, const char *tname) {
 	int top = lua_gettop(L);
 
 	void * p = lua_touserdata(L, ud);
@@ -79,8 +74,8 @@
 		{  
 			// lua_getfield(L, LUA_REGISTRYINDEX, tname);  /* get correct metatable */
 			BS_LuaBindhelper::GetMetatable(L, tname);
-			if (lua_rawequal(L, -1, -2)) /* does it have the correct mt? */
-			{
+			/* does it have the correct mt? */
+			if (lua_rawequal(L, -1, -2)) {
 				lua_settop(L, top);
 				return p;
 			}
@@ -93,50 +88,43 @@
 
 // -----------------------------------------------------------------------------
 
-static void NewUintUserData(lua_State * L, unsigned int Value)
-{
+static void NewUintUserData(::lua_State *L, unsigned int Value) {
 	void * UserData = lua_newuserdata(L, sizeof(Value));
 	memcpy(UserData, &Value, sizeof(Value));
 }
 
 // -----------------------------------------------------------------------------
 
-static bool IsValidPolygonDefinition(lua_State * L)
-{
+static bool IsValidPolygonDefinition(::lua_State *L) {
 #ifdef DEBUG
 	int __startStackDepth = lua_gettop(L);
 #endif
 
-	// Sicherstellen, dass wir wirklich eine Tabelle betrachten
-	if (!lua_istable(L, -1))
-	{
+	// Ensure that we actually consider a table
+	if (!lua_istable(L, -1)) {
 		luaL_error(L, "Invalid polygon definition. Unexpected type, \"table\" needed.");
 		return false;
 	}
 
 	int TableSize = luaL_getn(L, -1);
 
-	// Sicherstellen, dass mindestens 3 Vertecies existieren.
-	if (TableSize < 6)
-	{
+	// Make sure that there are at least three Vertecies
+	if (TableSize < 6) {
 		luaL_error(L, "Invalid polygon definition. At least three vertecies needed.");
 		return false;
 	}
 
-	// Sicherstellen, dass die Anzahl der Tabellenelemente durch zwei teilbar ist.
-	// Da je zwei Elemente ein Vertex definieren, ist eine ungerade Anzahl an Elementen nicht zul\xE4ssig.
-	if ((TableSize % 2) != 0)
-	{
+	// Make sure that the number of table elements is divisible by two.
+	// Since any two elements is a vertex, an odd number of elements is not allowed
+	if ((TableSize % 2) != 0) {
 		luaL_error(L, "Invalid polygon definition. Even number of table elements needed.");
 		return false;
 	}
 
-	// Sicherstellen, dass alle Elemente der Tabelle vom Typ Number sind.
-	for (int i = 1; i <= TableSize; i += 1)
-	{
+	// Ensure that all elements in the table are of type Number
+	for (int i = 1; i <= TableSize; i += 1) {
 		lua_rawgeti(L, -1, i);
-		if (!lua_isnumber(L, -1))
-		{
+		if (!lua_isnumber(L, -1)) {
 			luaL_error(L, "Invalid polygon definition. All table elements have to be numbers.");
 			return false;
 		}
@@ -152,32 +140,31 @@
 
 // -----------------------------------------------------------------------------
 
-static void TablePolygonToPolygon(lua_State * L, BS_Polygon & Polygon)
-{
+static void TablePolygonToPolygon(::lua_State *L, BS_Polygon &Polygon) {
 #ifdef DEBUG
 	int __startStackDepth = lua_gettop(L);
 #endif
 
-	// Sicherstellen, dass eine g\xFCltige Polygon-Definition auf dem Stack liegt.
-	// Es ist nicht notwendig den R\xFCckgabewert abzufangen, da alle Fehler \xFCber luaL_error ausgegeben werden und somit die Ausf\xFChrung des
-	// Skriptes beenden.
+	// Ensure that a valid polygon definition is on the stack.
+	// It is not necessary to catch the return value, since all errors are reported on luaL_error
+	// End script.
 	IsValidPolygonDefinition(L);
 
 	int VertexCount = luaL_getn(L, -1) / 2;
 
-	// Speicher f\xFCr Vertecies reservieren
-	vector<BS_Vertex> Vertecies;
+	// Memory is reserved for Vertecies
+	Common::Array<BS_Vertex> Vertecies;
 	Vertecies.reserve(VertexCount);
 
-	// Vertecies erstellen
+	// Create Vertecies
 	for (int i = 0; i < VertexCount; i++)
 	{
-		// X-Wert
+		// X Value
 		lua_rawgeti(L, -1, (i * 2) + 1);
 		int X = static_cast<int>(lua_tonumber(L, -1));
 		lua_pop(L, 1);
 
-		// Y-Wert
+		// Y Value
 		lua_rawgeti(L, -1, (i * 2) + 2);
 		int Y = static_cast<int>(lua_tonumber(L, -1));
 		lua_pop(L, 1);
@@ -185,72 +172,63 @@
 		// Vertex
 		Vertecies.push_back(BS_Vertex(X, Y));
 	}
-	BS_ASSERT(Vertecies.size() == VertexCount);
+	BS_ASSERT((int)Vertecies.size() == VertexCount);
 
 #ifdef DEBUG
 	BS_ASSERT(__startStackDepth == lua_gettop(L));
 #endif
 
-	// Polygon erstellen
+	// Create polygon
 	Polygon.Init(VertexCount, &Vertecies[0]);
 }
 
 // -----------------------------------------------------------------------------
 
-static unsigned int TableRegionToRegion(lua_State * L, const char * ClassName)
-{
+static unsigned int TableRegionToRegion(::lua_State *L, const char *ClassName) {
 #ifdef DEBUG
 	int __startStackDepth = lua_gettop(L);
 #endif
 
-	// Man kann eine Region in Lua auf zwei Arten definieren:
-	// 1. Eine Tabelle, die ein Polygon definiert (Polygon = Tabelle mit Zahlen, wobei je zwei aufeinander folgende Zahlen ein Vertex definieren)
-	//    Das eine Polygon definiert die Region vollst\xE4ndig (=> keine L\xF6cher m\xF6glich)
-	// 2. Eine Tabelle, die mehrere Polygondefinitionen (wiederum Tabellen (siehe 1.)) enth\xE4lt.
-	//    Dann definiert das erste Polygon den Umriss der Region und die folgenden L\xF6cher im ersten Polygon.
+	// You can define a region in Lua in two ways:
+	// 1. A table that defines a polygon (polgon = table with numbers, which define
+	// two consecutive numbers per vertex)
+	// 2. A table containing more polygon definitions
+	// Then the first polygon is the contour of the region, and the following are holes
+	// defined in the first polygon.
 
-	// Es darf nur ein Parameter \xFCbergeben werden und dieser muss eine Tabelle sein.
-	if (lua_gettop(L) != 1 || !lua_istable(L, -1))
-	{
+	// It may be passed only one parameter, and this must be a table
+	if (lua_gettop(L) != 1 || !lua_istable(L, -1)) {
 		luaL_error(L, "First and only parameter has to be of type \"table\".");
 		return 0;
 	}
 
 	unsigned int RegionHandle;
-	if (ClassName == REGION_CLASS_NAME)
-	{
+	if (ClassName == REGION_CLASS_NAME) {
 		RegionHandle = BS_Region::Create(BS_Region::RT_REGION);
-	}
-	else if (ClassName == WALKREGION_CLASS_NAME)
-	{
+	} else if (ClassName == WALKREGION_CLASS_NAME) {
 		RegionHandle = BS_WalkRegion::Create(BS_Region::RT_WALKREGION);
-	}
-	else
-	{
+	} else {
 		BS_ASSERT(false);
 	}
 
 	BS_ASSERT(RegionHandle);
 
-	// Wenn das erste Element des Parameters eine Zahl ist, wird der 1. Fall angenommen.
-	// Wenn das erste Element des Parameters eine Tabelle ist, wird der 2. Fall angenommen.
-	// Wenn das erste Element des Parameters einen anderen Typ hat, liegt ein Fehler vor.
+	// If the first element of the parameter is a number, then case 1 is accepted
+	// If the first element of the parameter is a table, then case 2 is accepted
+	// If the first element of the parameter has a different type, there is an error
 	lua_rawgeti(L, -1, 1);
 	int FirstElementType = lua_type(L, -1);
 	lua_pop(L, 1);
 
-	switch(FirstElementType)
-	{
-		case LUA_TNUMBER:
-			{
+	switch(FirstElementType) {
+		case LUA_TNUMBER: {
 				BS_Polygon Polygon;
 				TablePolygonToPolygon(L, Polygon);
 				BS_RegionRegistry::GetInstance().ResolveHandle(RegionHandle)->Init(Polygon);
 			}
 			break;
 		
-		case LUA_TTABLE:
-			{
+		case LUA_TTABLE: {
 				lua_rawgeti(L, -1, 1);
 				BS_Polygon Polygon;
 				TablePolygonToPolygon(L, Polygon);
@@ -259,19 +237,17 @@
 				int PolygonCount = luaL_getn(L, -1);
 				if (PolygonCount == 1)
 					BS_RegionRegistry::GetInstance().ResolveHandle(RegionHandle)->Init(Polygon);
-				else
-				{
-					vector<BS_Polygon> Holes;
+				else {
+					Common::Array<BS_Polygon> Holes;
 					Holes.reserve(PolygonCount - 1);
 
-					for (int i = 2; i <= PolygonCount; i++)
-					{
+					for (int i = 2; i <= PolygonCount; i++) {
 						lua_rawgeti(L, -1, i);
 						Holes.resize(Holes.size() + 1);
 						TablePolygonToPolygon(L, Holes.back());
 						lua_pop(L, 1);
 					}
-					BS_ASSERT(Holes.size() == PolygonCount - 1);
+					BS_ASSERT((int)Holes.size() == PolygonCount - 1);
 
 					BS_RegionRegistry::GetInstance().ResolveHandle(RegionHandle)->Init(Polygon, &Holes);
 				}
@@ -292,10 +268,10 @@
 
 // -----------------------------------------------------------------------------
 
-static void NewUserdataRegion(lua_State * L, const char * ClassName)
+static void NewUserdataRegion(::lua_State *L, const char *ClassName)
 {
-	// Region aufgrund des Lua-Codes erstellen.
-	// Fehler treten nicht auf, sondern werden von der Funktion \xFCber luaL_error abgefangen.
+	// Region due to the Lua code to create
+	// Any errors that occur will be intercepted to the luaL_error
 	unsigned int RegionHandle = TableRegionToRegion(L, ClassName);
 	BS_ASSERT(RegionHandle);
 
@@ -308,26 +284,23 @@
 
 // -----------------------------------------------------------------------------
 
-static int NewRegion(lua_State * L)
-{
+static int NewRegion(::lua_State *L) {
 	NewUserdataRegion(L, REGION_CLASS_NAME);
 	return 1;
 }
 
 // -----------------------------------------------------------------------------
 
-static int NewWalkRegion(lua_State * L)
-{
+static int NewWalkRegion(::lua_State *L) {
 	NewUserdataRegion(L, WALKREGION_CLASS_NAME);
 	return 1;
 }
 
 // -----------------------------------------------------------------------------
 
-static const char * GEO_LIBRARY_NAME = "Geo";
+static const char *GEO_LIBRARY_NAME = "Geo";
 
-static const luaL_reg GEO_FUNCTIONS[] =
-{
+static const luaL_reg GEO_FUNCTIONS[] = {
 	"NewRegion", NewRegion,
 	"NewWalkRegion", NewWalkRegion,
 	0, 0,
@@ -335,28 +308,23 @@
 
 // -----------------------------------------------------------------------------
 
-static BS_Region * CheckRegion(lua_State * L)
-{
-	// Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Geo.Region oder Geo.WalkRegion
-	unsigned int * RegionHandlePtr;
+static BS_Region * CheckRegion(::lua_State *L) {
+	// The first parameter must be of type 'userdata', and the Metatable class Geo.Region or Geo.WalkRegion
+	unsigned int *RegionHandlePtr;
 	if ((RegionHandlePtr = reinterpret_cast<unsigned int *>(my_checkudata(L, 1, REGION_CLASS_NAME))) != 0 ||
-		(RegionHandlePtr = reinterpret_cast<unsigned int *>(my_checkudata(L, 1, WALKREGION_CLASS_NAME))) != 0)
-	{
+		(RegionHandlePtr = reinterpret_cast<unsigned int *>(my_checkudata(L, 1, WALKREGION_CLASS_NAME))) != 0) {
 		return BS_RegionRegistry::GetInstance().ResolveHandle(*RegionHandlePtr);
-	}
-	else
-	{
+	} else {
 		luaL_argcheck(L, 0, 1, "'" REGION_CLASS_NAME "' expected");
 	}
 
-	// Compiler ruhigstellen. Ausf\xFChrung kommt nie an diesem Punkt an.
+	// Compilation fix. Execution never reaches this point
 	return 0;
 }
 
 // -----------------------------------------------------------------------------
 
-static int R_IsValid(lua_State * L)
-{
+static int R_IsValid(::lua_State *L) {
 	BS_Region * pR = CheckRegion(L);
 	BS_ASSERT(pR);
 
@@ -366,8 +334,7 @@
 
 // -----------------------------------------------------------------------------
 
-static int R_GetX(lua_State * L)
-{
+static int R_GetX(::lua_State *L) {
 	BS_Region * pR = CheckRegion(L);
 	BS_ASSERT(pR);
 
@@ -377,8 +344,7 @@
 
 // -----------------------------------------------------------------------------
 
-static int R_GetY(lua_State * L)
-{
+static int R_GetY(::lua_State *L) {
 	BS_Region * pR = CheckRegion(L);
 	BS_ASSERT(pR);
 
@@ -388,8 +354,7 @@
 
 // -----------------------------------------------------------------------------
 
-static int R_GetPos(lua_State * L)
-{
+static int R_GetPos(::lua_State *L) {
 	BS_Region * pR = CheckRegion(L);
 	BS_ASSERT(pR);
 
@@ -399,8 +364,7 @@
 
 // -----------------------------------------------------------------------------
 
-static int R_IsPointInRegion(lua_State * L)
-{
+static int R_IsPointInRegion(::lua_State *L) {
 	BS_Region * pR = CheckRegion(L);
 	BS_ASSERT(pR);
 
@@ -412,8 +376,7 @@
 
 // -----------------------------------------------------------------------------
 
-static int R_SetPos(lua_State * L)
-{
+static int R_SetPos(::lua_State *L) {
 	BS_Region * pR = CheckRegion(L);
 	BS_ASSERT(pR);
 
@@ -426,8 +389,7 @@
 
 // -----------------------------------------------------------------------------
 
-static int R_SetX(lua_State * L)
-{
+static int R_SetX(::lua_State *L) {
 	BS_Region * pR = CheckRegion(L);
 	BS_ASSERT(pR);
 
@@ -438,8 +400,7 @@
 
 // -----------------------------------------------------------------------------
 
-static int R_SetY(lua_State * L)
-{
+static int R_SetY(::lua_State *L) {
 	BS_Region * pR = CheckRegion(L);
 	BS_ASSERT(pR);
 
@@ -450,9 +411,8 @@
 
 // -----------------------------------------------------------------------------
 
-static void DrawPolygon(const BS_Polygon & Polygon, unsigned int Color, const BS_Vertex & Offset)
-{
-	BS_GraphicEngine * pGE = static_cast<BS_GraphicEngine *>(BS_Kernel::GetInstance()->GetService("gfx"));
+static void DrawPolygon(const BS_Polygon &Polygon, unsigned int Color, const BS_Vertex &Offset) {
+	BS_GraphicEngine *pGE = static_cast<BS_GraphicEngine *>(BS_Kernel::GetInstance()->GetService("gfx"));
 	BS_ASSERT(pGE);
 
 	for (int i = 0; i < Polygon.VertexCount - 1; i++)
@@ -463,8 +423,7 @@
 
 // -----------------------------------------------------------------------------
 
-static void DrawRegion(const BS_Region & Region, unsigned int Color, const BS_Vertex & Offset)
-{
+static void DrawRegion(const BS_Region &Region, unsigned int Color, const BS_Vertex &Offset) {
 	DrawPolygon(Region.GetContour(), Color, Offset);
 	for (int i = 0; i < Region.GetHoleCount(); i++)
 		DrawPolygon(Region.GetHole(i), Color, Offset);
@@ -472,15 +431,12 @@
 
 // -----------------------------------------------------------------------------
 
-static int R_Draw(lua_State * L)
-{
+static int R_Draw(::lua_State *L) {
 	BS_Region * pR = CheckRegion(L);
 	BS_ASSERT(pR);
 
-	switch (lua_gettop(L))
-	{
-		case 3:
-			{
+	switch (lua_gettop(L)) {
+		case 3: {
 				BS_Vertex Offset;
 				BS_Vertex::LuaVertexToVertex(L, 3, Offset);
 				DrawRegion(*pR, BS_GraphicEngine::LuaColorToARGBColor(L, 2), Offset);
@@ -500,8 +456,7 @@
 
 // -----------------------------------------------------------------------------
 
-static int R_GetCentroid(lua_State * L)
-{
+static int R_GetCentroid(::lua_State *L) {
 	BS_Region * RPtr = CheckRegion(L);
 	BS_ASSERT(RPtr);
 
@@ -512,8 +467,7 @@
 
 // -----------------------------------------------------------------------------
 
-static int R_Delete(lua_State * L)
-{
+static int R_Delete(::lua_State *L) {
 	BS_Region * pR = CheckRegion(L);
 	BS_ASSERT(pR);
 	delete pR;
@@ -522,8 +476,7 @@
 
 // -----------------------------------------------------------------------------
 
-static const luaL_reg REGION_METHODS[] =
-{
+static const luaL_reg REGION_METHODS[] = {
 	"SetPos", R_SetPos,
 	"SetX", R_SetX,
 	"SetY", R_SetY,
@@ -539,28 +492,23 @@
 
 // -----------------------------------------------------------------------------
 
-static BS_WalkRegion * CheckWalkRegion(lua_State * L)
-{
-	// Der erste Parameter muss vom Typ userdata sein und die Metatable der Klasse Geo.WalkRegion
+static BS_WalkRegion *CheckWalkRegion(::lua_State *L) {
+	// The first parameter must be of type 'userdate', and the Metatable class Geo.WalkRegion
 	unsigned int RegionHandle;
-	if ((RegionHandle = *reinterpret_cast<unsigned int *>(my_checkudata(L, 1, WALKREGION_CLASS_NAME))) != 0)
-	{
+	if ((RegionHandle = *reinterpret_cast<unsigned int *>(my_checkudata(L, 1, WALKREGION_CLASS_NAME))) != 0) {
 		return reinterpret_cast<BS_WalkRegion *>(BS_RegionRegistry::GetInstance().ResolveHandle(RegionHandle));
-	}
-	else
-	{
+	} else {
 		luaL_argcheck(L, 0, 1, "'" WALKREGION_CLASS_NAME "' expected");
 	}
 
-	// Compiler ruhigstellen. Ausf\xFChrung kommt nie an diesem Punkt an.
+	// Compilation fix. Execution never reaches this point
 	return 0;
 }
 
 // -----------------------------------------------------------------------------
 
-static int WR_GetPath(lua_State * L)
-{
-	BS_WalkRegion * pWR = CheckWalkRegion(L);
+static int WR_GetPath(::lua_State *L) {
+	BS_WalkRegion *pWR = CheckWalkRegion(L);
 	BS_ASSERT(pWR);
 
 	BS_Vertex Start;
@@ -568,18 +516,15 @@
 	BS_Vertex End;
 	BS_Vertex::LuaVertexToVertex(L, 3, End);
 	BS_Path Path;
-	if (pWR->QueryPath(Start, End, Path))
-	{
+	if (pWR->QueryPath(Start, End, Path)) {
 		lua_newtable(L);
 		BS_Path::const_iterator it = Path.begin();
-		for (; it != Path.end(); it++)
-		{
+		for (; it != Path.end(); it++) {
 			lua_pushnumber(L, (it - Path.begin()) + 1);
 			BS_Vertex::VertexToLuaVertex(L, *it);
 			lua_settable(L, -3);
 		}
-	}
-	else
+	} else
 		lua_pushnil(L);
 
 	return 1;
@@ -587,21 +532,19 @@
 
 // -----------------------------------------------------------------------------
 
-static const luaL_reg WALKREGION_METHODS[] =
-{
+static const luaL_reg WALKREGION_METHODS[] = {
 	"GetPath", WR_GetPath,
 	0, 0,
 };
 
 // -----------------------------------------------------------------------------
 
-bool BS_Geometry::_RegisterScriptBindings()
-{
+bool BS_Geometry::_RegisterScriptBindings() {
 	BS_Kernel * pKernel = BS_Kernel::GetInstance();
 	BS_ASSERT(pKernel);
 	BS_ScriptEngine * pScript = static_cast<BS_ScriptEngine *>(pKernel->GetService("script"));
 	BS_ASSERT(pScript);
-	lua_State * L = static_cast<lua_State *>(pScript->GetScriptObject());
+	::lua_State *L = static_cast< ::lua_State *>(pScript->GetScriptObject());
 	BS_ASSERT(L);
 
 	if (!BS_LuaBindhelper::AddMethodsToClass(L, REGION_CLASS_NAME, REGION_METHODS)) return false;
@@ -615,3 +558,5 @@
 
 	return true;
 }
+
+} // End of namespace Sword25

Modified: scummvm/trunk/engines/sword25/math/line.h
===================================================================
--- scummvm/trunk/engines/sword25/math/line.h	2010-10-12 22:17:00 UTC (rev 53196)
+++ scummvm/trunk/engines/sword25/math/line.h	2010-10-12 22:17:11 UTC (rev 53197)
@@ -35,11 +35,11 @@
 /*
 	BS_Line
 	-------
-	Diese Klasse enth\xE4lt nur statische Methoden, die mit Geradensegmenten zu tun haben.
-    Es gibt keine wirkliche Geradensegment-Klasse, da diese Klasse vor allem zu
-	Berechnungen mit Polygonen herangezogen wird und es dabei wichtig ist, Start- und
-	Endpunkte der Linien dynamisch w\xE4hlen zu k\xF6nnen. Dieses w\xFCrde sich verbieten, wenn
-	ein Polygon aus einer Menge von festen Geradensegmenten gebildet w\xE4re.
+	This class contains only static methods, which have to do with straight line
+	segments. There is no real straight line segment class. Calculations will be
+	used with polygons, and it is important the process of starting and selecting
+	endpoints of lines is dynamic. This would prhobit a polygon from a set
+	being formed by fixed line segments
 
 	Autor: Malte Thiesen
 */
@@ -55,77 +55,69 @@
 
 // -----------------------------------------------------------------------------
 
-class BS_Line
-{
+namespace Sword25 {
+
+class BS_Line {
 public:
 	/**
-	    @brief Bestimmt ob sich ein Punkt links von einer Linie befindet.
-		@param a der Startpunkt der	Linie
-		@param b der Endpunkt der Linie
-		@param c der Testpunkt
-		@return Gibt true zur\xFCck, wenn sich der Punkt links von der Linie befindet.<br>
-				Falls sich der Punkt rechts von der Linie oder auf der Linie befindet wird false zur\xFCckgegeben.<br>
-		@remark Ein Punkt liegt links von einer Linie, wenn er vom Startpunkt aus betrachtet links neben der Linie liegt.
-	*/
-	static bool IsVertexLeft(const BS_Vertex & a, const BS_Vertex & b, const BS_Vertex & c)
-	{
+	 * Determines whether a piont is left of a line
+	 * @param a			The start point of a line
+	 * @param b			The end point of a line
+	 * @param c			The test point
+	 * @return			Returns true if the point is to the left of the line.
+	 * If the point is to the right of the line or on the line, false is returned.
+	 */
+	static bool IsVertexLeft(const BS_Vertex &a, const BS_Vertex &b, const BS_Vertex &c) {
 		return _TriangleArea2(a, b, c) > 0;
 	}
 
-	static bool IsVertexLeftOn(const BS_Vertex & a, const BS_Vertex & b, const BS_Vertex & c)
-	{
+	static bool IsVertexLeftOn(const BS_Vertex &a, const BS_Vertex &b, const BS_Vertex &c) {
 		return _TriangleArea2(a, b, c) >= 0;
 	}
 
 	/**
-		@brief Bestimmt ob sich ein Punkt rechts von einer Linie befindet.
-		@param a der Startpunkt der	Linie
-		@param b der Endpunkt der Linie
-		@param c der Testpunkt
-		@return Gibt true zur\xFCck, wenn sich der Punkt recht von der Linie befindet.<br>
-		Falls sich der Punkt links von der Linie oder auf der Linie befindet wird false zur\xFCckgegeben.<br>
-		@remark Ein Punkt liegt rechts von einer Linie, wenn er vom Startpunkt aus betrachtet rechts neben der Linie liegt.
-	*/
-	static bool IsVertexRight(const BS_Vertex & a, const BS_Vertex & b, const BS_Vertex & c)
-	{
+	 * Determines whether a piont is right of a line
+	 * @param a			The start point of a line
+	 * @param b			The end point of a line
+	 * @param c			The test point
+	 * @return			Returns true if the point is to the right of the line.
+	 * If the point is to the right of the line or on the line, false is returned.
+	 */
+	static bool IsVertexRight(const BS_Vertex &a, const BS_Vertex &b, const BS_Vertex &c) {
 		return _TriangleArea2(a, b, c) < 0;
 	}
 
-	static bool IsVertexRightOn(const BS_Vertex & a, const BS_Vertex & b, const BS_Vertex & c)
-	{
+	static bool IsVertexRightOn(const BS_Vertex &a, const BS_Vertex &b, const BS_Vertex &c) {
 		return _TriangleArea2(a, b, c) <= 0;
 	}
 
 	/**
-		@brief Bestimmt ob sich ein Punkt auf einer Linie befindet.
-		@param a der Startpunkt der	Linie
-		@param b der Endpunkt der Linie
-		@param c der Testpunkt
-		@return Gibt true zur\xFCck, wenn sich der Punkt auf der Linie befindet.
-	*/
-	static bool IsVertexOn(const BS_Vertex & a, const BS_Vertex & b, const BS_Vertex & c)
-	{
+	 * Determines whether a piont is on a line
+	 * @param a			The start point of a line
+	 * @param b			The end point of a line
+	 * @param c			The test point
+	 * @return			Returns true if the point is on the line, false otherwise.
+	 */
+	static bool IsVertexOn(const BS_Vertex &a, const BS_Vertex &b, const BS_Vertex &c) {
 		return _TriangleArea2(a, b, c) == 0;
 	}
 
-	enum VERTEX_CLASSIFICATION
-	{
+	enum VERTEX_CLASSIFICATION {
 		LEFT,
 		RIGHT,
 		ON
 	};
 
 	/**
-	    @brief Bestimmt wo sich ein Punkt relativ zu einer Linie befindet.
-		@param a der Startpunkt der	Linie
-		@param b der Endpunkt der Linie
-		@param c der Testpunkt
-		@return Gibt LEFT zur\xFCck, wenn sich der Punkt links von der Line befindet.<br>
-				Gibt RIGHT zur\xFCck, wenn sich der Punkt links von der Line befindet.<br>
-				Gibt ON zur\xFCck, wenn sich der Punkt auf der Linie befindet.
-	*/
-	static VERTEX_CLASSIFICATION ClassifyVertexToLine(const BS_Vertex & a, const BS_Vertex & b, const BS_Vertex & c)
-	{
+	 * Determines where a point is relative to a line.
+	 * @param a			The start point of a line
+	 * @param b			The end point of a line
+	 * @param c			The test point
+	 * @return			LEFT is returned if the point is to the left of the line.
+	 * RIGHT is returned if the point is to the right of the line.
+	 * ON is returned if the point is on the line.
+	 */
+	static VERTEX_CLASSIFICATION ClassifyVertexToLine(const BS_Vertex &a, const BS_Vertex &b, const BS_Vertex &c) {
 		int Area = _TriangleArea2(a, b, c);
 		if (Area > 0) return LEFT;
 		if (Area < 0) return RIGHT;
@@ -133,15 +125,14 @@
 	}
 
 	/**
-	    @brief Bestimmt ob sich zwei Linien schneiden.
-		@param a der Startpunkt der ersten Linie
-		@param b der Endpunkt der ersten Linie
-		@param c der Startpunkt der zweiten Linie
-		@param d der Endpunkt der zweiten Linie
-		@remark In den F\xE4llen in denen eine Linie die andere nur ber\xFChrt, wird false zur\xFCckgegeben (improper intersection).
-	*/
-	static bool DoesIntersectProperly(const BS_Vertex & a, const BS_Vertex & b, const BS_Vertex & c, const BS_Vertex & d)
-	{
+	 * Determines whether two lines intersect
+	 * @param a			The start point of the first line
+	 * @param b			The end point of the first line
+	 * @param c			The start point of the second line
+	 * @param d			The end point of the second line
+	 * @remark			In cases where a line only touches the other, false is returned (improper intersection)
+	 */
+	static bool DoesIntersectProperly(const BS_Vertex &a, const BS_Vertex &b, const BS_Vertex &c, const BS_Vertex &d) {
 		VERTEX_CLASSIFICATION Class1 = ClassifyVertexToLine(a, b, c);
 		VERTEX_CLASSIFICATION Class2 = ClassifyVertexToLine(a, b, d);
 		VERTEX_CLASSIFICATION Class3 = ClassifyVertexToLine(c, d, a);
@@ -153,26 +144,22 @@
 	}
 
 	/**
-	    @brief Bestimmt ob sich ein Punkt auf einem Liniensegment befindet
-		@param a der Startpunkt der	Liniensegmentes
-		@param b der Endpunkt der Liniensegmentes
-		@param c der Testpunkt
-	*/
-	static bool IsOnLine(const BS_Vertex & a, const BS_Vertex & b, const BS_Vertex & c)
-	{
-		// Die Punkte m\xFCssen alle Kollinear sein, sonst liegt der Testpunkt nicht auf dem Liniensegment
+	 * Determines whether a point is on a line segment
+	 * @param a			The start point of a line
+	 * @param b			The end point of a line
+	 * @param c			The test point
+	 */
+	static bool IsOnLine(const BS_Vertex &a, const BS_Vertex &b, const BS_Vertex &c) {
+		// The items must all be Collinear, otherwise don't bothering testing the point
 		if (_TriangleArea2(a, b, c) != 0) return false;
 
-		// Falls das Liniensegment nicht vertikal ist pr\xFCfe auf der X-Achse, ansonsten auf der Y-Achse
-		if (a.X != b.X)
-		{
+		// If the line segment is not vertical, check on the x-axis, otherwise the y-axis
+		if (a.X != b.X) {
 			return ((a.X <= c.X) &&
 					(c.X <= b.X)) ||
 				   ((a.X >= c.X) &&
 					(c.X >= b.X));
-		}
-		else
-		{
+		} else {
 			return ((a.Y <= c.Y) &&
 					(c.Y <= b.Y)) ||
 				   ((a.Y >= c.Y) &&
@@ -180,21 +167,17 @@
 		}
 	}
 
-	static bool IsOnLineStrict(const BS_Vertex & a, const BS_Vertex & b, const BS_Vertex & c)
-	{
-		// Die Punkte m\xFCssen alle Kollinear sein, sonst liegt der Testpunkt nicht auf dem Liniensegment
+	static bool IsOnLineStrict(const BS_Vertex &a, const BS_Vertex &b, const BS_Vertex &c) {
+		// The items must all be Collinear, otherwise don't bothering testing the point
 		if (_TriangleArea2(a, b, c) != 0) return false;
 
-		// Falls das Liniensegment nicht vertikal ist pr\xFCfe auf der X-Achse, ansonsten auf der Y-Achse
-		if (a.X != b.X)
-		{
+		// If the line segment is not vertical, check on the x-axis, otherwise the y-axis
+		if (a.X != b.X) {
 			return ((a.X < c.X) &&
 				(c.X < b.X)) ||
 				((a.X > c.X) &&
 				(c.X > b.X));
-		}
-		else
-		{
+		} else {
 			return ((a.Y < c.Y) &&
 				(c.Y < b.Y)) ||
 				((a.Y > c.Y) &&
@@ -203,19 +186,19 @@
 	}
 
 private:
-
 	/**
-	    @brief Gibt die doppelte Gr\xF6\xDFe des durch a, b und c definierten Dreiecks zur\xFCck.
-
-		Das Ergebnis ist positiv wenn die Punkte entgegen dem Uhrzeigersinn angeordnet sind und negativ wenn sie mit dem
-		Uhrzeigersinn angeordnet sind.
-	*/
-	static int _TriangleArea2(const BS_Vertex & a, const BS_Vertex & b, const BS_Vertex & c)
-	{
+	 * Return double the size of the triangle defined by the three passed points.
+	 *
+	 * The result is positive if the points are arrange counterclockwise, 
+	 * and negative if they are arranged counter-clockwise.
+	 */
+	static int _TriangleArea2(const BS_Vertex &a, const BS_Vertex &b, const BS_Vertex &c) {
 		return a.X * b.Y - a.Y * b.X +
 			   a.Y * c.X - a.X * c.Y +
 			   b.X * c.Y - c.X * b.Y;
 	}
 };
 
+} // End of namespace Sword25
+
 #endif

Modified: scummvm/trunk/engines/sword25/math/polygon.cpp
===================================================================
--- scummvm/trunk/engines/sword25/math/polygon.cpp	2010-10-12 22:17:00 UTC (rev 53196)
+++ scummvm/trunk/engines/sword25/math/polygon.cpp	2010-10-12 22:17:11 UTC (rev 53197)
@@ -32,11 +32,6 @@
  *
  */
 
-#include "sword25/kernel/memlog_off.h"
-#include <utility>
-#include <vector>
-#include "sword25/kernel/memlog_on.h"
-
 #include <math.h>
 
 #include "sword25/kernel/outputpersistenceblock.h"
@@ -45,58 +40,52 @@
 #include "sword25/math/polygon.h"
 #include "sword25/math/line.h"
 
+namespace Sword25 {
+
 #define max(a,b) (((a) > (b)) ? (a) : (b))
 
-// Konstruktion / Destruktion
+// Constructor / Destructor
 // --------------------------
 
-BS_Polygon::BS_Polygon() : VertexCount(0), Vertecies(NULL)
-{
+BS_Polygon::BS_Polygon() : VertexCount(0), Vertecies(NULL) {
 }
 
-BS_Polygon::BS_Polygon(int VertexCount, const BS_Vertex* Vertecies) : VertexCount(0), Vertecies(NULL)
-{ 
+BS_Polygon::BS_Polygon(int VertexCount, const BS_Vertex *Vertecies) : VertexCount(0), Vertecies(NULL) { 
 	Init(VertexCount, Vertecies);
 }
 
-BS_Polygon::BS_Polygon(const BS_Polygon& Other) : VertexCount(0), Vertecies(NULL)
-{
+BS_Polygon::BS_Polygon(const BS_Polygon &Other) : VertexCount(0), Vertecies(NULL) {
 	Init(Other.VertexCount, Other.Vertecies);
 }
 
-BS_Polygon::BS_Polygon(BS_InputPersistenceBlock & Reader) : VertexCount(0), Vertecies(NULL)
-{
+BS_Polygon::BS_Polygon(BS_InputPersistenceBlock &Reader) : VertexCount(0), Vertecies(NULL) {
 	Unpersist(Reader);
 }
 
-BS_Polygon::~BS_Polygon()
-{
+BS_Polygon::~BS_Polygon() {
 	delete[] Vertecies;
 }
 
-// Initialisierung
+// Initialisation
 // ---------------
 
-bool BS_Polygon::Init(int VertexCount, const BS_Vertex* Vertecies)
-{
-	// Alten Objektzustand merken um ihn wieder herstellen zu k\xF6nnen, falls beim Initialisieren mit den neuen Daten ein Fehler auftreten
-	// sollte.
+bool BS_Polygon::Init(int VertexCount, const BS_Vertex *Vertecies) {
+	// Rember the old obstate to restore it if an error occurs whilst initialising it with the new data
 	int OldVertexCount = this->VertexCount;
-	BS_Vertex* OldVertecies = this->Vertecies;
+	BS_Vertex *OldVertecies = this->Vertecies;
 
 	this->VertexCount = VertexCount;
 	this->Vertecies = new BS_Vertex[VertexCount + 1];
 	memcpy(this->Vertecies, Vertecies, sizeof(BS_Vertex) * VertexCount);
 	// TODO:
-	// Doppelte und \xFCberfl\xFCssige Vertecies entfernen (\xFCberfl\xFCssig = 3 Verts kollinear)
+	// Duplicate and remove redundant vertecies (Superflous = 3 co-linear verts)
 	// _WeedRepeatedVertecies();
-	// Das erste Vertex wird am Ende des Vertex-Arrays wiederholt, dieses vereinfacht einige Algorithmen, die alle Edges durchgehen und
-	// sich so die \xDCberlaufkontrolle sparen k\xF6nnen.
+	// The first vertex is repeated at the end of the vertex array; this simplifies
+	// some algorithms, running through the edges and thus can save the overflow control.
 	this->Vertecies[VertexCount] = this->Vertecies[0];
 
-	// Falls das Polygon selbst\xFCberschneidend ist, wird der alte Objektzustand wieder hergestellt und ein Fehler signalisiert.
-	if (CheckForSelfIntersection())
-	{
+	// If the polygon is self-intersecting, the object state is restore, and an error signalled
+	if (CheckForSelfIntersection()) {
 		delete[] this->Vertecies;
 		this->Vertecies = OldVertecies;
 		this->VertexCount = OldVertexCount;
@@ -105,10 +94,10 @@
 		return false;
 	}
 
-	// Alte Vertexliste freigeben
+	// Release old vertex list
 	delete[] OldVertecies;
 
-	// Eigenschaften des Polygons berechnen.
+	// Calculate properties of the polygon
 	m_IsCW = ComputeIsCW();
 	m_IsConvex = ComputeIsConvex();
 	m_Centroid = ComputeCentroid();
@@ -116,52 +105,44 @@
 	return true;
 }
 
-// \xDCberpr\xFCfung der Reihenfolge der Vertecies
-// -----------------------------------------
+// Review the order of the Vertecies
+// ---------------------------------
 
-bool BS_Polygon::IsCW() const
-{
+bool BS_Polygon::IsCW() const {
 	return m_IsCW;
 }
 
-bool BS_Polygon::IsCCW() const
-{
+bool BS_Polygon::IsCCW() const {
 	return !IsCW();
 }
 
-bool BS_Polygon::ComputeIsCW() const
-{
-	if (VertexCount)
-	{
-		// Vertex finden, dass am weitesten rechts unten liegt.
+bool BS_Polygon::ComputeIsCW() const {
+	if (VertexCount) {
+		// Find the vertex on extreme bottom right
 		int V2Index = FindLRVertexIndex();
 
-		// Vertex vorher und nachher finden.
+		// Find the vertex before and after it
 		int V1Index = (V2Index + (VertexCount - 1)) % VertexCount;
 		int V3Index = (V2Index + 1) % VertexCount;
 
-		// Kreuzprodukt bilden.
-		// Wenn das Kreuzprodukt des am weitesten unten links liegenden Vertex positiv ist, sind die Vertecies im Uhrzeigersinn angeordnet
-		// ansonsten entgegen des Uhrzeigersinns.
+		// Cross product form
+		// If the cross product of the vertex lying fartherest bottom left is positive,
+		// the vertecies arrranged in a clockwise order. Otherwise counter-clockwise
 		if (CrossProduct(Vertecies[V1Index], Vertecies[V2Index], Vertecies[V3Index]) >= 0) return true;
 	}
 
 	return false;
 }
 
-int BS_Polygon::FindLRVertexIndex() const
-{
-	if (VertexCount)
-	{
+int BS_Polygon::FindLRVertexIndex() const {
+	if (VertexCount) {
 		int CurIndex = 0;
 		int MaxX = Vertecies[0].X;
 		int MaxY = Vertecies[0].Y;
 
-		for (int i = 1; i < VertexCount; i++)
-		{
+		for (int i = 1; i < VertexCount; i++) {
 			if (Vertecies[i].Y > MaxY ||
-			   (Vertecies[i].Y == MaxY && Vertecies[i].X > MaxX))
-			{
+			   (Vertecies[i].Y == MaxY && Vertecies[i].X > MaxX)) {
 				MaxX = Vertecies[i].X;
 				MaxY = Vertecies[i].Y;
 				CurIndex = i;
@@ -174,109 +155,101 @@
 	return -1;
 }
 
-// Testen auf Konvex/Konkav
+// Testing for Convex / Concave
 // ------------------------
 
-bool BS_Polygon::IsConvex() const
-{
+bool BS_Polygon::IsConvex() const {
 	return m_IsConvex;
 }
 
-bool BS_Polygon::IsConcave() const
-{
+bool BS_Polygon::IsConcave() const {
 	return !IsConvex();
 }
 
-bool BS_Polygon::ComputeIsConvex() const
-{
-	// Polygone mit 3 oder weniger Vertecies k\xF6nnen nur Konvex sein.
+bool BS_Polygon::ComputeIsConvex() const {
+	// Polygons with three or less Vertecies can only be convex
 	if (VertexCount <= 3) return true;
 
-	// Alle Winkel im Polygon berechnen, wenn das Polygon Konvex ist, m\xFCssen alle Winkel das selbe Vorzeichen haben.
+	// All angles in the polygon computed will have the same direction sign if the polygon is convex
 	int Flag = 0;
-	for (int i = 0; i < VertexCount; i++)
-	{
-		// Die Indizies der beiden n\xE4chsten Vertecies nach i bestimmen.
+	for (int i = 0; i < VertexCount; i++) {
+		// Determine the next two vertecies to check
 		int j = (i + 1) % VertexCount;
 		int k = (i + 2) % VertexCount;
 
-		// Kreuzprodukt der drei Vertecies berechnen.
+		// Calculate the cross product of the three vertecies
 		int Cross = CrossProduct(Vertecies[i], Vertecies[j], Vertecies[k]);
 
-		// Die unteren beiden Bits von Flag haben folgende Bedeutung:
-		// 0 : negativer Winkel ist aufgetreten
-		// 1 : positiver Winkel ist aufgetreten
+		// The lower two bits of the flag represent the following:
+		// 0: negative angle occurred
+		// 1: positive angle occurred
 
-		// Vorzeichen des aktuellen Winkels in Flag vermerken.
+		// The sign of the current angle is recorded in Flag
 		if (Cross < 0)
 			Flag |= 1;
 		else if (Cross > 0)
 			Flag |= 2;
 
-		// Falls Flag 3 ist, sind sowohl positive als auch negative Winkel vorhanden -> Polygon ist Konkav.
+		// If flag is 3, there are both positive and negative angles; so the polygon is concave
 		if (Flag == 3) return false;
 	}
 
-	// Polygon ist Konvex.
+	// Polygon is convex
 	return true;
 }
 
-// Sicherstellen einer bestimmen Vertexordnung
-// -------------------------------------------
+// Make a determine vertex order
+// -----------------------------
 
-void BS_Polygon::EnsureCWOrder()
-{
+void BS_Polygon::EnsureCWOrder() {
 	if (!IsCW())
 		ReverseVertexOrder();
 }
 
-void BS_Polygon::EnsureCCWOrder()
-{
+void BS_Polygon::EnsureCCWOrder() {
 	if (!IsCCW())
 		ReverseVertexOrder();
 }
 
-// Umkehren der Reihenfolge der Vertecies
-// --------------------------------------
+// Reverse the order of vertecies
+// ------------------------------
 
-void BS_Polygon::ReverseVertexOrder()
-{
-	// Vertecies paarweise vertauschen, bis die Liste komplett umgekehrt wurde.
-	for (int i = 0; i < VertexCount / 2; i++)
-		std::swap(Vertecies[i], Vertecies[VertexCount - i - 1]);
+void BS_Polygon::ReverseVertexOrder() {
+	// Vertecies are exchanged in pairs, until the list has been completely reversed
+	for (int i = 0; i < VertexCount / 2; i++) {
+		BS_Vertex tempVertex = Vertecies[i];
+		Vertecies[i] = Vertecies[VertexCount - i - 1];
+		Vertecies[VertexCount - i - 1] = tempVertex;
+	}
 
 	// Vertexordnung neu berechnen.
 	m_IsCW = ComputeIsCW();
 }
 
-// Kreuzprodukt
-// ------------
+// Cross Product
+// -------------
 
-int BS_Polygon::CrossProduct(const BS_Vertex& V1, const BS_Vertex& V2, const BS_Vertex& V3) const
-{
+int BS_Polygon::CrossProduct(const BS_Vertex &V1, const BS_Vertex &V2, const BS_Vertex &V3) const {
 	return (V2.X - V1.X) * (V3.Y - V2.Y) -
 		   (V2.Y - V1.Y) * (V3.X - V2.X);
 }
 
-// Skalarproduct
-// -------------
+// Scalar Product
+// --------------
 
-int BS_Polygon::DotProduct(const BS_Vertex& V1, const BS_Vertex& V2, const BS_Vertex& V3) const
-{
+int BS_Polygon::DotProduct(const BS_Vertex &V1, const BS_Vertex &V2, const BS_Vertex &V3) const {
 	return (V1.X - V2.X) * (V3.X - V2.X) +
 		   (V1.Y - V2.Y) * (V3.X - V2.Y);
 }
 
-// \xDCberpr\xFCfen auf Selbst\xFCberschneidung
-// -----------------------------------
+// Check for self-intersections
+// ----------------------------
 
-bool BS_Polygon::CheckForSelfIntersection() const
-{
-	// TODO: Fertigstellen
+bool BS_Polygon::CheckForSelfIntersection() const {
+	// TODO: Finish this
 	/*
 	float AngleSum = 0.0f;
-	for (int i = 0; i < VertexCount; i++)
-	{
+	for (int i = 0; i < VertexCount; i++) {
 		int j = (i + 1) % VertexCount;
 		int k = (i + 2) % VertexCount;
 
@@ -289,8 +262,7 @@
 							 (Vertecies[k].Y - Vertecies[j].Y) * (Vertecies[k].Y - Vertecies[j].Y));
 		float Norm = Length1 * Length2;
 
-		if (Norm > 0.0f)
-		{
+		if (Norm > 0.0f) {
 			Dot /= Norm;
 			AngleSum += acos(Dot);
 		}
@@ -300,46 +272,43 @@
 	return false;
 }
 
-// Verschieben
-// -----------
+// Move
+// ----
 
-void BS_Polygon::operator+=(const BS_Vertex& Delta)
-{
-	// Alle Vetecies verschieben
+void BS_Polygon::operator+=(const BS_Vertex &Delta) {
+	// Move all vertecies
 	for (int i = 0; i < VertexCount; i++)
 		Vertecies[i] += Delta;
 
-	// Den Schwerpunkt verschieben.
+	// Shift the focus
 	m_Centroid += Delta;
 }
 
-// Sichtlinie
-// ----------
+// Line of Sight
+// -------------
 
-bool BS_Polygon::IsLineInterior(const BS_Vertex & a, const BS_Vertex & b) const
-{
-	// Beide Punkte m\xFCssen im Polygon sein
+bool BS_Polygon::IsLineInterior(const BS_Vertex &a, const BS_Vertex &b) const {
+	// Both points have to be in the polygon
 	if (!IsPointInPolygon(a, true) || !IsPointInPolygon(b, true)) return false;
 
-	// Falls die Punkte identisch sind, ist die Linie trivialerweise innerhalb des Polygons
+	// If the points are identical, the line is trivially within the polygon
 	if (a == b) return true;
 
-	// Testen, ob die Linie ein Liniensegment strikt schneidet (proper intersection)
-	for (int i = 0; i < VertexCount; i++)
-	{
+	// Test whether the line intersects a line segment strictly (proper intersection)
+	for (int i = 0; i < VertexCount; i++) {
 		int j = (i + 1) % VertexCount;
-		const BS_Vertex & VS = Vertecies[i];
-		const BS_Vertex & VE = Vertecies[j];
+		const BS_Vertex &VS = Vertecies[i];
+		const BS_Vertex &VE = Vertecies[j];
 	
-		// Falls die Linie ein Liniensegment strikt schneidet (proper intersection) ist die Linie nicht innerhalb des Polygons
+		// If the line intersects a line segment strictly (proper cross section) the line is not in the polygon
 		if (BS_Line::DoesIntersectProperly(a, b, VS, VE)) return false;
 
-		// Falls einer der beiden Linienpunkte auf der Kante liegt und der andere rechts der Kante liegt, befindet sich die Linie nicht
-		// vollst\xE4ndig innerhalb des Polygons.
+		// If one of the two line items is on the edge and the other is to the right of the edge,
+		// then the line is not completely within the polygon
 		if (BS_Line::IsOnLineStrict(VS, VE, a) && BS_Line::IsVertexRight(VS, VE, b)) return false;
 		if (BS_Line::IsOnLineStrict(VS, VE, b) && BS_Line::IsVertexRight(VS, VE, a)) return false;
 
-		// Falls einer der beiden Linienpunkte auf einem Vertex liegt muss die Linie in das Polygon hinein verlaufen
+		// If one of the two line items is on a vertex, the line traces into the polygon
 		if ((a == VS) && !IsLineInCone(i, b, true)) return false;
 		if ((b == VS) && !IsLineInCone(i, a, true)) return false;
 	}
@@ -347,37 +316,34 @@
 	return true;
 }
 
-bool BS_Polygon::IsLineExterior(const BS_Vertex & a, const BS_Vertex & b) const
-{
-	// Keiner der beiden Punkte darf strikt im Polygon sein (auf der Kante ist erlaubt)
+bool BS_Polygon::IsLineExterior(const BS_Vertex &a, const BS_Vertex &b) const {
+	// Neither of the two points must be strictly in the polygon (on the edge is allowed)
 	if (IsPointInPolygon(a, false) || IsPointInPolygon(b, false)) return false;
 
-	// Falls die Punkte identisch sind, ist die Linie trivialerweise ausserhalb des Polygons
+	// If the points are identical, the line is trivially outside of the polygon
 	if (a == b) return true;
 
-	// Testen, ob die Linie ein Liniensegment strikt schneidet (proper intersection)
-	for (int i = 0; i < VertexCount; i++)
-	{
+	// Test whether the line intersects a line segment strictly (proper intersection)
+	for (int i = 0; i < VertexCount; i++) {
 		int j = (i + 1) % VertexCount;
-		const BS_Vertex & VS = Vertecies[i];
-		const BS_Vertex & VE = Vertecies[j];
+		const BS_Vertex &VS = Vertecies[i];
+		const BS_Vertex &VE = Vertecies[j];
 
-		// Falls die Linie ein Liniensegment strikt schneidet (proper intersection) ist die Linie teilweise innerhalb des Polygons
+		// If the line intersects a line segment strictly (proper intersection), then
+		// the line is partially inside the polygon
 		if (BS_Line::DoesIntersectProperly(a, b, VS, VE)) return false;
 
-		// Falls einer der beiden Linienpunkte auf der Kante liegt und der andere rechts der Kante liegt, befindet sich die Linie nicht vollst\xE4ndig
-		// ausserhalb des Polygons.
+		// If one of the two line items is on the edge and the other is to the right of the edge,
+		// the line is not completely outside the polygon
 		if (BS_Line::IsOnLineStrict(VS, VE, a) && BS_Line::IsVertexLeft(VS, VE, b)) return false;
 		if (BS_Line::IsOnLineStrict(VS, VE, b) && BS_Line::IsVertexLeft(VS, VE, a)) return false;
 
-		// Falls einer der beiden Linienpunkte auf einem Vertex liegt, darf die Linie nicht in das Polygon hinein verlaufen
+		// If one of the lwo line items is on a vertex, the line must not run into the polygon
 		if ((a == VS) && IsLineInCone(i, b, false)) return false;
 		if ((b == VS) && IsLineInCone(i, a, false)) return false;
 
-		// Falls das Vertex mit Start- und Zielpunkt kollinear ist, d\xFCrfen die beiden Liniensegmente (a, VS) und (b, VS) nicht in das Polygon hinein
-		// verlaufen
-		if (BS_Line::IsOnLine(a, b, VS))
-		{
+		// If the vertex with start and end point is collinear, (a VS) and (b, VS) is not in the polygon
+		if (BS_Line::IsOnLine(a, b, VS)) {
 			if (IsLineInCone(i, a, false)) return false;
 			if (IsLineInCone(i, b, false)) return false;
 		}
@@ -386,23 +352,19 @@
 	return true;
 }
 
-bool BS_Polygon::IsLineInCone(int StartVertexIndex, const BS_Vertex & EndVertex, bool IncludeEdges) const
-{
-	const BS_Vertex & StartVertex = Vertecies[StartVertexIndex];
-	const BS_Vertex & NextVertex = Vertecies[(StartVertexIndex + 1) % VertexCount];
-	const BS_Vertex & PrevVertex = Vertecies[(StartVertexIndex + VertexCount - 1) % VertexCount];
+bool BS_Polygon::IsLineInCone(int StartVertexIndex, const BS_Vertex &EndVertex, bool IncludeEdges) const {
+	const BS_Vertex &StartVertex = Vertecies[StartVertexIndex];
+	const BS_Vertex &NextVertex = Vertecies[(StartVertexIndex + 1) % VertexCount];
+	const BS_Vertex &PrevVertex = Vertecies[(StartVertexIndex + VertexCount - 1) % VertexCount];
 
-	if (BS_Line::IsVertexLeftOn(PrevVertex, StartVertex, NextVertex))
-	{
+	if (BS_Line::IsVertexLeftOn(PrevVertex, StartVertex, NextVertex)) {
 		if (IncludeEdges)
 			return BS_Line::IsVertexLeftOn(EndVertex, StartVertex, NextVertex) &&
 			BS_Line::IsVertexLeftOn(StartVertex, EndVertex, PrevVertex);
 		else
 			return BS_Line::IsVertexLeft(EndVertex, StartVertex, NextVertex) &&
 			BS_Line::IsVertexLeft(StartVertex, EndVertex, PrevVertex);
-	}
-	else
-	{
+	} else {
 		if (IncludeEdges)
 			return !(BS_Line::IsVertexLeft(EndVertex, StartVertex, PrevVertex) &&
 			BS_Line::IsVertexLeft(StartVertex, EndVertex, NextVertex));
@@ -412,56 +374,49 @@
 	}
 }
 
-// Punkt-Polygon Tests
+// Point-Polygon Tests
 // -------------------
 
-bool BS_Polygon::IsPointInPolygon(int X, int Y, bool BorderBelongsToPolygon) const
-{
+bool BS_Polygon::IsPointInPolygon(int X, int Y, bool BorderBelongsToPolygon) const {
 	return IsPointInPolygon(BS_Vertex(X, Y), BorderBelongsToPolygon);
 }
 
-bool BS_Polygon::IsPointInPolygon(const BS_Vertex & Point, bool EdgesBelongToPolygon) const
-{
-	int Rcross = 0; // Anzahl der rechtsseitigen \xDCberschneidungen
-	int Lcross = 0; // Anzahl der linksseitigen \xDCberschneidungen
+bool BS_Polygon::IsPointInPolygon(const BS_Vertex &Point, bool EdgesBelongToPolygon) const {
+	int Rcross = 0; // Number of right-side overlaps
+	int Lcross = 0; // Number of left-side overlaps
 
-	// Jede Kante wird \xFCberpr\xFCft ob sie den vom Punkt ausgehenden Strahl schneidet
-	for (int i = 0; i < VertexCount; i++)
-	{
-		const BS_Vertex & EdgeStart = Vertecies[i];
-		const BS_Vertex & EdgeEnd = Vertecies[(i + 1) % VertexCount];
+	// Each edge is checked whether it cuts the outgoing stream from the point
+	for (int i = 0; i < VertexCount; i++) {
+		const BS_Vertex &EdgeStart = Vertecies[i];
+		const BS_Vertex &EdgeEnd = Vertecies[(i + 1) % VertexCount];
 
-		// Ist der Punkt ein Vertex? Dann liegt er auf einer Kante des Polygons
+		// A vertex is a point? Then it lies on one edge of the polygon
 		if (Point == EdgeStart) return EdgesBelongToPolygon;
 
-		if ((EdgeStart.Y > Point.Y) != (EdgeEnd.Y > Point.Y))
-		{
+		if ((EdgeStart.Y > Point.Y) != (EdgeEnd.Y > Point.Y)) {
 			int Term1 = (EdgeStart.X - Point.X) * (EdgeEnd.Y - Point.Y) - (EdgeEnd.X - Point.X) * (EdgeStart.Y - Point.Y);
 			int Term2 = (EdgeEnd.Y - Point.Y) - (EdgeStart.Y - EdgeEnd.Y);
 			if ((Term1 > 0) == (Term2 >= 0)) Rcross++;
 		}
 
-		if ((EdgeStart.Y < Point.Y) != (EdgeEnd.Y < Point.Y))
-		{ 
+		if ((EdgeStart.Y < Point.Y) != (EdgeEnd.Y < Point.Y)) { 
 			int Term1 = (EdgeStart.X - Point.X) * (EdgeEnd.Y - Point.Y) - (EdgeEnd.X - Point.X) * (EdgeStart.Y - Point.Y);
 			int Term2 = (EdgeEnd.Y - Point.Y) - (EdgeStart.Y - EdgeEnd.Y);
 			if ((Term1 < 0) == (Term2 <= 0)) Lcross++;
 		}
 	}	
 
-	// Der Punkt befindet sich auf einer Kante, wenn die Anzahl der linken und rechten \xDCberschneidungen nicht die gleiche Geradzahligkeit haben
+	// The point is on an adge, if the number of left and right intersections have the same even numbers
 	if ((Rcross % 2 ) != (Lcross % 2 )) return EdgesBelongToPolygon;
 
-	// Der Punkt befindet sich genau dann strikt innerhalb des Polygons, wenn die Anzahl der \xDCberschneidungen ungerade ist
+	// The point is strictly inside the polygon if and only if the number of overlaps is odd
 	if ((Rcross % 2) == 1) return true;
 	else return false;
 }
 
-bool BS_Polygon::Persist(BS_OutputPersistenceBlock & Writer)
-{
+bool BS_Polygon::Persist(BS_OutputPersistenceBlock &Writer) {
 	Writer.Write(VertexCount);
-	for (int i = 0; i < VertexCount; ++i)
-	{
+	for (int i = 0; i < VertexCount; ++i) {
 		Writer.Write(Vertecies[i].X);
 		Writer.Write(Vertecies[i].Y);
 	}
@@ -469,16 +424,16 @@
 	return true;
 }
 
-bool BS_Polygon::Unpersist(BS_InputPersistenceBlock & Reader)
-{
+bool BS_Polygon::Unpersist(BS_InputPersistenceBlock &Reader) {
 	int StoredVertexCount;
 	Reader.Read(StoredVertexCount);
 
-	std::vector<BS_Vertex> StoredVertecies(StoredVertexCount);
-	for (int i = 0; i < StoredVertexCount; ++i)
-	{
-		Reader.Read(StoredVertecies[i].X);
-		Reader.Read(StoredVertecies[i].Y);
+	Common::Array<BS_Vertex> StoredVertecies;
+	for (int i = 0; i < StoredVertexCount; ++i) {
+		int x, y;
+		Reader.Read(x);
+		Reader.Read(y);
+		StoredVertecies.push_back(BS_Vertex(x, y));
 	}
 
 	Init(StoredVertexCount, &StoredVertecies[0]);
@@ -486,30 +441,26 @@
 	return Reader.IsGood();
 }
 
-// Schwerpunkt
-// -----------
+// Main Focus
+// ----------
 
-BS_Vertex BS_Polygon::GetCentroid() const
-{
+BS_Vertex BS_Polygon::GetCentroid() const {
 	return m_Centroid;
 }
 
-BS_Vertex BS_Polygon::ComputeCentroid() const
-{
-	// Fl\xE4cheninhalt des Polygons berechnen.
+BS_Vertex BS_Polygon::ComputeCentroid() const {
+	// Area of the polygon is calculated
 	int DoubleArea = 0;
-	for (int i = 0; i < VertexCount; ++i)
-	{
+	for (int i = 0; i < VertexCount; ++i) {
 		DoubleArea += Vertecies[i].X * Vertecies[i + 1].Y - Vertecies[i + 1].X * Vertecies[i].Y;
 	}
 
-	// Division durch 0 beim n\xE4chsten Schritt vermeiden.
+	// Avoid division by zero in the next step
 	if (DoubleArea == 0) return BS_Vertex();
 
-	// Schwerpunkt berechnen.
+	// Calculate centroid
 	BS_Vertex Centroid;
-	for (int i = 0; i < VertexCount; ++i)
-	{
+	for (int i = 0; i < VertexCount; ++i) {
 		int Area = Vertecies[i].X * Vertecies[i + 1].Y - Vertecies[i + 1].X * Vertecies[i].Y;
 		Centroid.X += (Vertecies[i].X + Vertecies[i + 1].X) * Area;
 		Centroid.Y += (Vertecies[i].Y + Vertecies[i + 1].Y) * Area;
@@ -519,3 +470,5 @@
 
 	return Centroid;
 }
+
+} // End of namespace Sword25

Modified: scummvm/trunk/engines/sword25/math/polygon.h
===================================================================
--- scummvm/trunk/engines/sword25/math/polygon.h	2010-10-12 22:17:00 UTC (rev 53196)
+++ scummvm/trunk/engines/sword25/math/polygon.h	2010-10-12 22:17:11 UTC (rev 53197)
@@ -40,6 +40,8 @@
 #include "sword25/kernel/persistable.h"
 #include "sword25/math/vertex.h"
 
+namespace Sword25 {
+
 // -----------------------------------------------------------------------------
 // Forward Declarations
 // -----------------------------------------------------------------------------
@@ -49,158 +51,151 @@
 /**
 	@brief Eine Polygonklasse.
 */
-class BS_Polygon : public BS_Persistable
-{
+class BS_Polygon : public BS_Persistable {
 public:
 	/**
-		@brief Erzeugt ein Objekt vom Typ #BS_Polygon, das 0 Vertecies enth\xE4lt.
-
-		Mit der Methode Init() k\xF6nnen dem Polygon sp\xE4ter Vertecies hinzugef\xFCgt werden.
-	*/
+	 * Creates an object of type #BS_Polygon, containing 0 Vertecies.
+	 *
+	 * With the method Init(), Vertices can be added in later
+	 */
 	BS_Polygon();
 
 	/**
-		@brief Copy-Constructor
-	*/
-	BS_Polygon(const BS_Polygon& Other);
+	 * Copy constructor
+	 */
+	BS_Polygon(const BS_Polygon &Other);
 
 	/**
-		@brief Erstellt ein Polygon anhand persistierter Daten.
-	*/
-	BS_Polygon(BS_InputPersistenceBlock & Reader);
+	 * Creates a polygon using persisted data
+	 */
+	BS_Polygon(BS_InputPersistenceBlock &Reader);
 
 	/**
-		@brief Erzeugt ein Objekt vom Typ #BS_Polygon und ordnet ihm Vertecies zu.
-		@param VertexCount die Anzahl der Vertecies im Vertex Array.
-		@param Vertecies ein Array, das Objekte vom Typ BS_Vertex enth\xE4lt, die die Vertecies des Polygons darstellen.
-		@remark Die Vertecies m\xFCssen ein nicht selbst\xFCberschneidendes Polygon definieren.
-				Falls das Polygon selbst\xFCberschneidend sein sollte wird ein leeres BS_Polygon Objekt erzeugt.
-	*/
-	BS_Polygon(int VertexCount, const BS_Vertex* Vertecies);
+	 * Creaes an object of type #BS_Polygon, and assigns Vertices to it
+	 * @param VertexCount		The number of vertices being passed
+	 * @param Vertecies			An array of BS_Vertex objects representing the vertices in the polygon.
+	 * @remark					The Vertecies that define a polygon must not have any self-intersections.
+	 * If the polygon does have self-intersections, then an empty polygon object is created.
+	 */
+	BS_Polygon(int VertexCount, const BS_Vertex *Vertecies);
 
 	/**
-		@brief L\xF6scht das BS_Polygon Objekt.
-	*/
+	 * Deletes the BS_Polygon object
+	 */
 	virtual ~BS_Polygon();
 
 	/**
-		@brief Initialisiert das BS_Polygon mit einer Liste von Vertecies.
+	 * Initialises the BS_Polygon with a list of Vertecies.
+	 *
+	 * The Vertices need to define a polygon must not have self-intersections.
+	 * If a polygon already has verticies, this will re-initialise it with the new list.
+	 *
+	 * @param VertexCount		The number of vertices being passed
+	 * @param Vertecies			An array of BS_Vertex objects representing the vertices in the polygon.
+	 * @return					Returns false if the Vertecies have self-intersections. In this case,
+	 * the object is not initialised.
+	 */
+	bool Init(int VertexCount, const BS_Vertex *Vertecies);
 
-		Die Vertecies m\xFCssen ein nicht selbst\xFCberschneidendes Polygon definieren.
-		Es kann auch einem Polygon, welches bereits Vertecies enth\xE4lt, mit einer neue Vertexliste initialisiert werden, dabei gehen die
-		alten Vertecies verloren.
-
-		@param VertexCount die Anzahl der Vertecies im Vertecies Array.
-		@param Vertecies ein Array, das Objekte vom Typ BS_Vertex enth\xE4lt, die die Vertecies des Polygons darstellen.
-		@return Gibt false zur\xFCck, falls die Vertecies ein selbst\xFCberschneidendes Polygon definiert haben.
-				In diesem Fall wird das Objekt nicht initialisiert.
-	*/
-	bool Init(int VertexCount, const BS_Vertex* Vertecies);
-
-	//@{
-	/** @name Sondierende Methoden */
+	//
+	// ** Exploratory methods **
+	//
 	
 	/**
-		@brief \xDCberpr\xFCft, ob die Vertecies des Polygons im Uhrzeigersinn angeordnet sind.
-		@return Gibt true zur\xFCck, wenn die Vertecies des Polygons im Uhrzeigersinn angeordnet sind oder Koplanar sind.<br>
-				Gibt false zur\xFCck, wenn die Vertecies des Polygons entgegen dem Uhrzeigersinn angeordnet sind.
-		@remark Diese Methode gibt nur ein sinnvolles Ergebnis zur\xFCck, wenn das Polygon mindestens 3 Vertecies hat.
-	*/
+	 * Checks whether the Vertecies of the polygon are arranged in a clockwise direction.
+	 * @return					Returns true if the Vertecies of the polygon are arranged clockwise or co-planar.
+	 * Returns false if the Vertecies of the polygon are arrange counter-clockwise.
+	 * @remark					This method only returns a meaningful result if the polygon has at least three Vertecies.
+	 */
 	bool IsCW() const;
 
 	/**
-		@brief \xDCberpr\xFCft, ob die Vertecies des Polygons entgegen dem Uhrzeigersinn angeordnet sind.
-		@return Gibt true zur\xFCck, wenn die Vertecies des Polygons entgegen dem Uhrzeigersinn angeordnet sind.<br>
-				Gibt false zur\xFCck, wenn die Vertecies des Polygons im Uhrzeigersinn angeordnet sind oder Koplanar sind.
-		@remark Diese Methode gibt nur ein sinnvolles Ergebnis zur\xFCck, wenn das Polygon mindestens 3 Vertecies hat.
-				
-	*/
+	 * Checks whether the Vertices of the polygon are arranged in a counter-clockwise direction.
+	 * @return					Returns true if the Vertecies of the polygon are arranged counter-clockwise.
+	 * Returns false if the Vertecies of the polygon are arranged clockwise or co-planar.
+	 * @remark					This method only returns a meaningful result if the polygon has at least three Vertecies.
+	 */
 	bool IsCCW() const;
 
 	/**
-		@brief \xDCberpr\xFCft, ob das Polygon konvex ist.
-		@return Gibt true zur\xFCck, wenn das Polygon konvex ist.<br>
-				Gibt false zur\xFCck, wenn das Polygon konkav ist.
-		@remark Diese Methode gibt nur ein sinnvolles Ergebnis zur\xFCck, wenn das Polygon mindestens 3 Vertecies hat.
-	*/
+	 * Checks whether the polygon is convex.
+	 * @return					Returns true if the polygon is convex. Returns false if the polygon is concave.
+	 * @remark					This method only returns a meaningful result if the polygon has at least three Vertecies.
+	 */
 	bool IsConvex() const;
 
 	/** 
-		@brief \xDCberpr\xFCft, ob das Polygon konkav ist.
-		@return Gibt true zur\xFCck, wenn das Polygon konkav ist.<br>
-				Gibt false zur\xFCck, wenn das Polygon konvex ist.
-		@remark Diese Methode gibt nur ein sinnvolles Ergebnis zur\xFCck, wenn das Polygon mindestens 3 Vertecies hat.
-	*/
+	 * Checks whether the polygon is concave.
+ 	 * @return					Returns true if the polygon is concave. Returns false if the polygon is convex.
+	 * @remark					This method only returns a meaningful result if the polygon has at least three Vertecies.
+	 */
 	bool IsConcave() const;
 
 	/**
-		@brief \xDCberpr\xFCft, ob sich ein Punkt innerhalb des Polygons befindet.
-		@param Vertex ein Vertex, mit den Koordinaten des zu testenden Punktes.
-		@param BorderBelongsToPolygon gibt an, ob der Rand des Polygons als Teil des Polygons betrachtet werden soll.<br>
-									  Der Standardwert ist true.
-		@return Gibt true zur\xFCck, wenn sich der Punkt innerhalb des Polygons befindet.<br>
-				Gibt false zur\xFCck, wenn sich der Punkt au\xDFerhalb des Polygons befindet.
-	*/
-	bool IsPointInPolygon(const BS_Vertex& Vertex, bool BorderBelongsToPolygon = true) const;
+	 * Checks whether a point is inside the polygon
+	 * @param Vertex			A Vertex with the co-ordinates of the point to be tested.
+	 * @param BorderBelongsToPolygon	Specifies whether the edge of the polygon should be considered
+	 * @return					Returns true if the point is inside the polygon, false if it is outside.
+	 */
+	bool IsPointInPolygon(const BS_Vertex &Vertex, bool BorderBelongsToPolygon = true) const;
 
 	/**
-		@brief \xDCberpr\xFCft, ob sich ein Punkt innerhalb des Polygons befindet.
-		@param X die Position des Punktes auf der X-Achse.
-		@param Y die Position des Punktes auf der Y-Achse.
-		@param BorderBelongsToPolygon gibt an, ob der Rand des Polygons als Teil des Polygons betrachtet werden soll.<br>
-									  Der Standardwert ist true.
-		@return Gibt true zur\xFCck, wenn sich der Punkt innerhalb des Polygons befindet.<br>
-				Gibt false zur\xFCck, wenn sich der Punkt au\xDFerhalb des Polygons befindet.
-	*/
+	 * Checks whether a point is inside the polygon
+	 * @param X					The X position of the point
+	 * @param Y					The Y position of the point
+	 * @param BorderBelongsToPolygon	Specifies whether the edge of the polygon should be considered
+	 * @return					Returns true if the point is inside the polygon, false if it is outside.
+	 */
 	bool IsPointInPolygon(int X, int Y, bool BorderBelongsToPolygon = true) const;
 
 	/**
-		@brief Gibt den Schwerpunkt des Polygons zur\xFCck.
-	*/
+	 * Returns the focus/centroid of the polygon
+	 */
 	BS_Vertex GetCentroid() const;
 
-	// Rand geh\xF6rt zum Polygon
-	// Polygon muss CW sein
-	bool IsLineInterior(const BS_Vertex & a, const BS_Vertex & b) const;
-	// Rand geh\xF6rt nicht zum Polygon
-	// Polygon muss CW sein
-	bool IsLineExterior(const BS_Vertex & a, const BS_Vertex & b) const;
+	// Edge belongs to the polygon
+	// Polygon must be CW
+	bool IsLineInterior(const BS_Vertex &a, const BS_Vertex &b) const;
+	// Edge does not belong to the polygon
+	// Polygon must be CW
+	bool IsLineExterior(const BS_Vertex &a, const BS_Vertex &b) const;
 
-	//@}
+	//
+	// Manipulation methods
+	//
 
-	//@{
-	/** @name Manipulierende Methoden */
-
 	/**
-		@brief Stellt sicher, dass die Vertecies des Polygons im Uhrzeigersinn angeordnet sind.
-	*/
+	 * Ensures that the Vertecies of the polygon are arranged in a clockwise direction
+	 */
 	void EnsureCWOrder();
 
 	/**
-		@brief Stellt sicher, dass die Vertecies des Polygons entgegen dem Uhrzeigersinn angeordnet sind.
-	*/
+	 * Ensures that the Vertecies of the polygon are arranged in a counter-clockwise direction
+	 */
 	void EnsureCCWOrder();
 
 	/**
-		@brief Kehrt die Reihenfolge der Vertecies um.
-	*/
+	 * Reverses the Vertecies order.
+	 */
 	void ReverseVertexOrder();
 
 	/**
-		@brief Verschiebt das Polygon.
-		@param Delta das Vertex um das das Polygon verschoben werden soll.
-	*/
-	void operator+=(const BS_Vertex& Delta);
+	 * Moves the polygon.
+	 * @param Delta				The vertex around the polygon to be moved.
+	 */
+	void operator+=(const BS_Vertex &Delta);
 
-	//@}
+	//
+	//------------------
+	//
 
-	/// Gibt die Anzahl an Vertecies im Vertecies-Array an.
+	/// Specifies the number of Vertecies in the Vertecies array.
 	int VertexCount;
-	/// Enth\xE4lt die Vertecies des Polygons.
-	BS_Vertex* Vertecies;
+	/// COntains the Vertecies of the polygon
+	BS_Vertex *Vertecies;
 
-	virtual bool Persist(BS_OutputPersistenceBlock & Writer);
-	virtual bool Unpersist(BS_InputPersistenceBlock & Reader);
+	virtual bool Persist(BS_OutputPersistenceBlock &Writer);
+	virtual bool Unpersist(BS_InputPersistenceBlock &Reader);
 
 private:
 	bool m_IsCW;
@@ -208,60 +203,64 @@
 	BS_Vertex m_Centroid;
 	
 	/**
-		@brief Berechnet den Schwerpunkt des Polygons.
-	*/
+	 * Computes the centroid of the polygon.
+	 */
 	BS_Vertex ComputeCentroid() const;
 
 	/**
-		@brief Bestimmt wie die Vertecies des Polygon angeordnet sind.
-		@return Gibt true zur\xFCck, wenn die Vertecies im Uhrzeigersinn angeordnet sind, ansonsten false.
-	*/
+	 * Determines how the Vertecies of the polygon are arranged.
+	 * @return					Returns true if the Vertecies are arranged in a clockwise
+	 * direction, otherwise false.
+	 */
 	bool ComputeIsCW() const;
 
 	/**
-		@brief Bestimmt ob das Polygon Konvex oder Konkav ist.
-		@return Gibt true zur\xFCck, wenn das Polygon Konvex ist, ansonsten false.
-	*/
+	 * Determines whether the polygon is convex or concave.
+	 * @return					Returns true if the polygon is convex, otherwise false.
+	 */
 	bool ComputeIsConvex() const;
 
 	/**
-		@brief Berechnet das Kreuzprodukt dreier Vertecies.
-		@param V1 das erste Vertex
-		@param V2 des zweite Vertex
-		@param V3 das dritte Vertex
-		@return Gibt das Kreuzprodukt der drei Vertecies zur\xFCck.
-		@todo Diese Methode sollte an geeigneter Stelle in die BS_Vertex Klasse integriert werden.
-	*/
-	int CrossProduct(const BS_Vertex& V1, const BS_Vertex& V2, const BS_Vertex& V3) const;
+	 * Calculates the cross product of three Vertecies
+	 * @param V1				The first Vertex
+	 * @param V2				The second Vertex
+	 * @param V3				The third Vertex
+	 * @return					Returns the cross-product of the three vertecies
+	 * @todo					This method would be better as a method of the BS_Vertex class
+	 */
+	int CrossProduct(const BS_Vertex &V1, const BS_Vertex &V2, const BS_Vertex &V3) const;
 
 	/**
-		@brief Berechnet des Skalarprodukt der beiden von drei Vertecies aufgespannten Vektoren.
+	 * Computes the scalar product of two vectors spanning three vertecies
+	 *
+	 * The vectors are spanned by V2->V1 and V2->V3
+	 *
+	 * @param V1				The first Vertex
+	 * @param V2				The second Vertex
+	 * @param V3				The third Vertex
+	 * @return					Returns the dot product of the three Vertecies.
+	 * @todo					This method would be better as a method of the BS_Vertex class
+	 */
+	int DotProduct(const BS_Vertex &V1, const BS_Vertex &V2, const BS_Vertex &V3) const;
 
-		Die Vektoren werden von V2 -> V1 und V2 -> V3 aufgespannt.
-		
-		@param V1 das erste Vertex
-		@param V2 des zweite Vertex
-		@param V3 das dritte Vertex
-		@return Gibt das Skalarprodukt der drei Vertecies zur\xFCck.
-		@todo Diese Methode sollte an geeigneter Stelle in die BS_Vertex Klasse integriert werden.
-	*/
-	int DotProduct(const BS_Vertex& V1, const BS_Vertex& V2, const BS_Vertex& V3) const;
-
 	/**
-		@brief \xDCberpr\xFCft ob das Polygon selbst\xFCberschneidend ist.
-		@return Gibt true zur\xFCck, wenn das Polygon selbst\xFCberschneidend ist.<br>
-				Gibt false zur\xFCck, wenn das Polygon nicht selbst\xFCberschneidend ist.
-	*/
+	 * Checks whether the polygon is self-intersecting
+	 * @return					Returns true if the polygon is self-intersecting.
+	 * Returns false if the polygon is not self-intersecting.
+	 */
 	bool CheckForSelfIntersection() const;
 
 	/**
-		@brief Findet das Vertex des Polygons das am weitesten rechts unten liegt und gibt dessen Index im Vertex-Array zur\xFCck.
-		@return Gibt den Index des Vertex zur\xFCck das am weiteesten rechts unten liegt.<br>
-				Gibt -1 zur\xFCck, wenn die Vertexliste leer ist.
-	*/
+	 * Find the vertex of the polygon that is located below the right-most point,
+	 * and returns it's index in the vertex array.
+	 * @return					Returns the index of the vertex at the bottom-right of the polygon.
+	 * Returns -1 if the vertex list is empty.
+	 */
 	int FindLRVertexIndex() const;
 
-	bool IsLineInCone(int StartVertexIndex, const BS_Vertex & EndVertex, bool IncludeEdges) const;
+	bool IsLineInCone(int StartVertexIndex, const BS_Vertex &EndVertex, bool IncludeEdges) const;
 };
 
+} // End of namespace Sword25
+
 #endif

Modified: scummvm/trunk/engines/sword25/math/rect.h
===================================================================
--- scummvm/trunk/engines/sword25/math/rect.h	2010-10-12 22:17:00 UTC (rev 53196)
+++ scummvm/trunk/engines/sword25/math/rect.h	2010-10-12 22:17:11 UTC (rev 53197)
@@ -36,278 +36,57 @@
 #define SWORD25_RECT_H
 
 // Includes
+#include "common/rect.h"
 #include "sword25/kernel/common.h"
 #include "sword25/math/vertex.h"
 
-// Klassendefinition
+namespace Sword25 {
+
+// Class definitions
+
 /**
-	@brief Diese Klasse beschreibt ein Rechteck und einige n\xFCtzliche Operationen auf Rechtecken.
+ * Rect class. Currently this encapsultes the ScummVM Rect class. Eventually all usage of this
+ * class should be replaced with Common::Rect directly.
 */
-class BS_Rect
-{
+class BS_Rect: public Common::Rect {
 public:
-	/// Das linke Extrem des Rechteckes.
-	int	left;
-	/// Das obere Extrem des Rechteckes.
-	int top;
-	/// Das rechte Extrem des Rechteckes + 1.
-	int right;
-	/// Das untere Extrem des Rechteckes + 1.
-	int bottom;
+	BS_Rect() : Common::Rect() {}
+	BS_Rect(int16 w, int16 h) : Common::Rect(w, h) {}
+	BS_Rect(int16 x1, int16 y1, int16 x2, int16 y2) : Common::Rect(x1, y1, x2, y2) {}
 
-	/**
-		@brief Konstruktor, der alle Werte des Rechteckes mit 0 initialisiert.
-	*/
-	BS_Rect()
-	{
-		left = 0;
-		top = 0;
-		right = 0;
-		bottom = 0;
+	void Move(int DeltaX, int DeltaY) { translate(DeltaX, DeltaY); }
+
+	bool DoesIntersect(const BS_Rect &Rect) const { return intersects(Rect); }
+
+	bool Intersect(const BS_Rect &Rect, BS_Rect &Result) const {
+		Result = Rect;
+		Result.clip(*this);
 	}
-	/**
-		@brief Konstruktor, der das Rechteck mit den \xFCbergebenen Werten initialisiert.
-		@param left das linke Extrem des Rechteckes
-		@param top das obere Extrem des Rechteckes
-		@param right das rechte Extrem des Rechteckes + 1
-		@param bottom des untere Extrem des Rechteckes + 1
-	*/
-	BS_Rect(int left_, int top_, int right_, int bottom_)
-	{
-		this->left = left_;
-		this->top = top_;
-		this->right = right_;
-		this->bottom = bottom_;
-	}
-	/**
-		@brief Verschiebt das Rechteck.
-		@param DeltaX der Wert um den das Rechteck auf der X-Achse verschoben werden soll.
-		@param DeltaY der Wert um den das Rechteck auf der Y-Achse verschoben werden soll.
-	*/
-	void Move(int DeltaX, int DeltaY)
-	{
-		left += DeltaX;
-		right += DeltaX;
-		top += DeltaY;
-		bottom += DeltaY;
-	}
-	/**
-		@brief Testet ob sich zwei Rechtecke schneiden.
-		@return Gibt true zur\xFCck, wenn sich die Rechtecke schneiden.
-	*/
-	bool DoesIntersect(const BS_Rect& Rect) const
-	{
-		int Dist;
-		
-		// Intersektion auf der X-Achse
-		Dist = left - Rect.left;
-		if (Dist < 0)
-		{
-			Dist = abs(Dist);
-			
-			// Schneiden sich die Rechtecke nicht auf der X-Achse, so schneiden sie sich gar nicht
-			if (Dist >= GetWidth())
-				return false;
-		}
-		else
-		{
-			// Schneiden sich die Rechtecke nicht auf der X-Achse, so schneiden sie sich gar nicht
-			if (Dist >= Rect.right - Rect.left)
-				return false;
-		}
-		
-		// Intersektion auf der Y-Achse
-		Dist = top - Rect.top;
-		if (Dist < 0)
-		{
-			Dist = abs(Dist);
-			
-			// Schneiden sich die Rechtecke nicht auf der Y-Achse, so schneiden sie sich gar nicht
-			if (Dist >= GetHeight())
-				return false;
-		}
-		else
-		{
-			// Schneiden sich die Rechtecke nicht auf der Y-Achse, so schneiden sie sich gar nicht
-			if (Dist >= Rect.bottom - Rect.top)
-				return false;
-		}
-		
-		return true;
-	}
 
-	/**
-		@brief Bildet den Durchschnitt zweier Rechtecke
-		@param Rect das Rechteck, dass mit dem Objekt geschnitter werden soll.
-		@param Result das Rechteck, dass das Ergebnisrechteck enthalten soll.
-		@return Gibt false zur\xFCck, falls Result undefiniert ist.<br>
-				Dies ist der Fall, wenn sich die Rechtecke nicht schneiden.
-	*/
-	bool Intersect(const BS_Rect& Rect, BS_Rect& Result) const
-	{
-		int Dist;
-		
-		// Intersektion auf der X-Achse
-		Dist = left - Rect.left;
-		if (Dist < 0)
-		{
-			Dist = abs(Dist);
-			
-			// Schneiden sich die Rechtecke nicht auf der X-Achse, so schneiden sie sich gar nicht
-			if (Dist >= GetWidth())
-			{
-				Result = BS_Rect(0, 0, 0, 0);
-				return false;
-			}
-			
-			// Die Abmessungen des Rect auf der X-Achse berechnen
-			Result.left = Rect.left;
-		}
-		else
-		{
-			// Schneiden sich die Rechtecke nicht auf der X-Achse, so schneiden sie sich gar nicht
-			if (Dist >= Rect.right - Rect.left)
-			{
-				Result = BS_Rect(0, 0, 0, 0);
-				return false;
-			}
-			
-			// Die Abmessungen des Rect auf der X-Achse berechnen
-			Result.left = left;
-		}
-		Result.right = right < Rect.right ? right : Rect.right;
-		
-		// Intersektion auf der Y-Achse
-		Dist = top - Rect.top;
-		if (Dist < 0)
-		{
-			Dist = abs(Dist);
-			
-			// Schneiden sich die Rechtecke nicht auf der Y-Achse, so schneiden sie sich gar nicht
-			if (Dist >= GetHeight())
-			{
-				Result = BS_Rect(0, 0, 0, 0);
-				return false;
-			}
-			
-			// Die Abmessungen des Rect auf der Y-Achse berechnen
-			Result.top = Rect.top;
-		}
-		else
-		{
-			// Schneiden sich die Rechtecke nicht auf der Y-Achse, so schneiden sie sich gar nicht
-			if (Dist >= Rect.bottom - Rect.top)
-			{
-				Result = BS_Rect(0, 0, 0, 0);
-				return false;
-			}
-			
-			// Die Abmessungen des Rect auf der Y-Achse berechnen
-			Result.top = top;
-		}
-		Result.bottom = bottom < Rect.bottom ? bottom : Rect.bottom;
-		
-		return true;
+	void Join(const BS_Rect &Rect, BS_Rect &Result) const {
+		Result = Rect;
+		Result.extend(*this);
 	}
-	/**
-		@brief Bildet die Bounding-Box zweier Rechtecke.
-		@param Rect das Rechteck, dass mit dem Objekt verbunden werden soll.
-		@remark Das Ergebnis ist nicht ein Join in eigentlichen Sinne, sondern vielmehr die Bounding-Box um die Beiden
-				Rechtecke.
-	*/
-	void Join(const BS_Rect& Rect, BS_Rect& Result) const
-	{
-		Result.left = left < Rect.left ? left : Rect.left;
-		Result.top = top < Rect.top ? top : Rect.top;
-		Result.right = right > Rect.right ? right : Rect.right;
-		Result.bottom = bottom > Rect.bottom ? bottom : Rect.bottom;
-		return;
-	}
-	/**
-		@brief Gibt die Breite des Rechteckes zur\xFCck.
-		@return Die Breite des Rechteckes.
-	*/
-	int GetWidth() const
-	{
-		return right - left;
-	}
-	/**
-		@brief Gibt die H\xF6he des Rechteckes zur\xFCck.
-		@return Die H\xF6he des Rechteckes.
-	*/
-	int GetHeight() const
-	{
-		return bottom - top;
-	}
-	/** @brief Gibt den Fl\xE4cheninhalt des Rechteckes zur\xFCck.
-		@return Der Fl\xE4cheninhalt des Rechteckes.
-	*/
-	int GetArea() const
-	{
-		return GetWidth() * GetHeight();
-	}
-	/**
-		@brief Vergleichsoperator zum \xDCberpr\xFCfen der Gleichheit zweier BS_Rect Objekte.
-		@return Gibt true zur\xFCck, wenn die Objekte die gleichen Werte haben, ansonsten false.
-	*/
-	bool operator== (const BS_Rect& rhs)
-	{
-		return (left == rhs.left) &&
-			   (top == rhs.top) &&
-			   (right == rhs.right) &&
-			   (bottom == rhs.bottom);
-	}
-	/**
-		@brief Vergleichsoperator zum \xDCberpr\xFCfen der Ungleichheit zweier BS_Rect Objekte.
-		@return Gibt true zur\xFCck, wenn die Objekte ungleiche Werte haben, ansonsten false.
-	*/
-	bool operator!= (const BS_Rect& rhs)
-	{
-		return !(*this == rhs);
-	}
-	/**
-		@brief \xDCberpr\xFCft, ob das Objekt einen g\xFCltigen Zustand hat.
-		@return Gibt false zur\xFCck, wenn das Objekt einen ung\xFCltigen Zustand hat.
-	*/
-	bool IsValid() const
-	{
-		if (left < right && top < bottom) return true;
-		return false;
-	}
-	/**
-		@brief Testet, ob sich ein Vertex innerhalb des Rechteckes befindet.
-		@param Vertex das Vertex, dass mit dem Rechteckes getestet werden soll
-		@return Gibt true zur\xFCck, wenn sich das Vertex innerhalb des Rechteckes befindet.<br>
-				Gibt false zur\xFCck, wenn sich das Vertex au\xDFerhalb des Rechteckes befindet.
-	*/
-	bool IsPointInRect(const BS_Vertex& Vertex) const
-	{
-		if (Vertex.X >= left && Vertex.X < right &&
-			Vertex.Y >= top && Vertex.Y < bottom)
-			return true;
-		return false;
-	}
-	/**
-		@brief Testet, ob sich ein Punkt innerhalb des Rechteckes befindet.
-		@param X die Position des Punktes auf der X-Achse.
-		@param Y die Position des Punktes auf der Y-Achse.
-		@return Gibt true zur\xFCck, wenn sich der Punkt innerhalb des Rechteckes befindet.<br>
-				Gibt false zur\xFCck, wenn sich der Punkt au\xDFerhalb des Rechteckes befindet.
-	*/
-	bool IsPointInRect(int X, int Y) const
-	{
-		return IsPointInRect(BS_Vertex(X, Y));
-	}
-	/**
-		@brief Testet, ob ein andere Rechteck komplett in den Rechteck enthalten ist.
-		@param OtherRect das zu testende Rechteck
-		@brief Gibt true zur\xFCck, wenn sich das andere Rechteck komplett im Rechteck enthalten ist, ansonsten false.
-	*/
-	bool ContainsRect(const BS_Rect & OtherRect) const
-	{
-		return	IsPointInRect(OtherRect.left, OtherRect.top) &&
-				IsPointInRect(OtherRect.right - 1, OtherRect.bottom - 1);
-	}
+
+	int GetWidth() const { return width(); }
+
+	int GetHeight() const { return height(); }
+
+	int GetArea() const { return width() * height(); }
+
+	bool operator==(const BS_Rect &rhs) const { return equals(rhs); }
+
+	bool operator!= (const BS_Rect &rhs) const { return !equals(rhs); }
+
+	bool IsValid() const { return isValidRect(); }
+
+	bool IsPointInRect(const BS_Vertex &Vertex) const { return contains(Vertex.X, Vertex.Y); }
+
+	bool IsPointInRect(int X, int Y) const { return contains(X, Y); }
+
+	bool ContainsRect(const BS_Rect &OtherRect) const { return contains(OtherRect); }
 };
 
+} // End of namespace Sword25
+
 #endif

Modified: scummvm/trunk/engines/sword25/math/region.cpp
===================================================================
--- scummvm/trunk/engines/sword25/math/region.cpp	2010-10-12 22:17:00 UTC (rev 53196)
+++ scummvm/trunk/engines/sword25/math/region.cpp	2010-10-12 22:17:11 UTC (rev 53197)
@@ -41,29 +41,27 @@
 
 #define BS_LOG_PREFIX "REGION"
 
-// Konstruktion/Destruktion
+namespace Sword25 {
+
+// Constructor / Destructor
 // ------------------------
 
-BS_Region::BS_Region() : m_Valid(false), m_Type(RT_REGION)
-{
+BS_Region::BS_Region() : m_Valid(false), m_Type(RT_REGION) {
 	BS_RegionRegistry::GetInstance().RegisterObject(this);
 }
 
 // -----------------------------------------------------------------------------
 
-BS_Region::BS_Region(BS_InputPersistenceBlock & Reader, unsigned int Handle) : m_Valid(false), m_Type(RT_REGION)
-{
+BS_Region::BS_Region(BS_InputPersistenceBlock &Reader, unsigned int Handle) : m_Valid(false), m_Type(RT_REGION) {
 	BS_RegionRegistry::GetInstance().RegisterObject(this, Handle);
 	Unpersist(Reader);
 }
 
 // -----------------------------------------------------------------------------
 
-unsigned int BS_Region::Create(REGION_TYPE Type)
-{
+unsigned int BS_Region::Create(REGION_TYPE Type) {
 	BS_Region * RegionPtr;
-	switch (Type)
-	{
+	switch (Type) {
 		case RT_REGION:
 			RegionPtr = new BS_Region();
 			break;
@@ -81,24 +79,18 @@
 
 // -----------------------------------------------------------------------------
 
-unsigned int BS_Region::Create(BS_InputPersistenceBlock & Reader, unsigned int Handle)
-{
-	// Typ einlesen.
+unsigned int BS_Region::Create(BS_InputPersistenceBlock & Reader, unsigned int Handle) {
+	// Read type
 	unsigned int Type;
 	Reader.Read(Type);
 
-	// Je nach Typ ein neues BS_Region oder BS_WalkRegion Objekt erstellen.
+	// Depending on the type, create a new BS_Region or BS_WalkRegion object
 	BS_Region * RegionPtr;
-	if (Type == RT_REGION)
-	{
+	if (Type == RT_REGION) {
 		RegionPtr = new BS_Region(Reader, Handle);
-	}
-	else if (Type == RT_WALKREGION)
-	{
+	} else if (Type == RT_WALKREGION) {
 		RegionPtr = new BS_WalkRegion(Reader, Handle);
-	}
-	else
-	{
+	} else {
 		BS_ASSERT(false);
 	}
 
@@ -107,37 +99,33 @@
 
 // -----------------------------------------------------------------------------
 
-BS_Region::~BS_Region()
-{
+BS_Region::~BS_Region() {
 	BS_RegionRegistry::GetInstance().DeregisterObject(this);
 }
 
 // -----------------------------------------------------------------------------
 
-bool BS_Region::Init(const BS_Polygon& Contour, const std::vector<BS_Polygon>* pHoles)
-{
-	// Objektzustand zur\xFCcksetzen.
+bool BS_Region::Init(const BS_Polygon& Contour, const Common::Array<BS_Polygon> *pHoles) {
+	// Reset object state
 	m_Valid = false;
 	m_Position = BS_Vertex(0, 0);
 	m_Polygons.clear();
 
-	// Gen\xFCgend Platz f\xFCr Kontur und L\xF6cher im Polygon-Vektor reservieren
+	// Reserve sufficient  space for countour and holes in the polygon list
 	if (pHoles)
 		m_Polygons.reserve(1 + pHoles->size());
 	else
 		m_Polygons.reserve(1);
 
-	// Kontur an die erste Position im Polygon-Vektor kopieren
+	// The first polygon will be the contour
 	m_Polygons.push_back(BS_Polygon());
 	m_Polygons[0].Init(Contour.VertexCount, Contour.Vertecies);
-	// Sicherstellen, dass die Vertecies der Contour im Uhrzeigersinn angeordnet sind.
+	// Make sure that the Vertecies in the Contour are arranged in a clockwise direction
 	m_Polygons[0].EnsureCWOrder();
 
-	// \xDCbergebene Lochpolygone an die folgenden Positionen im Polygon-Vektor kopieren
-	if (pHoles)
-	{
-		for (unsigned int i = 0; i< pHoles->size(); ++i)
-		{
+	// Place the hole polygons in the following positions
+	if (pHoles) {
+		for (unsigned int i = 0; i< pHoles->size(); ++i) {
 			m_Polygons.push_back(BS_Polygon());
 			m_Polygons[i + 1].Init((*pHoles)[i].VertexCount, (*pHoles)[i].Vertecies);
 			m_Polygons[i + 1].EnsureCWOrder();
@@ -145,7 +133,7 @@
 	}
 
 
-	// Bounding-Box initialisieren.
+	// Initialise bounding box
 	UpdateBoundingBox();
 
 	m_Valid = true;
@@ -154,17 +142,14 @@
 
 // -----------------------------------------------------------------------------
 
-void BS_Region::UpdateBoundingBox()
-{
-	if (m_Polygons[0].VertexCount)
-	{
+void BS_Region::UpdateBoundingBox() {
+	if (m_Polygons[0].VertexCount) {
 		int MinX = m_Polygons[0].Vertecies[0].X;
 		int MaxX = m_Polygons[0].Vertecies[0].X;
 		int MinY = m_Polygons[0].Vertecies[0].Y;
 		int MaxY = m_Polygons[0].Vertecies[0].Y;
 
-		for (int i = 1; i < m_Polygons[0].VertexCount; i++)
-		{
+		for (int i = 1; i < m_Polygons[0].VertexCount; i++) {
 			if (m_Polygons[0].Vertecies[i].X < MinX) MinX = m_Polygons[0].Vertecies[i].X;
 			else if (m_Polygons[0].Vertecies[i].X > MaxX) MaxX = m_Polygons[0].Vertecies[i].X;
 			if (m_Polygons[0].Vertecies[i].Y < MinY) MinY = m_Polygons[0].Vertecies[i].Y;
@@ -175,55 +160,47 @@
 	}
 }
 
-// Positions\xE4nderungen
-// -------------------
+// Position Changes
+// ----------------
 
-void BS_Region::SetPos(int X, int Y)
-{
-	// Unterschied zwischen alter und neuer Position berechnen.
+void BS_Region::SetPos(int X, int Y) {
+	// Calculate the difference between the old and new position
 	BS_Vertex Delta(X - m_Position.X, Y - m_Position.Y);
 
-	// Neue Position im internen Zustand merken.
+	// Save the new position
 	m_Position = BS_Vertex(X, Y);
 
-	// Alle Vertecies verschieben.
-	for (unsigned int i = 0; i < m_Polygons.size(); ++i)
-	{
+	// Move all the vertecies
+	for (unsigned int i = 0; i < m_Polygons.size(); ++i) {
 		m_Polygons[i] += Delta;
 	}
 
-	// Bounding-Box aktualisieren
+	// Update the bounding box
 	UpdateBoundingBox();
 }
 
 // -----------------------------------------------------------------------------
 
-void BS_Region::SetPosX(int X)
-{
+void BS_Region::SetPosX(int X) {
 	SetPos(X, m_Position.Y);
 }
 
 // -----------------------------------------------------------------------------
 
-void BS_Region::SetPosY(int Y)
-{
+void BS_Region::SetPosY(int Y) {
 	SetPos(m_Position.X, Y);
 }
 
-// Punkt-Region Tests
+// Point-Region Tests
 // ------------------
 
-bool BS_Region::IsPointInRegion(int X, int Y) const
-{
-	// Testen, ob der Punkt in der Bounding-Box ist.
-	if (m_BoundingBox.IsPointInRect(X, Y))
-	{
-		// Testen, ob der Punkt in der Contour ist.
-		if (m_Polygons[0].IsPointInPolygon(X, Y, true))
-		{
-			// Testen, ob der Punkt in einem Loch ist.
-			for (unsigned int i = 1; i < m_Polygons.size(); i++)
-			{
+bool BS_Region::IsPointInRegion(int X, int Y) const {
+	// Test whether the point is in the bounding box
+	if (m_BoundingBox.IsPointInRect(X, Y)) {
+		// Test whether the point is in the contour
+		if (m_Polygons[0].IsPointInPolygon(X, Y, true)) {
+			// Test whether the point is in a hole
+			for (unsigned int i = 1; i < m_Polygons.size(); i++) {
 				if (m_Polygons[i].IsPointInPolygon(X,Y, false))
 					return false;
 			}
@@ -237,22 +214,19 @@
 
 // -----------------------------------------------------------------------------
 
-bool BS_Region::IsPointInRegion(const BS_Vertex& Vertex) const
-{
+bool BS_Region::IsPointInRegion(const BS_Vertex &Vertex) const {
 	return IsPointInRegion(Vertex.X, Vertex.Y);
 }
 
 // -----------------------------------------------------------------------------
 
-BS_Vertex BS_Region::FindClosestRegionPoint(const BS_Vertex& Point) const
-{
-	// Feststellen, ob sich der Punkt innerhalb eines Loches befindet, falls dies der Fall ist wird der dichteste Punkt am Rand des Loches gesucht
+BS_Vertex BS_Region::FindClosestRegionPoint(const BS_Vertex &Point) const {
+	// Determine whether the point is inside a hole. If that is the case, the closest
+	// point on the edge of the hole is determined
 	int PolygonIdx = 0;
 	{
-		for (unsigned int i = 1; i < m_Polygons.size(); ++i)
-		{
-			if (m_Polygons[i].IsPointInPolygon(Point))
-			{
+		for (unsigned int i = 1; i < m_Polygons.size(); ++i) {
+			if (m_Polygons[i].IsPointInPolygon(Point)) {
 				PolygonIdx = i;
 				break;
 			}
@@ -263,30 +237,27 @@
 
 	BS_ASSERT(Polygon.VertexCount > 1);
 
-	// F\xFCr jede Linie des Polygons wird der Punkt berechnet, der dem \xFCbergebenen am n\xE4chsten ist.
-	// Der Punkt dieser Menge mit dem gerigsten Abstand zum \xFCbergebenen Punkt ist das Ergebnis.
+	// For each line of the polygon, calculate the point that is cloest to the given point
+	// The point of this set with the smallest distance to the given point is the result.
 	BS_Vertex ClosestVertex = FindClosestPointOnLine(Polygon.Vertecies[0], Polygon.Vertecies[1], Point);
 	int ClosestVertexDistance2 = ClosestVertex.Distance(Point);
-	for (int i = 1; i < Polygon.VertexCount; ++i)
-	{
+	for (int i = 1; i < Polygon.VertexCount; ++i) {
 		int j = (i + 1) % Polygon.VertexCount;
 
 		BS_Vertex CurVertex = FindClosestPointOnLine(Polygon.Vertecies[i], Polygon.Vertecies[j], Point);
-		if (CurVertex.Distance(Point) < ClosestVertexDistance2)
-		{
+		if (CurVertex.Distance(Point) < ClosestVertexDistance2) {
 			ClosestVertex = CurVertex;
 			ClosestVertexDistance2 = CurVertex.Distance(Point);
 		}
 	}
 
-	// Feststellen, ob der konstruierte Punkt wirklich von der Methode IsPointInRegion als innerhalb der Region liegend erkannt wird.
-	// Dies muss nicht so sein, da aufgrund von Rundungsfehlern am Rand der Polygone Ungenauigkeiten auftreten.
+	// Determine whether the point is really within the region. This must not be so, as a result of rounding
+	// errors can occur at the edge of polygons
 	if (IsPointInRegion(ClosestVertex))
 		return ClosestVertex;
-	else
-	{
-		// Es wird versucht einen Punkt innerhalb der Region zu konstruieren indem 8 Punkte getestet werden, die in unmittelbarer Umgebung des
-		// berechneten Punktes liegen
+	else {
+		// Try to construct a point within the region - 8 points are tested in the immediate vacinity
+		// of the point
 		if (IsPointInRegion(ClosestVertex + BS_Vertex(-2, -2)))
 			return ClosestVertex + BS_Vertex(-2, -2);
 		else if (IsPointInRegion(ClosestVertex + BS_Vertex(0, -2)))
@@ -304,30 +275,27 @@
 		else if (IsPointInRegion(ClosestVertex + BS_Vertex(2, 2)))
 			return ClosestVertex + BS_Vertex(2, 2);
 
-		// Falls auch auf diese Weise kein Punkt gefunden werden konnte, der innerhalb der Region liegt wird das Vertex genommen, welches am
-		// n\xE4chst an dem Punkt liegt.
+		// If no point could be found that way that lies within the region, find the next point
 		ClosestVertex = Polygon.Vertecies[0];
 		int ShortestVertexDistance2 = Polygon.Vertecies[0].Distance2(Point);
 		{
-			for (int i = 1; i < Polygon.VertexCount; i++)
-			{
+			for (int i = 1; i < Polygon.VertexCount; i++) {
 				int CurDistance2 = Polygon.Vertecies[i].Distance2(Point);
-				if (CurDistance2 < ShortestVertexDistance2)
-				{
+				if (CurDistance2 < ShortestVertexDistance2) {
 					ClosestVertex = Polygon.Vertecies[i];
 					ShortestVertexDistance2 = CurDistance2;
 				}
 			}
 		}
-			BS_LOG_WARNINGLN("Clostest vertex forced because edgepoint was outside region.");
-			return ClosestVertex;
+
+		BS_LOG_WARNINGLN("Clostest vertex forced because edgepoint was outside region.");
+		return ClosestVertex;
 	}
 }
 
 // -----------------------------------------------------------------------------
 
-BS_Vertex BS_Region::FindClosestPointOnLine(const BS_Vertex & LineStart, const BS_Vertex & LineEnd, const BS_Vertex Point) const
-{
+BS_Vertex BS_Region::FindClosestPointOnLine(const BS_Vertex &LineStart, const BS_Vertex &LineEnd, const BS_Vertex Point) const {
 	float Vector1X = static_cast<float>(Point.X - LineStart.X);
 	float Vector1Y = static_cast<float>(Point.Y - LineStart.Y);
 	float Vector2X = static_cast<float>(LineEnd.X - LineStart.X);
@@ -347,15 +315,14 @@
 }
 
 // -----------------------------------------------------------------------------
-// Sichtlinie
+// Line of Sight
 // -----------------------------------------------------------------------------
 
-bool BS_Region::IsLineOfSight(const BS_Vertex & a, const BS_Vertex & b) const
-{
+bool BS_Region::IsLineOfSight(const BS_Vertex &a, const BS_Vertex &b) const {
 	BS_ASSERT(m_Polygons.size());
 
-	// Die Linie muss innerhalb des Kontur-Polygons und ausserhalb aller Loch-Polygone sein
-	std::vector<BS_Polygon>::const_iterator iter = m_Polygons.begin();
+	// The line must be within the contour polygon, and outside of any hole polygons
+	Common::Array<BS_Polygon>::const_iterator iter = m_Polygons.begin();
 	if (!(*iter).IsLineInterior(a, b)) return false;
 	for (iter++; iter != m_Polygons.end(); iter++)
 		if (!(*iter).IsLineExterior(a, b)) return false;
@@ -364,11 +331,10 @@
 }
 
 // -----------------------------------------------------------------------------
-// Persistenz
+// Persistence
 // -----------------------------------------------------------------------------
 
-bool BS_Region::Persist(BS_OutputPersistenceBlock & Writer)
-{
+bool BS_Region::Persist(BS_OutputPersistenceBlock &Writer) {
 	bool Result = true;
 
 	Writer.Write(static_cast<unsigned int>(m_Type));
@@ -377,9 +343,8 @@
 	Writer.Write(m_Position.Y);
 	
 	Writer.Write(m_Polygons.size());
-	std::vector<BS_Polygon>::iterator It = m_Polygons.begin();
-	while (It != m_Polygons.end())
-	{
+	Common::Array<BS_Polygon>::iterator It = m_Polygons.begin();
+	while (It != m_Polygons.end()) {
 		Result &= It->Persist(Writer);
 		++It;
 	}
@@ -394,8 +359,7 @@
 
 // -----------------------------------------------------------------------------
 
-bool BS_Region::Unpersist(BS_InputPersistenceBlock & Reader)
-{
+bool BS_Region::Unpersist(BS_InputPersistenceBlock &Reader) {
 	Reader.Read(m_Valid);
 	Reader.Read(m_Position.X);
 	Reader.Read(m_Position.Y);
@@ -403,8 +367,7 @@
 	m_Polygons.clear();
 	unsigned int PolygonCount;
 	Reader.Read(PolygonCount);
-	for (unsigned int i = 0; i < PolygonCount; ++i)
-	{
+	for (unsigned int i = 0; i < PolygonCount; ++i) {
 		m_Polygons.push_back(BS_Polygon(Reader));
 	}
 
@@ -418,10 +381,11 @@
 
 // -----------------------------------------------------------------------------
 
-BS_Vertex BS_Region::GetCentroid() const
-{
+BS_Vertex BS_Region::GetCentroid() const {
 	if (m_Polygons.size() > 0)
 		return m_Polygons[0].GetCentroid();
 	return
 		BS_Vertex();
 }
+
+} // End of namespace Sword25

Modified: scummvm/trunk/engines/sword25/math/region.h
===================================================================
--- scummvm/trunk/engines/sword25/math/region.h	2010-10-12 22:17:00 UTC (rev 53196)
+++ scummvm/trunk/engines/sword25/math/region.h	2010-10-12 22:17:11 UTC (rev 53197)
@@ -35,192 +35,188 @@
 #ifndef SWORD25_REGION_H
 #define SWORD25_REGION_H
 
-#include "sword25/kernel/memlog_off.h"
-#include <vector>
-#include "sword25/kernel/memlog_on.h"
-
 #include "sword25/kernel/common.h"
 #include "sword25/kernel/persistable.h"
 #include "sword25/math/vertex.h"
 #include "sword25/math/polygon.h"
 #include "sword25/math/rect.h"
 
-/**
-	@brief Diese Klasse ist die Basisklasse aller Regionen.
+namespace Sword25 {
 
-	Mit der Methode IsValid() l\xE4sst sich abfragen, ob sich das Objekt in einem g\xFCltigen Zustand befindet.<br>
-	Sollte dies nicht der Fall sein, ist die Methode Init() die einzige Methode die aufgerufen werden darf.
-	Diese Klasse garantiert, dass die Vertecies der die Umriss- und die Lochpolygone im Uhrzeigersinn angeordnet sind, so dass auf den Polygonen
-	arbeitende Algorithmen nur f\xFCr diese Anordnung implementiert werden m\xFCssen.
-*/
-class BS_Region : public BS_Persistable
-{
+/**
+ * This class is the base class of all regions.
+ *
+ * The IsValid() method can be queried to see whether the object is in a valid state.
+ * If this is not the case, the method Init() is the only method that may be invoked.
+ * This class guarantees that the Vertecies outline of the hole, and the polygons are
+ * arranged in a clockwise direction, so that the polygon working algorithms will
+ * work properly.
+ */
+class BS_Region : public BS_Persistable {
 protected:
 	/**
-		@brief Erzeugt ein uninitialisiertes #BS_Region Objekt.
-
-		Nach dem Erzeugen ist das Objekt noch ung\xFCltig (IsValid() gibt false zur\xFCck), allerdings kann das Objekt nachtr\xE4glich \xFCber
-		einen Aufruf von Init() in einen g\xFCltigen Zustand versetzt werden.
-	*/
+	 * Creates a new BS_Region object
+	 *
+	 * After creation the object is invaild (IsValid() return false), but a call can
+	 * be made later on to Init() to set up the region into a valid state.
+	 */
 	BS_Region();
 
-	BS_Region(BS_InputPersistenceBlock & Reader, unsigned int Handle);
+	BS_Region(BS_InputPersistenceBlock &Reader, unsigned int Handle);
 
 public:
-	enum REGION_TYPE
-	{
+	enum REGION_TYPE {
 		RT_REGION,
 		RT_WALKREGION
 	};
 
 	static unsigned int Create(REGION_TYPE Type);
-	static unsigned int Create(BS_InputPersistenceBlock & Reader, unsigned int Handle = 0);
+	static unsigned int Create(BS_InputPersistenceBlock &Reader, unsigned int Handle = 0);
 
 	virtual ~BS_Region();
 
 	/**
-		@brief Initialisiert ein BS_Region Objekt.
-		@param Contour ein Polygon das den Umriss der Region angibt.
-		@param pHoles ein Pointer auf einen Vector von Polygonen, die L\xF6cher in der Region angeben.<br>
-					  Falls die Region keine L\xF6cher hat, muss NULL \xFCbergeben werden.<br>
-					  Der Standardwert ist NULL.
-		@return Gibt true zur\xFCck, wenn die Initialisierung erfolgreich war.<br>
-				Gibt false zur\xFCck, wenn die Intialisierung fehlgeschlagen ist.
-		@remark Falls die Region bereits initialisiert war, wird der alte Zustand gel\xF6scht.
-	*/
-	virtual bool Init(const BS_Polygon& Contour, const std::vector<BS_Polygon>* pHoles = NULL);
-	
-	//@{
-	/** @name Sondierende Methoden */
+	 * Initialises a BS_Region object
+	 * @param Contour		A polygon indicating the outline of the region
+	 * @param pHoles		A pointer to an array of polygons representing the hole state in the region.
+	 * If the region has no holes, it must be passed as NULL. The default value is NULL.
+	 * @return				Returns true if the initialisation was successful, otherwise false.
+	 * @remark				If the region was already initialised, the old state will be deleted.
+	 */
+	virtual bool Init(const BS_Polygon &Contour, const Common::Array<BS_Polygon> *pHoles = NULL);
 
+	//
+	// Exploratory Methods
+	//
+
 	/**
-		@brief Gibt an, ob das Objekt in einem g\xFCltigen Zustand ist.
-		@return Gibt true zur\xFCck, wenn sich das Objekt in einem g\xFCltigen Zustand befindet.
-				Gibt false zur\xFCck, wenn sich das Objekt in einem ung\xFCltigen Zustand befindet.
-		@remark Ung\xFCltige Objekte k\xF6nnen durch einen Aufruf von Init() in einen g\xFCltigen Zustand versetzt werden.
-	*/
+	 * Specifies whether the object is in a valid state
+	 * @return				Returns true if the object is in a valid state, otherwise false.
+	 * @remark				Invalid objects can be made valid by calling Init with a valid state.
+	 */
 	bool IsValid() const { return m_Valid; }
 
 	/**
-		@brief Gibt die Position der Region zur\xFCck.
-	*/
-	const BS_Vertex& GetPosition() const { return m_Position; }
+	 * Returns the position of the region
+	 */
+	const BS_Vertex &GetPosition() const { return m_Position; }
 
 	/**
-		@brief Gibt die Position des Region auf der X-Achse zur\xFCck.
-	*/
+	 * Returns the X position of the region
+	 */
 	int GetPosX() const { return m_Position.X; }
 
 	/**
-		@brief Gibt die Position des Region auf der Y-Achse zur\xFCck.
-	*/
+	 * Returns the Y position of the region
+	 */
 	int GetPosY() const { return m_Position.Y; }
 
 	/**
-		@brief Gibt an, ob sich ein Punkt innerhalb der Region befindet.
-		@param Vertex ein Vertex, mit den Koordinaten des zu testenden Punktes.
-		@return Gibt true zur\xFCck, wenn sich der Punkt innerhalb der Region befindet.<br>
-				Gibt false zur\xFCck, wenn sich der Punkt au\xDFerhalb der Region befindet.
-	*/
-	bool IsPointInRegion(const BS_Vertex& Vertex) const;
+	 * Indicates whether a point is inside the region
+	 * @param Vertex		A verex with the co-ordinates of the test point

@@ Diff output truncated at 100000 characters. @@

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