diff options
Diffstat (limited to 'engines/sword25/math')
-rw-r--r-- | engines/sword25/math/geometry_script.cpp | 10 | ||||
-rw-r--r-- | engines/sword25/math/polygon.cpp | 20 | ||||
-rw-r--r-- | engines/sword25/math/polygon.h | 4 | ||||
-rw-r--r-- | engines/sword25/math/region.cpp | 54 | ||||
-rw-r--r-- | engines/sword25/math/region.h | 4 | ||||
-rw-r--r-- | engines/sword25/math/regionregistry.cpp | 28 | ||||
-rw-r--r-- | engines/sword25/math/regionregistry.h | 4 | ||||
-rw-r--r-- | engines/sword25/math/walkregion.cpp | 40 | ||||
-rw-r--r-- | engines/sword25/math/walkregion.h | 4 |
9 files changed, 84 insertions, 84 deletions
diff --git a/engines/sword25/math/geometry_script.cpp b/engines/sword25/math/geometry_script.cpp index 8160199c4d..e8de73b7c7 100644 --- a/engines/sword25/math/geometry_script.cpp +++ b/engines/sword25/math/geometry_script.cpp @@ -221,7 +221,7 @@ static uint TableRegionToRegion(lua_State *L, const char *ClassName) { case LUA_TNUMBER: { Polygon polygon; TablePolygonToPolygon(L, polygon); - RegionRegistry::GetInstance().ResolveHandle(RegionHandle)->Init(polygon); + RegionRegistry::GetInstance().resolveHandle(RegionHandle)->Init(polygon); } break; @@ -233,7 +233,7 @@ static uint TableRegionToRegion(lua_State *L, const char *ClassName) { int PolygonCount = luaL_getn(L, -1); if (PolygonCount == 1) - RegionRegistry::GetInstance().ResolveHandle(RegionHandle)->Init(polygon); + RegionRegistry::GetInstance().resolveHandle(RegionHandle)->Init(polygon); else { Common::Array<Polygon> Holes; Holes.reserve(PolygonCount - 1); @@ -246,7 +246,7 @@ static uint TableRegionToRegion(lua_State *L, const char *ClassName) { } BS_ASSERT((int)Holes.size() == PolygonCount - 1); - RegionRegistry::GetInstance().ResolveHandle(RegionHandle)->Init(polygon, &Holes); + RegionRegistry::GetInstance().resolveHandle(RegionHandle)->Init(polygon, &Holes); } } break; @@ -309,7 +309,7 @@ static Region *CheckRegion(lua_State *L) { uint *RegionHandlePtr; if ((RegionHandlePtr = reinterpret_cast<uint *>(my_checkudata(L, 1, REGION_CLASS_NAME))) != 0 || (RegionHandlePtr = reinterpret_cast<uint *>(my_checkudata(L, 1, WALKREGION_CLASS_NAME))) != 0) { - return RegionRegistry::GetInstance().ResolveHandle(*RegionHandlePtr); + return RegionRegistry::GetInstance().resolveHandle(*RegionHandlePtr); } else { luaL_argcheck(L, 0, 1, "'" REGION_CLASS_NAME "' expected"); } @@ -492,7 +492,7 @@ static WalkRegion *CheckWalkRegion(lua_State *L) { // The first parameter must be of type 'userdate', and the Metatable class Geo.WalkRegion uint RegionHandle; if ((RegionHandle = *reinterpret_cast<uint *>(my_checkudata(L, 1, WALKREGION_CLASS_NAME))) != 0) { - return reinterpret_cast<WalkRegion *>(RegionRegistry::GetInstance().ResolveHandle(RegionHandle)); + return reinterpret_cast<WalkRegion *>(RegionRegistry::GetInstance().resolveHandle(RegionHandle)); } else { luaL_argcheck(L, 0, 1, "'" WALKREGION_CLASS_NAME "' expected"); } diff --git a/engines/sword25/math/polygon.cpp b/engines/sword25/math/polygon.cpp index a775c75b16..9fcfd50158 100644 --- a/engines/sword25/math/polygon.cpp +++ b/engines/sword25/math/polygon.cpp @@ -59,7 +59,7 @@ Polygon::Polygon(const Polygon &Other) : VertexCount(0), Vertecies(NULL) { } Polygon::Polygon(InputPersistenceBlock &Reader) : VertexCount(0), Vertecies(NULL) { - Unpersist(Reader); + unpersist(Reader); } Polygon::~Polygon() { @@ -414,31 +414,31 @@ bool Polygon::IsPointInPolygon(const Vertex &Point, bool EdgesBelongToPolygon) c else return false; } -bool Polygon::Persist(OutputPersistenceBlock &Writer) { - Writer.Write(VertexCount); +bool Polygon::persist(OutputPersistenceBlock &writer) { + writer.write(VertexCount); for (int i = 0; i < VertexCount; ++i) { - Writer.Write(Vertecies[i].X); - Writer.Write(Vertecies[i].Y); + writer.write(Vertecies[i].X); + writer.write(Vertecies[i].Y); } return true; } -bool Polygon::Unpersist(InputPersistenceBlock &Reader) { +bool Polygon::unpersist(InputPersistenceBlock &reader) { int StoredVertexCount; - Reader.Read(StoredVertexCount); + reader.read(StoredVertexCount); Common::Array<Vertex> StoredVertecies; for (int i = 0; i < StoredVertexCount; ++i) { int x, y; - Reader.Read(x); - Reader.Read(y); + reader.read(x); + reader.read(y); StoredVertecies.push_back(Vertex(x, y)); } Init(StoredVertexCount, &StoredVertecies[0]); - return Reader.IsGood(); + return reader.isGood(); } // Main Focus diff --git a/engines/sword25/math/polygon.h b/engines/sword25/math/polygon.h index 24592c3376..f84630772d 100644 --- a/engines/sword25/math/polygon.h +++ b/engines/sword25/math/polygon.h @@ -194,8 +194,8 @@ public: /// COntains the Vertecies of the polygon Vertex *Vertecies; - virtual bool Persist(OutputPersistenceBlock &Writer); - virtual bool Unpersist(InputPersistenceBlock &Reader); + virtual bool persist(OutputPersistenceBlock &writer); + virtual bool unpersist(InputPersistenceBlock &reader); private: bool m_IsCW; diff --git a/engines/sword25/math/region.cpp b/engines/sword25/math/region.cpp index 97a49dd2f9..50dc873a2d 100644 --- a/engines/sword25/math/region.cpp +++ b/engines/sword25/math/region.cpp @@ -54,7 +54,7 @@ Region::Region() : m_Valid(false), m_Type(RT_REGION) { Region::Region(InputPersistenceBlock &Reader, uint Handle) : m_Valid(false), m_Type(RT_REGION) { RegionRegistry::GetInstance().RegisterObject(this, Handle); - Unpersist(Reader); + unpersist(Reader); } // ----------------------------------------------------------------------------- @@ -79,17 +79,17 @@ uint Region::Create(REGION_TYPE Type) { // ----------------------------------------------------------------------------- -uint Region::Create(InputPersistenceBlock &Reader, uint Handle) { +uint Region::Create(InputPersistenceBlock &reader, uint Handle) { // Read type uint Type; - Reader.Read(Type); + reader.read(Type); // Depending on the type, create a new BS_Region or BS_WalkRegion object Region *RegionPtr = NULL; if (Type == RT_REGION) { - RegionPtr = new Region(Reader, Handle); + RegionPtr = new Region(reader, Handle); } else if (Type == RT_WALKREGION) { - RegionPtr = new WalkRegion(Reader, Handle); + RegionPtr = new WalkRegion(reader, Handle); } else { BS_ASSERT(false); } @@ -334,49 +334,49 @@ bool Region::IsLineOfSight(const Vertex &a, const Vertex &b) const { // Persistence // ----------------------------------------------------------------------------- -bool Region::Persist(OutputPersistenceBlock &Writer) { +bool Region::persist(OutputPersistenceBlock &writer) { bool Result = true; - Writer.Write(static_cast<uint>(m_Type)); - Writer.Write(m_Valid); - Writer.Write(m_Position.X); - Writer.Write(m_Position.Y); + writer.write(static_cast<uint>(m_Type)); + writer.write(m_Valid); + writer.write(m_Position.X); + writer.write(m_Position.Y); - Writer.Write(m_Polygons.size()); + writer.write(m_Polygons.size()); Common::Array<Polygon>::iterator It = m_Polygons.begin(); while (It != m_Polygons.end()) { - Result &= It->Persist(Writer); + Result &= It->persist(writer); ++It; } - Writer.Write(m_BoundingBox.left); - Writer.Write(m_BoundingBox.top); - Writer.Write(m_BoundingBox.right); - Writer.Write(m_BoundingBox.bottom); + writer.write(m_BoundingBox.left); + writer.write(m_BoundingBox.top); + writer.write(m_BoundingBox.right); + writer.write(m_BoundingBox.bottom); return Result; } // ----------------------------------------------------------------------------- -bool Region::Unpersist(InputPersistenceBlock &Reader) { - Reader.Read(m_Valid); - Reader.Read(m_Position.X); - Reader.Read(m_Position.Y); +bool Region::unpersist(InputPersistenceBlock &reader) { + reader.read(m_Valid); + reader.read(m_Position.X); + reader.read(m_Position.Y); m_Polygons.clear(); uint PolygonCount; - Reader.Read(PolygonCount); + reader.read(PolygonCount); for (uint i = 0; i < PolygonCount; ++i) { - m_Polygons.push_back(Polygon(Reader)); + m_Polygons.push_back(Polygon(reader)); } - Reader.Read(m_BoundingBox.left); - Reader.Read(m_BoundingBox.top); - Reader.Read(m_BoundingBox.right); - Reader.Read(m_BoundingBox.bottom); + reader.read(m_BoundingBox.left); + reader.read(m_BoundingBox.top); + reader.read(m_BoundingBox.right); + reader.read(m_BoundingBox.bottom); - return Reader.IsGood(); + return reader.isGood(); } // ----------------------------------------------------------------------------- diff --git a/engines/sword25/math/region.h b/engines/sword25/math/region.h index 40d52e38d6..e7c160b223 100644 --- a/engines/sword25/math/region.h +++ b/engines/sword25/math/region.h @@ -200,8 +200,8 @@ public: // Manipulation Methods // - virtual bool Persist(OutputPersistenceBlock &Writer); - virtual bool Unpersist(InputPersistenceBlock &Reader); + virtual bool persist(OutputPersistenceBlock &writer); + virtual bool unpersist(InputPersistenceBlock &reader); protected: /// This specifies the type of object diff --git a/engines/sword25/math/regionregistry.cpp b/engines/sword25/math/regionregistry.cpp index 6be4c1fa2a..4e49963397 100644 --- a/engines/sword25/math/regionregistry.cpp +++ b/engines/sword25/math/regionregistry.cpp @@ -69,23 +69,23 @@ void RegionRegistry::LogWarningLn(const char *Message) const { // ----------------------------------------------------------------------------- -bool RegionRegistry::Persist(OutputPersistenceBlock &Writer) { +bool RegionRegistry::persist(OutputPersistenceBlock &writer) { bool Result = true; - // Write out the next handle - Writer.Write(m_NextHandle); + // write out the next handle + writer.write(m_NextHandle); // Number of regions to write - Writer.Write(m_Handle2PtrMap.size()); + writer.write(m_Handle2PtrMap.size()); // Persist all the BS_Regions HANDLE2PTR_MAP::const_iterator Iter = m_Handle2PtrMap.begin(); while (Iter != m_Handle2PtrMap.end()) { // Handle persistence - Writer.Write(Iter->_key); + writer.write(Iter->_key); // Persist object - Result &= Iter->_value->Persist(Writer); + Result &= Iter->_value->persist(writer); ++Iter; } @@ -95,31 +95,31 @@ bool RegionRegistry::Persist(OutputPersistenceBlock &Writer) { // ----------------------------------------------------------------------------- -bool RegionRegistry::Unpersist(InputPersistenceBlock &Reader) { +bool RegionRegistry::unpersist(InputPersistenceBlock &reader) { bool Result = true; - // Read in the next handle - Reader.Read(m_NextHandle); + // read in the next handle + reader.read(m_NextHandle); // Destroy all existing BS_Regions //FIXME: This doesn't seem right - the value is being deleted but not the actual hash node itself? while (!m_Handle2PtrMap.empty()) delete m_Handle2PtrMap.begin()->_value; - // Read in the number of BS_Regions + // read in the number of BS_Regions uint RegionCount; - Reader.Read(RegionCount); + reader.read(RegionCount); // Restore all the BS_Regions objects for (uint i = 0; i < RegionCount; ++i) { // Handle read uint Handle; - Reader.Read(Handle); + reader.read(Handle); // BS_Region restore - Result &= Region::Create(Reader, Handle) != 0; + Result &= Region::Create(reader, Handle) != 0; } - return Reader.IsGood() && Result; + return reader.isGood() && Result; } } // End of namespace Sword25 diff --git a/engines/sword25/math/regionregistry.h b/engines/sword25/math/regionregistry.h index f3befe8439..b50b261856 100644 --- a/engines/sword25/math/regionregistry.h +++ b/engines/sword25/math/regionregistry.h @@ -63,8 +63,8 @@ public: return *m_InstancePtr.get(); } - virtual bool Persist(OutputPersistenceBlock &Writer); - virtual bool Unpersist(InputPersistenceBlock &Reader); + virtual bool persist(OutputPersistenceBlock &writer); + virtual bool unpersist(InputPersistenceBlock &reader); private: virtual void LogErrorLn(const char *Message) const; diff --git a/engines/sword25/math/walkregion.cpp b/engines/sword25/math/walkregion.cpp index 8416662d58..5a0102e305 100644 --- a/engines/sword25/math/walkregion.cpp +++ b/engines/sword25/math/walkregion.cpp @@ -61,7 +61,7 @@ WalkRegion::WalkRegion() { WalkRegion::WalkRegion(InputPersistenceBlock &Reader, uint Handle) : Region(Reader, Handle) { m_Type = RT_WALKREGION; - Unpersist(Reader); + unpersist(Reader); } // ----------------------------------------------------------------------------- @@ -340,78 +340,78 @@ void WalkRegion::SetPos(int X, int Y) { // ----------------------------------------------------------------------------- -bool WalkRegion::Persist(OutputPersistenceBlock &Writer) { - bool Result = true; +bool WalkRegion::persist(OutputPersistenceBlock &writer) { + bool result = true; // Persist the parent region - Result &= Region::Persist(Writer); + result &= Region::persist(writer); // Persist the nodes - Writer.Write(m_Nodes.size()); + writer.write(m_Nodes.size()); Common::Array<Vertex>::const_iterator It = m_Nodes.begin(); while (It != m_Nodes.end()) { - Writer.Write(It->X); - Writer.Write(It->Y); + writer.write(It->X); + writer.write(It->Y); ++It; } // Persist the visibility matrix - Writer.Write(m_VisibilityMatrix.size()); + writer.write(m_VisibilityMatrix.size()); Common::Array< Common::Array<int> >::const_iterator RowIter = m_VisibilityMatrix.begin(); while (RowIter != m_VisibilityMatrix.end()) { - Writer.Write(RowIter->size()); + writer.write(RowIter->size()); Common::Array<int>::const_iterator ColIter = RowIter->begin(); while (ColIter != RowIter->end()) { - Writer.Write(*ColIter); + writer.write(*ColIter); ++ColIter; } ++RowIter; } - return Result; + return result; } // ----------------------------------------------------------------------------- -bool WalkRegion::Unpersist(InputPersistenceBlock &Reader) { - bool Result = true; +bool WalkRegion::unpersist(InputPersistenceBlock &reader) { + bool result = true; // The parent object was already loaded in the constructor of BS_Region, so at // this point only the additional data from BS_WalkRegion needs to be loaded // Node load uint NodeCount; - Reader.Read(NodeCount); + reader.read(NodeCount); m_Nodes.clear(); m_Nodes.resize(NodeCount); Common::Array<Vertex>::iterator It = m_Nodes.begin(); while (It != m_Nodes.end()) { - Reader.Read(It->X); - Reader.Read(It->Y); + reader.read(It->X); + reader.read(It->Y); ++It; } // Visibility matrix load uint RowCount; - Reader.Read(RowCount); + reader.read(RowCount); m_VisibilityMatrix.clear(); m_VisibilityMatrix.resize(RowCount); Common::Array< Common::Array<int> >::iterator RowIter = m_VisibilityMatrix.begin(); while (RowIter != m_VisibilityMatrix.end()) { uint ColCount; - Reader.Read(ColCount); + reader.read(ColCount); RowIter->resize(ColCount); Common::Array<int>::iterator ColIter = RowIter->begin(); while (ColIter != RowIter->end()) { - Reader.Read(*ColIter); + reader.read(*ColIter); ++ColIter; } ++RowIter; } - return Result && Reader.IsGood(); + return result && reader.isGood(); } } // End of namespace Sword25 diff --git a/engines/sword25/math/walkregion.h b/engines/sword25/math/walkregion.h index feb40949ce..e258f9e344 100644 --- a/engines/sword25/math/walkregion.h +++ b/engines/sword25/math/walkregion.h @@ -103,8 +103,8 @@ public: return m_VisibilityMatrix; } - virtual bool Persist(OutputPersistenceBlock &Writer); - virtual bool Unpersist(InputPersistenceBlock &Reader); + virtual bool persist(OutputPersistenceBlock &writer); + virtual bool unpersist(InputPersistenceBlock &reader); private: Common::Array<Vertex> m_Nodes; |