aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2010-08-06 10:59:50 +0000
committerEugene Sandulenko2010-10-12 22:30:57 +0000
commita17ec87b7dd09e7b251a3f578d1f788917550451 (patch)
treec77bdbb06d39d9a200b5e0514d2aedc7f43c8e28
parent6dcf9f0ee557e692df3c70a263ca35068ff45380 (diff)
downloadscummvm-rg350-a17ec87b7dd09e7b251a3f578d1f788917550451.tar.gz
scummvm-rg350-a17ec87b7dd09e7b251a3f578d1f788917550451.tar.bz2
scummvm-rg350-a17ec87b7dd09e7b251a3f578d1f788917550451.zip
SWORD25: Number of compilation and warning fixes
svn-id: r53219
-rw-r--r--engines/sword25/gfx/animation.cpp14
-rw-r--r--engines/sword25/gfx/animation.h10
-rw-r--r--engines/sword25/gfx/animationresource.cpp46
-rw-r--r--engines/sword25/gfx/animationresource.h5
-rw-r--r--engines/sword25/gfx/animationtemplate.cpp2
-rw-r--r--engines/sword25/gfx/animationtemplate.h2
-rw-r--r--engines/sword25/gfx/animationtemplateregistry.cpp4
-rw-r--r--engines/sword25/gfx/bitmap.h2
-rw-r--r--engines/sword25/gfx/dynamicbitmap.cpp5
-rw-r--r--engines/sword25/gfx/dynamicbitmap.h2
-rw-r--r--engines/sword25/gfx/fontresource.cpp24
-rw-r--r--engines/sword25/gfx/fontresource.h5
-rw-r--r--engines/sword25/gfx/graphicengine.cpp26
-rw-r--r--engines/sword25/gfx/graphicengine_script.cpp220
-rw-r--r--engines/sword25/gfx/image/image.h2
-rw-r--r--engines/sword25/gfx/image/vectorimage.cpp2
-rw-r--r--engines/sword25/gfx/image/vectorimage.h10
-rw-r--r--engines/sword25/gfx/image/vectorimagerenderer.cpp2
-rw-r--r--engines/sword25/gfx/image/vectorimagerenderer.h2
-rw-r--r--engines/sword25/gfx/opengl/glimage.cpp4
-rw-r--r--engines/sword25/gfx/opengl/glimage.h4
-rw-r--r--engines/sword25/gfx/opengl/openglgfx.cpp26
-rw-r--r--engines/sword25/gfx/opengl/openglgfx.h14
-rw-r--r--engines/sword25/gfx/opengl/swimage.cpp4
-rw-r--r--engines/sword25/gfx/opengl/swimage.h4
-rw-r--r--engines/sword25/gfx/renderobjectmanager.h2
-rw-r--r--engines/sword25/gfx/screenshot.h4
-rw-r--r--engines/sword25/gfx/staticbitmap.cpp2
-rw-r--r--engines/sword25/gfx/staticbitmap.h2
-rw-r--r--engines/sword25/gfx/text.cpp4
-rw-r--r--engines/sword25/gfx/text.h2
-rw-r--r--engines/sword25/module.mk18
32 files changed, 240 insertions, 235 deletions
diff --git a/engines/sword25/gfx/animation.cpp b/engines/sword25/gfx/animation.cpp
index a2b2051c59..deeca40df7 100644
--- a/engines/sword25/gfx/animation.cpp
+++ b/engines/sword25/gfx/animation.cpp
@@ -155,7 +155,7 @@ BS_Animation::~BS_Animation()
}
// Delete Callbacks
- std::vector<ANIMATION_CALLBACK_DATA>::iterator it = m_DeleteCallbacks.begin();
+ Common::Array<ANIMATION_CALLBACK_DATA>::iterator it = m_DeleteCallbacks.begin();
for (; it != m_DeleteCallbacks.end(); it++) ((*it).Callback)((*it).Data);
}
@@ -298,7 +298,7 @@ void BS_Animation::FrameNotification(int TimeElapsed)
if (TmpCurFrame < 0)
{
// Loop-Point Callbacks
- std::vector<ANIMATION_CALLBACK_DATA>::iterator it = m_LoopPointCallbacks.begin();
+ Common::Array<ANIMATION_CALLBACK_DATA>::iterator it = m_LoopPointCallbacks.begin();
while (it != m_LoopPointCallbacks.end())
{
if (((*it).Callback)((*it).Data) == false)
@@ -317,7 +317,7 @@ void BS_Animation::FrameNotification(int TimeElapsed)
else if (static_cast<unsigned int>(TmpCurFrame) >= animationDescriptionPtr->GetFrameCount())
{
// Loop-Point Callbacks
- std::vector<ANIMATION_CALLBACK_DATA>::iterator it = m_LoopPointCallbacks.begin();
+ Common::Array<ANIMATION_CALLBACK_DATA>::iterator it = m_LoopPointCallbacks.begin();
while (it != m_LoopPointCallbacks.end())
{
if (((*it).Callback)((*it).Data) == false)
@@ -355,7 +355,7 @@ void BS_Animation::FrameNotification(int TimeElapsed)
if (animationDescriptionPtr->GetFrame(m_CurrentFrame).Action != "")
{
// Action Callbacks
- std::vector<ANIMATION_CALLBACK_DATA>::iterator it = m_ActionCallbacks.begin();
+ Common::Array<ANIMATION_CALLBACK_DATA>::iterator it = m_ActionCallbacks.begin();
while (it != m_ActionCallbacks.end())
{
if (((*it).Callback)((*it).Data) == false)
@@ -744,13 +744,13 @@ void BS_Animation::RegisterDeleteCallback(ANIMATION_CALLBACK Callback, unsigned
// Persistenz
// -----------------------------------------------------------------------------
-void BS_Animation::PersistCallbackVector(BS_OutputPersistenceBlock & Writer, const std::vector<ANIMATION_CALLBACK_DATA> & Vector)
+void BS_Animation::PersistCallbackVector(BS_OutputPersistenceBlock & Writer, const Common::Array<ANIMATION_CALLBACK_DATA> & Vector)
{
// Anzahl an Callbacks persistieren.
Writer.Write(Vector.size());
// Alle Callbacks einzeln persistieren.
- std::vector<ANIMATION_CALLBACK_DATA>::const_iterator It = Vector.begin();
+ Common::Array<ANIMATION_CALLBACK_DATA>::const_iterator It = Vector.begin();
while (It != Vector.end())
{
Writer.Write(BS_CallbackRegistry::GetInstance().ResolveCallbackPointer(It->Callback));
@@ -762,7 +762,7 @@ void BS_Animation::PersistCallbackVector(BS_OutputPersistenceBlock & Writer, con
// -----------------------------------------------------------------------------
-void BS_Animation::UnpersistCallbackVector(BS_InputPersistenceBlock & Reader, std::vector<ANIMATION_CALLBACK_DATA> & Vector)
+void BS_Animation::UnpersistCallbackVector(BS_InputPersistenceBlock & Reader, Common::Array<ANIMATION_CALLBACK_DATA> & Vector)
{
// Callbackvector leeren.
Vector.resize(0);
diff --git a/engines/sword25/gfx/animation.h b/engines/sword25/gfx/animation.h
index 606cd9485e..9faf17d7a3 100644
--- a/engines/sword25/gfx/animation.h
+++ b/engines/sword25/gfx/animation.h
@@ -183,9 +183,9 @@ private:
ANIMATION_CALLBACK Callback;
unsigned int Data;
};
- std::vector<ANIMATION_CALLBACK_DATA> m_LoopPointCallbacks;
- std::vector<ANIMATION_CALLBACK_DATA> m_ActionCallbacks;
- std::vector<ANIMATION_CALLBACK_DATA> m_DeleteCallbacks;
+ Common::Array<ANIMATION_CALLBACK_DATA> m_LoopPointCallbacks;
+ Common::Array<ANIMATION_CALLBACK_DATA> m_ActionCallbacks;
+ Common::Array<ANIMATION_CALLBACK_DATA> m_DeleteCallbacks;
/**
@brief Lockt alle Frames.
@@ -217,8 +217,8 @@ private:
int ComputeYModifier() const;
void InitMembers();
- void PersistCallbackVector(BS_OutputPersistenceBlock & Writer, const std::vector<ANIMATION_CALLBACK_DATA> & Vector);
- void UnpersistCallbackVector(BS_InputPersistenceBlock & Reader, std::vector<ANIMATION_CALLBACK_DATA> & Vector);
+ void PersistCallbackVector(BS_OutputPersistenceBlock & Writer, const Common::Array<ANIMATION_CALLBACK_DATA> & Vector);
+ void UnpersistCallbackVector(BS_InputPersistenceBlock & Reader, Common::Array<ANIMATION_CALLBACK_DATA> & Vector);
BS_AnimationDescription * GetAnimationDescription() const;
void InitializeAnimationResource(const Common::String &FileName);
};
diff --git a/engines/sword25/gfx/animationresource.cpp b/engines/sword25/gfx/animationresource.cpp
index 25c63a74aa..5de3d90ff2 100644
--- a/engines/sword25/gfx/animationresource.cpp
+++ b/engines/sword25/gfx/animationresource.cpp
@@ -85,13 +85,15 @@ BS_AnimationResource::BS_AnimationResource(const Common::String& FileName) :
BS_LOG_ERRORLN("Could not read \"%s\".", GetFileName().c_str());
return;
}
- std::vector<char> WorkBuffer(FileSize + 1);
+ char *WorkBuffer;
+ WorkBuffer = (char *)malloc(FileSize + 1);
memcpy(&WorkBuffer[0], LoadBuffer, FileSize);
delete LoadBuffer;
WorkBuffer[FileSize] = '\0';
// Datei parsen
Doc.Parse(&WorkBuffer[0]);
+ free(WorkBuffer);
if (Doc.Error())
{
BS_LOG_ERRORLN("The following TinyXML-Error occured while parsing \"%s\": %s", GetFileName().c_str(), Doc.ErrorDesc());
@@ -123,10 +125,8 @@ BS_AnimationResource::BS_AnimationResource(const Common::String& FileName) :
// In das Verzeichnis der Eingabedatei wechseln, da die Dateiverweise innerhalb der XML-Datei relativ zu diesem Verzeichnis sind.
Common::String OldDirectory = PackagePtr->GetCurrentDirectory();
- int LastSlash = GetFileName().rfind('/');
- if (LastSlash != Common::String::npos)
- {
- Common::String Dir = GetFileName().substr(0, LastSlash);
+ if (GetFileName().contains('/')) {
+ Common::String Dir = Common::String(GetFileName().c_str(), strrchr(GetFileName().c_str(), '/'));
PackagePtr->ChangeDirectory(Dir);
}
@@ -214,7 +214,7 @@ bool BS_AnimationResource::ParseAnimationTag(TiXmlElement& AnimationTag, int& FP
// -----------------------------------------------------------------------------
-bool BS_AnimationResource::ParseFrameTag(TiXmlElement& FrameTag, Frame& Frame, BS_PackageManager& PackageManager)
+bool BS_AnimationResource::ParseFrameTag(TiXmlElement& FrameTag, Frame& Frame_, BS_PackageManager& PackageManager)
{
const char* FileString = FrameTag.Attribute("file");
if (!FileString)
@@ -222,8 +222,8 @@ bool BS_AnimationResource::ParseFrameTag(TiXmlElement& FrameTag, Frame& Frame, B
BS_LOG_ERRORLN("<frame> tag without file attribute occurred in \"%s\".", GetFileName().c_str());
return false;
}
- Frame.FileName = PackageManager.GetAbsolutePath(FileString);
- if (Frame.FileName == "")
+ Frame_.FileName = PackageManager.GetAbsolutePath(FileString);
+ if (Frame_.FileName == "")
{
BS_LOG_ERRORLN("Could not create absolute path for file specified in <frame> tag in \"%s\": \"%s\".", GetFileName().c_str(), FileString);
return false;
@@ -231,7 +231,7 @@ bool BS_AnimationResource::ParseFrameTag(TiXmlElement& FrameTag, Frame& Frame, B
const char* ActionString = FrameTag.Attribute("action");
if (ActionString)
- Frame.Action = ActionString;
+ Frame_.Action = ActionString;
const char* HotspotxString = FrameTag.Attribute("hotspotx");
const char* HotspotyString = FrameTag.Attribute("hotspoty");
@@ -242,41 +242,41 @@ bool BS_AnimationResource::ParseFrameTag(TiXmlElement& FrameTag, Frame& Frame, B
!HotspotyString ? "hotspoty" : "hotspotx",
GetFileName().c_str());
- Frame.HotspotX = 0;
- if (HotspotxString && !BS_String::ToInt(Common::String(HotspotxString), Frame.HotspotX))
+ Frame_.HotspotX = 0;
+ if (HotspotxString && !BS_String::ToInt(Common::String(HotspotxString), Frame_.HotspotX))
BS_LOG_WARNINGLN("Illegal hotspotx value (\"%s\") in frame tag in \"%s\". Assuming default (\"%s\").",
- HotspotxString,GetFileName().c_str(), Frame.HotspotX);
+ HotspotxString,GetFileName().c_str(), Frame_.HotspotX);
- Frame.HotspotY = 0;
- if (HotspotyString && !BS_String::ToInt(Common::String(HotspotyString), Frame.HotspotY))
+ Frame_.HotspotY = 0;
+ if (HotspotyString && !BS_String::ToInt(Common::String(HotspotyString), Frame_.HotspotY))
BS_LOG_WARNINGLN("Illegal hotspoty value (\"%s\") in frame tag in \"%s\". Assuming default (\"%s\").",
- HotspotyString, GetFileName().c_str(), Frame.HotspotY);
+ HotspotyString, GetFileName().c_str(), Frame_.HotspotY);
const char* FlipVString = FrameTag.Attribute("flipv");
if (FlipVString)
{
- if (!BS_String::ToBool(Common::String(FlipVString), Frame.FlipV))
+ if (!BS_String::ToBool(Common::String(FlipVString), Frame_.FlipV))
{
BS_LOG_WARNINGLN("Illegal flipv value (\"%s\") in <frame> tag in \"%s\". Assuming default (\"false\").",
FlipVString, GetFileName().c_str());
- Frame.FlipV = false;
+ Frame_.FlipV = false;
}
}
else
- Frame.FlipV = false;
+ Frame_.FlipV = false;
const char* FlipHString = FrameTag.Attribute("fliph");
if (FlipHString)
{
- if (!BS_String::ToBool(FlipHString, Frame.FlipH))
+ if (!BS_String::ToBool(FlipHString, Frame_.FlipH))
{
BS_LOG_WARNINGLN("Illegal fliph value (\"%s\") in <frame> tag in \"%s\". Assuming default (\"false\").",
FlipHString, GetFileName().c_str());
- Frame.FlipH = false;
+ Frame_.FlipH = false;
}
}
else
- Frame.FlipH = false;
+ Frame_.FlipH = false;
return true;
}
@@ -291,7 +291,7 @@ BS_AnimationResource::~BS_AnimationResource()
bool BS_AnimationResource::PrecacheAllFrames() const
{
- std::vector<Frame>::const_iterator Iter = m_Frames.begin();
+ Common::Array<Frame>::const_iterator Iter = m_Frames.begin();
for (; Iter != m_Frames.end(); ++Iter)
{
if (!BS_Kernel::GetInstance()->GetResourceManager()->PrecacheResource((*Iter).FileName))
@@ -316,7 +316,7 @@ bool BS_AnimationResource::ComputeFeatures()
m_ColorModulationAllowed = true;
// Alle Frame durchgehen und alle Features deaktivieren, die auch nur von einem Frame nicht unterstützt werden.
- std::vector<Frame>::const_iterator Iter = m_Frames.begin();
+ Common::Array<Frame>::const_iterator Iter = m_Frames.begin();
for (; Iter != m_Frames.end(); ++Iter)
{
BS_BitmapResource* pBitmap;
diff --git a/engines/sword25/gfx/animationresource.h b/engines/sword25/gfx/animationresource.h
index f37931b9d9..1eff3edcc8 100644
--- a/engines/sword25/gfx/animationresource.h
+++ b/engines/sword25/gfx/animationresource.h
@@ -48,6 +48,8 @@
#include <vector>
#include "sword25/kernel/memlog_on.h"
+class TiXmlElement;
+
namespace Sword25 {
// -----------------------------------------------------------------------------
@@ -56,7 +58,6 @@ namespace Sword25 {
class BS_Kernel;
class BS_PackageManager;
-class TiXmlElement;
// -----------------------------------------------------------------------------
// Class Definition
@@ -83,7 +84,7 @@ public:
private:
bool m_Valid;
- std::vector<Frame> m_Frames;
+ Common::Array<Frame> m_Frames;
//@{
/** @name Dokument-Parser Methoden */
diff --git a/engines/sword25/gfx/animationtemplate.cpp b/engines/sword25/gfx/animationtemplate.cpp
index 4ed604467b..03afec36b7 100644
--- a/engines/sword25/gfx/animationtemplate.cpp
+++ b/engines/sword25/gfx/animationtemplate.cpp
@@ -253,7 +253,7 @@ bool BS_AnimationTemplate::Persist(BS_OutputPersistenceBlock & Writer)
Writer.Write(m_Frames.size());
// Frames einzeln persistieren.
- std::vector<const Frame>::const_iterator Iter = m_Frames.begin();
+ Common::Array<const Frame>::const_iterator Iter = m_Frames.begin();
while (Iter != m_Frames.end())
{
Writer.Write(Iter->HotspotX);
diff --git a/engines/sword25/gfx/animationtemplate.h b/engines/sword25/gfx/animationtemplate.h
index a39d0b9788..389353431e 100644
--- a/engines/sword25/gfx/animationtemplate.h
+++ b/engines/sword25/gfx/animationtemplate.h
@@ -113,7 +113,7 @@ public:
virtual bool Unpersist(BS_InputPersistenceBlock & Reader);
private:
- std::vector<const Frame> m_Frames;
+ Common::Array<const Frame> m_Frames;
BS_AnimationResource * m_SourceAnimationPtr;
bool m_Valid;
diff --git a/engines/sword25/gfx/animationtemplateregistry.cpp b/engines/sword25/gfx/animationtemplateregistry.cpp
index fa8257aaf2..1913a7cf8b 100644
--- a/engines/sword25/gfx/animationtemplateregistry.cpp
+++ b/engines/sword25/gfx/animationtemplateregistry.cpp
@@ -32,8 +32,6 @@
*
*/
-namespace Sword25 {
-
// -----------------------------------------------------------------------------
// Logging
// -----------------------------------------------------------------------------
@@ -49,6 +47,8 @@ namespace Sword25 {
#include "sword25/gfx/animationtemplateregistry.h"
#include "sword25/gfx/animationtemplate.h"
+namespace Sword25 {
+
// -----------------------------------------------------------------------------
// Implementation
// -----------------------------------------------------------------------------
diff --git a/engines/sword25/gfx/bitmap.h b/engines/sword25/gfx/bitmap.h
index 82d223e080..c0e490ee47 100644
--- a/engines/sword25/gfx/bitmap.h
+++ b/engines/sword25/gfx/bitmap.h
@@ -161,7 +161,7 @@ public:
@return Gibt false zurück, falls der Aufruf fehlgeschlagen ist.
@remark Ein Aufruf dieser Methode ist nur erlaubt, wenn IsSetContentAllowed() true zurückgibt.
*/
- virtual bool SetContent(const std::vector<unsigned char> & Pixeldata, unsigned int Offset = 0, unsigned int Stride = 0) = 0;
+ virtual bool SetContent(const byte *Pixeldata, unsigned int Offset = 0, unsigned int Stride = 0) = 0;
virtual bool IsScalingAllowed() const = 0;
virtual bool IsAlphaAllowed() const = 0;
diff --git a/engines/sword25/gfx/dynamicbitmap.cpp b/engines/sword25/gfx/dynamicbitmap.cpp
index 1797f742f8..9e5f2bb2f9 100644
--- a/engines/sword25/gfx/dynamicbitmap.cpp
+++ b/engines/sword25/gfx/dynamicbitmap.cpp
@@ -132,7 +132,7 @@ bool BS_DynamicBitmap::DoRender()
// -----------------------------------------------------------------------------
-bool BS_DynamicBitmap::SetContent(const std::vector<unsigned char> & Pixeldata, unsigned int Offset, unsigned int Stride)
+bool BS_DynamicBitmap::SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride)
{
return m_Image->SetContent(Pixeldata, Offset, Stride);
}
@@ -199,8 +199,9 @@ bool BS_DynamicBitmap::Unpersist(BS_InputPersistenceBlock & Reader)
BS_LOG_WARNINGLN("Unpersisting a BS_DynamicBitmap. Bitmap contents are missing.");
// Bild mit durchsichtigen Bilddaten initialisieren.
- std::vector<unsigned char> TransparentImageData(m_Width * m_Height * 4);
+ byte *TransparentImageData = (byte *)calloc(m_Width * m_Height * 4, 1);
m_Image->SetContent(TransparentImageData);
+ free(TransparentImageData);
Result &= BS_RenderObject::UnpersistChildren(Reader);
diff --git a/engines/sword25/gfx/dynamicbitmap.h b/engines/sword25/gfx/dynamicbitmap.h
index 565ddf3e6f..0449f9984d 100644
--- a/engines/sword25/gfx/dynamicbitmap.h
+++ b/engines/sword25/gfx/dynamicbitmap.h
@@ -63,7 +63,7 @@ public:
virtual unsigned int GetPixel(int X, int Y) const;
- virtual bool SetContent(const std::vector<unsigned char> & Pixeldata, unsigned int Offset, unsigned int Stride);
+ virtual bool SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride);
virtual bool IsScalingAllowed() const;
virtual bool IsAlphaAllowed() const;
diff --git a/engines/sword25/gfx/fontresource.cpp b/engines/sword25/gfx/fontresource.cpp
index 3ba3765b91..9dbb0a0646 100644
--- a/engines/sword25/gfx/fontresource.cpp
+++ b/engines/sword25/gfx/fontresource.cpp
@@ -166,7 +166,8 @@ bool BS_FontResource::_ParseXMLDocument(const Common::String & FileName, TiXmlDo
}
// Daten kopieren und NULL-terminieren
- std::vector<char> WorkBuffer(FileSize + 1);
+ char *WorkBuffer;
+ WorkBuffer = (char *)malloc(FileSize + 1);
memcpy(&WorkBuffer[0], LoadBuffer, FileSize);
delete LoadBuffer;
WorkBuffer[FileSize] = '\0';
@@ -174,6 +175,8 @@ bool BS_FontResource::_ParseXMLDocument(const Common::String & FileName, TiXmlDo
// Daten parsen
Doc.Parse(&WorkBuffer[0]);
+ free(WorkBuffer);
+
return !Doc.Error();
}
@@ -224,37 +227,40 @@ bool BS_FontResource::_ParseCharacterTag(TiXmlElement & Tag, int & Code, BS_Rect
return false;
}
+ int tmp;
+
// Left Attribut auslesen
- const char * LeftString = Tag.Attribute("left");
- if (!LeftString || !BS_String::ToInt(Common::String(LeftString), Rect.left) || Rect.left < 0)
- {
+ const char *LeftString = Tag.Attribute("left");
+ if (!LeftString || !BS_String::ToInt(Common::String(LeftString), tmp) || tmp < 0) {
BS_LOG_ERRORLN("Illegal or missing left attribute in <character> tag in \"%s\".", GetFileName().c_str());
return false;
}
+ Rect.left = tmp;
// Right Attribut auslesen
const char * RightString = Tag.Attribute("right");
- if (!RightString || !BS_String::ToInt(RightString, Rect.right) || Rect.right < 0)
- {
+ if (!RightString || !BS_String::ToInt(RightString, tmp) || tmp < 0) {
BS_LOG_ERRORLN("Illegal or missing right attribute in <character> tag in \"%s\".", GetFileName().c_str());
return false;
}
+ Rect.right = tmp;
// Top Attribut auslesen
const char * TopString = Tag.Attribute("top");
- if (!TopString || !BS_String::ToInt(TopString, Rect.top) || Rect.top < 0)
- {
+ if (!TopString || !BS_String::ToInt(TopString, tmp) || tmp < 0) {
BS_LOG_ERRORLN("Illegal or missing top attribute in <character> tag in \"%s\".", GetFileName().c_str());
return false;
}
+ Rect.top = tmp;
// Bottom Attribut auslesen
const char * BottomString = Tag.Attribute("bottom");
- if (!BottomString || !BS_String::ToInt(BottomString, Rect.bottom) || Rect.bottom < 0)
+ if (!BottomString || !BS_String::ToInt(BottomString, tmp) || tmp < 0)
{
BS_LOG_ERRORLN("Illegal or missing bottom attribute in <character> tag in \"%s\".", GetFileName().c_str());
return false;
}
+ Rect.bottom = tmp;
return true;
}
diff --git a/engines/sword25/gfx/fontresource.h b/engines/sword25/gfx/fontresource.h
index dff0cee085..fbaa368170 100644
--- a/engines/sword25/gfx/fontresource.h
+++ b/engines/sword25/gfx/fontresource.h
@@ -43,6 +43,9 @@
#include "sword25/kernel/resource.h"
#include "sword25/math/rect.h"
+class TiXmlDocument;
+class TiXmlElement;
+
namespace Sword25 {
// -----------------------------------------------------------------------------
@@ -50,8 +53,6 @@ namespace Sword25 {
// -----------------------------------------------------------------------------
class BS_Kernel;
-class TiXmlDocument;
-class TiXmlElement;
// -----------------------------------------------------------------------------
// Klassendefinition
diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp
index f8a3a1a44a..c35fba4159 100644
--- a/engines/sword25/gfx/graphicengine.cpp
+++ b/engines/sword25/gfx/graphicengine.cpp
@@ -42,43 +42,39 @@
#include "sword25/kernel/memlog_on.h"
#include "sword25/kernel/inputpersistenceblock.h"
#include "sword25/kernel/outputpersistenceblock.h"
+#include "sword25/gfx/graphicengine.h"
+namespace Lua {
extern "C"
{
#include "sword25/util/lua/lua.h"
#include "sword25/util/lua/lauxlib.h"
}
+}
+
namespace Sword25 {
using namespace std;
-
-// -----------------------------------------------------------------------------
-// Constants
-// -----------------------------------------------------------------------------
+using namespace Lua;
static const unsigned int FRAMETIME_SAMPLE_COUNT = 5; // Anzahl der Framezeiten über die, die Framezeit gemittelt wird
-// Includes
-// -----------------------------------------------------------------------------
-
-#include "sword25/gfx/graphicengine.h"
-
-// -----------------------------------------------------------------------------
-
BS_GraphicEngine::BS_GraphicEngine(BS_Kernel * pKernel) :
m_Width(0),
m_Height(0),
m_BitDepth(0),
m_Windowed(0),
- m_LastTimeStamp(9223372036854775807), // max. BS_INT64 um beim ersten Aufruf von _UpdateLastFrameDuration() einen Reset zu erzwingen
+ m_LastTimeStamp((uint64)-1), // max. BS_INT64 um beim ersten Aufruf von _UpdateLastFrameDuration() einen Reset zu erzwingen
m_LastFrameDuration(0),
m_TimerActive(true),
- m_FrameTimeSamples(FRAMETIME_SAMPLE_COUNT, 0),
m_FrameTimeSampleSlot(0),
m_RepaintedPixels(0),
BS_ResourceService(pKernel)
{
+ for (int i = 0; i < FRAMETIME_SAMPLE_COUNT; i++)
+ m_FrameTimeSamples[i] = 0;
+
if (!RegisterScriptBindings())
BS_LOG_ERRORLN("Script bindings could not be registered.");
else
@@ -99,7 +95,7 @@ void BS_GraphicEngine::UpdateLastFrameDuration()
m_FrameTimeSampleSlot = (m_FrameTimeSampleSlot + 1) % FRAMETIME_SAMPLE_COUNT;
// Die Framezeit wird über mehrere Frames gemittelt um Ausreisser zu eliminieren
- std::vector<unsigned int>::const_iterator it = m_FrameTimeSamples.begin();
+ Common::Array<unsigned int>::const_iterator it = m_FrameTimeSamples.begin();
unsigned int Sum = *it;
for (it++; it != m_FrameTimeSamples.end(); it++) Sum += *it;
m_LastFrameDuration = Sum / FRAMETIME_SAMPLE_COUNT;
@@ -116,7 +112,7 @@ namespace
{
unsigned int Width;
unsigned int Height;
- vector<unsigned int> Data;
+ Common::Array<unsigned int> Data;
if (!GraphicEngine.GetScreenshot(Width, Height, Data))
{
BS_LOG_ERRORLN("Call to GetScreenshot() failed. Cannot save screenshot.");
diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp
index 3ce41f34e7..74a008d1fc 100644
--- a/engines/sword25/gfx/graphicengine_script.cpp
+++ b/engines/sword25/gfx/graphicengine_script.cpp
@@ -96,9 +96,9 @@ namespace
{
CallbackfunctionRegisterer()
{
- BS_CallbackRegistry::GetInstance().RegisterCallbackFunction("LuaLoopPointCB", AnimationLoopPointCallback);
- BS_CallbackRegistry::GetInstance().RegisterCallbackFunction("LuaActionCB", AnimationActionCallback);
- BS_CallbackRegistry::GetInstance().RegisterCallbackFunction("LuaDeleteCB", AnimationDeleteCallback);
+ BS_CallbackRegistry::GetInstance().RegisterCallbackFunction("LuaLoopPointCB", (void (*)(int))AnimationLoopPointCallback);
+ BS_CallbackRegistry::GetInstance().RegisterCallbackFunction("LuaActionCB", (void (*)(int))AnimationActionCallback);
+ BS_CallbackRegistry::GetInstance().RegisterCallbackFunction("LuaDeleteCB", (void (*)(int))AnimationDeleteCallback);
}
};
static CallbackfunctionRegisterer Instance;
@@ -275,12 +275,12 @@ static int AT_Finalize(lua_State * L)
static const luaL_reg ANIMATION_TEMPLATE_METHODS[] =
{
- "AddFrame", AT_AddFrame,
- "SetFrame", AT_SetFrame,
- "SetAnimationType", AT_SetAnimationType,
- "SetFPS", AT_SetFPS,
- "__gc", AT_Finalize,
- 0, 0,
+ {"AddFrame", AT_AddFrame},
+ {"SetFrame", AT_SetFrame},
+ {"SetAnimationType", AT_SetAnimationType},
+ {"SetFPS", AT_SetFPS},
+ {"__gc", AT_Finalize},
+ {0, 0}
};
// -----------------------------------------------------------------------------
@@ -546,26 +546,26 @@ static int GetRepaintedPixels(lua_State * L)
static const luaL_reg GFX_FUNCTIONS[] =
{
- "Init", Init,
- "StartFrame", StartFrame,
- "EndFrame", EndFrame,
- "DrawDebugLine", DrawDebugLine,
- "SetVsync", SetVsync,
- "GetDisplayWidth", GetDisplayWidth,
- "GetDisplayHeight", GetDisplayHeight,
- "GetBitDepth", GetBitDepth,
- "IsVsync", IsVsync,
- "IsWindowed", IsWindowed,
- "GetFPSCount", GetFPSCount,
- "GetLastFrameDuration", GetLastFrameDuration,
- "StopMainTimer", StopMainTimer,
- "ResumeMainTimer", ResumeMainTimer,
- "GetSecondaryFrameDuration", GetSecondaryFrameDuration,
- "SaveScreenshot", SaveScreenshot,
- "NewAnimationTemplate", NewAnimationTemplate,
- "GetRepaintedPixels", GetRepaintedPixels,
- "SaveThumbnailScreenshot", SaveThumbnailScreenshot,
- 0, 0,
+ {"Init", Init},
+ {"StartFrame", StartFrame},
+ {"EndFrame", EndFrame},
+ {"DrawDebugLine", DrawDebugLine},
+ {"SetVsync", SetVsync},
+ {"GetDisplayWidth", GetDisplayWidth},
+ {"GetDisplayHeight", GetDisplayHeight},
+ {"GetBitDepth", GetBitDepth},
+ {"IsVsync", IsVsync},
+ {"IsWindowed", IsWindowed},
+ {"GetFPSCount", GetFPSCount},
+ {"GetLastFrameDuration", GetLastFrameDuration},
+ {"StopMainTimer", StopMainTimer},
+ {"ResumeMainTimer", ResumeMainTimer},
+ {"GetSecondaryFrameDuration", GetSecondaryFrameDuration},
+ {"SaveScreenshot", SaveScreenshot},
+ {"NewAnimationTemplate", NewAnimationTemplate},
+ {"GetRepaintedPixels", GetRepaintedPixels},
+ {"SaveThumbnailScreenshot", SaveThumbnailScreenshot},
+ {0, 0}
};
// -----------------------------------------------------------------------------
@@ -850,24 +850,24 @@ static int RO_Remove(lua_State * L)
static const luaL_reg RENDEROBJECT_METHODS[] =
{
- "AddAnimation", RO_AddAnimation,
- "AddText", RO_AddText,
- "AddBitmap", RO_AddBitmap,
- "AddPanel", RO_AddPanel,
- "SetPos", RO_SetPos,
- "SetX", RO_SetX,
- "SetY", RO_SetY,
- "SetZ", RO_SetZ,
- "SetVisible", RO_SetVisible,
- "GetX", RO_GetX,
- "GetY", RO_GetY,
- "GetZ", RO_GetZ,
- "GetAbsoluteX", RO_GetAbsoluteX,
- "GetAbsoluteY", RO_GetAbsoluteY,
- "GetWidth", RO_GetWidth,
- "GetHeight", RO_GetHeight,
- "IsVisible", RO_IsVisible,
- 0, 0,
+ {"AddAnimation", RO_AddAnimation},
+ {"AddText", RO_AddText},
+ {"AddBitmap", RO_AddBitmap},
+ {"AddPanel", RO_AddPanel},
+ {"SetPos", RO_SetPos},
+ {"SetX", RO_SetX},
+ {"SetY", RO_SetY},
+ {"SetZ", RO_SetZ},
+ {"SetVisible", RO_SetVisible},
+ {"GetX", RO_GetX},
+ {"GetY", RO_GetY},
+ {"GetZ", RO_GetZ},
+ {"GetAbsoluteX", RO_GetAbsoluteX},
+ {"GetAbsoluteY", RO_GetAbsoluteY},
+ {"GetWidth", RO_GetWidth},
+ {"GetHeight", RO_GetHeight},
+ {"IsVisible", RO_IsVisible},
+ {0, 0}
};
// -----------------------------------------------------------------------------
@@ -929,10 +929,10 @@ static int P_Remove(lua_State * L)
static const luaL_reg PANEL_METHODS[] =
{
- "GetColor", P_GetColor,
- "SetColor", P_SetColor,
- "Remove", P_Remove,
- 0, 0,
+ {"GetColor", P_GetColor},
+ {"SetColor", P_SetColor},
+ {"Remove", P_Remove},
+ {0, 0}
};
// -----------------------------------------------------------------------------
@@ -1144,25 +1144,25 @@ static int B_Remove(lua_State * L)
static const luaL_reg BITMAP_METHODS[] =
{
- "SetAlpha", B_SetAlpha,
- "SetTintColor", B_SetTintColor,
- "SetScaleFactor", B_SetScaleFactor,
- "SetScaleFactorX", B_SetScaleFactorX,
- "SetScaleFactorY", B_SetScaleFactorY,
- "SetFlipH", B_SetFlipH,
- "SetFlipV", B_SetFlipV,
- "GetAlpha", B_GetAlpha,
- "GetTintColor", B_GetTintColor,
- "GetScaleFactorX", B_GetScaleFactorX,
- "GetScaleFactorY", B_GetScaleFactorY,
- "IsFlipH", B_IsFlipH,
- "IsFlipV", B_IsFlipV,
- "GetPixel", B_GetPixel,
- "IsScalingAllowed", B_IsScalingAllowed,
- "IsAlphaAllowed", B_IsAlphaAllowed,
- "IsTintingAllowed", B_IsTintingAllowed,
- "Remove", B_Remove,
- 0, 0,
+ {"SetAlpha", B_SetAlpha},
+ {"SetTintColor", B_SetTintColor},
+ {"SetScaleFactor", B_SetScaleFactor},
+ {"SetScaleFactorX", B_SetScaleFactorX},
+ {"SetScaleFactorY", B_SetScaleFactorY},
+ {"SetFlipH", B_SetFlipH},
+ {"SetFlipV", B_SetFlipV},
+ {"GetAlpha", B_GetAlpha},
+ {"GetTintColor", B_GetTintColor},
+ {"GetScaleFactorX", B_GetScaleFactorX},
+ {"GetScaleFactorY", B_GetScaleFactorY},
+ {"IsFlipH", B_IsFlipH},
+ {"IsFlipV", B_IsFlipV},
+ {"GetPixel", B_GetPixel},
+ {"IsScalingAllowed", B_IsScalingAllowed},
+ {"IsAlphaAllowed", B_IsAlphaAllowed},
+ {"IsTintingAllowed", B_IsTintingAllowed},
+ {"Remove", B_Remove},
+ {0, 0}
};
// -----------------------------------------------------------------------------
@@ -1507,32 +1507,32 @@ static int A_Remove(lua_State * L)
static const luaL_reg ANIMATION_METHODS[] =
{
- "Play", A_Play,
- "Pause", A_Pause,
- "Stop", A_Stop,
- "SetFrame", A_SetFrame,
- "SetAlpha", A_SetAlpha,
- "SetTintColor", A_SetTintColor,
- "SetScaleFactor", A_SetScaleFactor,
- "SetScaleFactorX", A_SetScaleFactorX,
- "SetScaleFactorY", A_SetScaleFactorY,
- "GetScaleFactorX", A_GetScaleFactorX,
- "GetScaleFactorY", A_GetScaleFactorY,
- "GetAnimationType", A_GetAnimationType,
- "GetFPS", A_GetFPS,
- "GetFrameCount", A_GetFrameCount,
- "IsScalingAllowed", A_IsScalingAllowed,
- "IsAlphaAllowed", A_IsAlphaAllowed,
- "IsTintingAllowed", A_IsTintingAllowed,
- "GetCurrentFrame", A_GetCurrentFrame,
- "GetCurrentAction", A_GetCurrentAction,
- "IsPlaying", A_IsPlaying,
- "RegisterLoopPointCallback", A_RegisterLoopPointCallback,
- "UnregisterLoopPointCallback", A_UnregisterLoopPointCallback,
- "RegisterActionCallback", A_RegisterActionCallback,
- "UnregisterActionCallback", A_UnregisterActionCallback,
- "Remove", A_Remove,
- 0, 0,
+ {"Play", A_Play},
+ {"Pause", A_Pause},
+ {"Stop", A_Stop},
+ {"SetFrame", A_SetFrame},
+ {"SetAlpha", A_SetAlpha},
+ {"SetTintColor", A_SetTintColor},
+ {"SetScaleFactor", A_SetScaleFactor},
+ {"SetScaleFactorX", A_SetScaleFactorX},
+ {"SetScaleFactorY", A_SetScaleFactorY},
+ {"GetScaleFactorX", A_GetScaleFactorX},
+ {"GetScaleFactorY", A_GetScaleFactorY},
+ {"GetAnimationType", A_GetAnimationType},
+ {"GetFPS", A_GetFPS},
+ {"GetFrameCount", A_GetFrameCount},
+ {"IsScalingAllowed", A_IsScalingAllowed},
+ {"IsAlphaAllowed", A_IsAlphaAllowed},
+ {"IsTintingAllowed", A_IsTintingAllowed},
+ {"GetCurrentFrame", A_GetCurrentFrame},
+ {"GetCurrentAction", A_GetCurrentAction},
+ {"IsPlaying", A_IsPlaying},
+ {"RegisterLoopPointCallback", A_RegisterLoopPointCallback},
+ {"UnregisterLoopPointCallback", A_UnregisterLoopPointCallback},
+ {"RegisterActionCallback", A_RegisterActionCallback},
+ {"UnregisterActionCallback", A_UnregisterActionCallback},
+ {"Remove", A_Remove},
+ {0, 0}
};
// -----------------------------------------------------------------------------
@@ -1691,20 +1691,20 @@ static int T_Remove(lua_State * L)
static const luaL_reg TEXT_METHODS[] =
{
- "SetFont", T_SetFont,
- "SetText", T_SetText,
- "SetAlpha", T_SetAlpha,
- "SetColor", T_SetColor,
- "SetAutoWrap", T_SetAutoWrap,
- "SetAutoWrapThreshold", T_SetAutoWrapThreshold,
- "GetText", T_GetText,
- "GetFont", T_GetFont,
- "GetAlpha", T_GetAlpha,
- "GetColor", T_GetColor,
- "IsAutoWrap", T_IsAutoWrap,
- "GetAutoWrapThreshold", T_GetAutoWrapThreshold,
- "Remove", T_Remove,
- 0, 0,
+ {"SetFont", T_SetFont},
+ {"SetText", T_SetText},
+ {"SetAlpha", T_SetAlpha},
+ {"SetColor", T_SetColor},
+ {"SetAutoWrap", T_SetAutoWrap},
+ {"SetAutoWrapThreshold", T_SetAutoWrapThreshold},
+ {"GetText", T_GetText},
+ {"GetFont", T_GetFont},
+ {"GetAlpha", T_GetAlpha},
+ {"GetColor", T_GetColor},
+ {"IsAutoWrap", T_IsAutoWrap},
+ {"GetAutoWrapThreshold", T_GetAutoWrapThreshold},
+ {"Remove", T_Remove},
+ {0, 0}
};
// -----------------------------------------------------------------------------
diff --git a/engines/sword25/gfx/image/image.h b/engines/sword25/gfx/image/image.h
index 8c5d750b6a..2f9d49f695 100644
--- a/engines/sword25/gfx/image/image.h
+++ b/engines/sword25/gfx/image/image.h
@@ -167,7 +167,7 @@ public:
@return Gibt false zurück, falls der Aufruf fehlgeschlagen ist.
@remark Ein Aufruf dieser Methode ist nur erlaubt, wenn IsSetContentAllowed() true zurückgibt.
*/
- virtual bool SetContent(const std::vector<unsigned char> & Pixeldata, unsigned int Offset, unsigned int Stride) = 0;
+ virtual bool SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride) = 0;
/**
@brief Liest einen Pixel des Bildes.
diff --git a/engines/sword25/gfx/image/vectorimage.cpp b/engines/sword25/gfx/image/vectorimage.cpp
index 6d0c046fcd..5c7a5231a8 100644
--- a/engines/sword25/gfx/image/vectorimage.cpp
+++ b/engines/sword25/gfx/image/vectorimage.cpp
@@ -581,7 +581,7 @@ unsigned int BS_VectorImage::GetPixel(int X, int Y)
// -----------------------------------------------------------------------------
-bool BS_VectorImage::SetContent(const std::vector<unsigned char> & Pixeldata, unsigned int Offset, unsigned int Stride)
+bool BS_VectorImage::SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride)
{
BS_LOG_ERRORLN("SetContent() is not supported.");
return 0;
diff --git a/engines/sword25/gfx/image/vectorimage.h b/engines/sword25/gfx/image/vectorimage.h
index 778422f295..85685121f2 100644
--- a/engines/sword25/gfx/image/vectorimage.h
+++ b/engines/sword25/gfx/image/vectorimage.h
@@ -123,9 +123,9 @@ private:
};
agg::path_storage m_Paths;
- std::vector<BS_VectorPathInfo> m_PathInfos;
- std::vector<LineStyleType> m_LineStyles;
- std::vector<agg::rgba8> m_FillStyles;
+ Common::Array<BS_VectorPathInfo> m_PathInfos;
+ Common::Array<LineStyleType> m_LineStyles;
+ Common::Array<agg::rgba8> m_FillStyles;
BS_Rect m_BoundingBox;
};
@@ -164,7 +164,7 @@ public:
virtual bool IsAlphaAllowed() const { return true; }
virtual bool IsColorModulationAllowed() const { return true; }
virtual bool IsSetContentAllowed() const { return false; }
- virtual bool SetContent(const std::vector<unsigned char> & Pixeldata, unsigned int Offset, unsigned int Stride);
+ virtual bool SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride);
virtual bool Blit(int PosX = 0, int PosY = 0,
int Flipping = FLIP_NONE,
BS_Rect* pPartRect = NULL,
@@ -177,7 +177,7 @@ private:
bool ParseDefineShape(unsigned int ShapeType, SWFBitStream & bs);
bool ParseStyles(unsigned int ShapeType, SWFBitStream & bs, unsigned int & NumFillBits, unsigned int & NumLineBits);
- std::vector<BS_VectorImageElement> m_Elements;
+ Common::Array<BS_VectorImageElement> m_Elements;
BS_Rect m_BoundingBox;
};
diff --git a/engines/sword25/gfx/image/vectorimagerenderer.cpp b/engines/sword25/gfx/image/vectorimagerenderer.cpp
index 7206551586..fa776578e3 100644
--- a/engines/sword25/gfx/image/vectorimagerenderer.cpp
+++ b/engines/sword25/gfx/image/vectorimagerenderer.cpp
@@ -132,7 +132,7 @@ BS_VectorImageRenderer::BS_VectorImageRenderer() :
bool BS_VectorImageRenderer::Render(const BS_VectorImage & VectorImage,
float ScaleFactorX, float ScaleFactorY,
unsigned int & Width, unsigned int & Height,
- std::vector<char> & ImageData,
+ Common::Array<char> & ImageData,
float LineScaleFactor,
bool NoAlphaShapes)
{
diff --git a/engines/sword25/gfx/image/vectorimagerenderer.h b/engines/sword25/gfx/image/vectorimagerenderer.h
index b104374054..2712728b1f 100644
--- a/engines/sword25/gfx/image/vectorimagerenderer.h
+++ b/engines/sword25/gfx/image/vectorimagerenderer.h
@@ -69,7 +69,7 @@ public:
bool Render(const BS_VectorImage & VectorImage,
float ScaleFactorX, float ScaleFactorY,
unsigned int & Width, unsigned int & Height,
- std::vector<char> & ImageData,
+ Common::Array<char> & ImageData,
float LineScaleFactor = 1.0f,
bool NoAlphaShapes = false);
diff --git a/engines/sword25/gfx/opengl/glimage.cpp b/engines/sword25/gfx/opengl/glimage.cpp
index 80a822adcc..54d660aa7f 100644
--- a/engines/sword25/gfx/opengl/glimage.cpp
+++ b/engines/sword25/gfx/opengl/glimage.cpp
@@ -50,7 +50,7 @@ namespace Sword25 {
// CONSTRUCTION / DESTRUCTION
// -----------------------------------------------------------------------------
-BS_GLImage::BS_GLImage(const std::string & Filename, bool & Result) :
+BS_GLImage::BS_GLImage(const Common::String & Filename, bool & Result) :
m_Sprite(0),
m_Width(0),
m_Height(0)
@@ -148,7 +148,7 @@ bool BS_GLImage::Fill(const BS_Rect* pFillRect, unsigned int Color)
// -----------------------------------------------------------------------------
-bool BS_GLImage::SetContent(const std::vector<unsigned char> & Pixeldata, unsigned int Offset, unsigned int Stride)
+bool BS_GLImage::SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride)
{
// Überprüfen, ob PixelData ausreichend viele Pixel enthält um ein Bild der Größe Width * Height zu erzeugen
if (Pixeldata.size() < static_cast<unsigned int>(m_Width * m_Height * 4))
diff --git a/engines/sword25/gfx/opengl/glimage.h b/engines/sword25/gfx/opengl/glimage.h
index 62f84ef3cf..ae94473778 100644
--- a/engines/sword25/gfx/opengl/glimage.h
+++ b/engines/sword25/gfx/opengl/glimage.h
@@ -60,7 +60,7 @@ typedef void * GLS_Sprite;
class BS_GLImage : public BS_Image
{
public:
- BS_GLImage(const std::string & Filename, bool & Result);
+ BS_GLImage(const Common::String & Filename, bool & Result);
/**
@brief Erzeugt ein leeres BS_GLImage
@@ -83,7 +83,7 @@ public:
unsigned int Color = BS_ARGB(255, 255, 255, 255),
int Width = -1, int Height = -1);
virtual bool Fill(const BS_Rect* pFillRect, unsigned int Color);
- virtual bool SetContent(const std::vector<unsigned char> & Pixeldata, unsigned int Offset = 0, unsigned int Stride = 0);
+ virtual bool SetContent(const byte *Pixeldata, unsigned int Offset = 0, unsigned int Stride = 0);
virtual unsigned int GetPixel(int X, int Y);
virtual bool IsBlitSource() const { return true; }
diff --git a/engines/sword25/gfx/opengl/openglgfx.cpp b/engines/sword25/gfx/opengl/openglgfx.cpp
index fc8ecad261..7d97828213 100644
--- a/engines/sword25/gfx/opengl/openglgfx.cpp
+++ b/engines/sword25/gfx/opengl/openglgfx.cpp
@@ -72,12 +72,12 @@ namespace
{
const unsigned int BIT_DEPTH = 32;
const unsigned int BACKBUFFER_COUNT = 1;
- const std::string PNG_EXTENSION(".png");
- const std::string PNG_S_EXTENSION("_s.png");
- const std::string ANI_EXTENSION("_ani.xml");
- const std::string FNT_EXTENSION("_fnt.xml");
- const std::string SWF_EXTENSION(".swf");
- const std::string B25S_EXTENSION(".b25s");
+ const Common::String PNG_EXTENSION(".png");
+ const Common::String PNG_S_EXTENSION("_s.png");
+ const Common::String ANI_EXTENSION("_ani.xml");
+ const Common::String FNT_EXTENSION("_fnt.xml");
+ const Common::String SWF_EXTENSION(".swf");
+ const Common::String B25S_EXTENSION(".b25s");
}
@@ -195,7 +195,7 @@ bool BS_OpenGLGfx::EndFrame()
glEnable(GL_LINE_SMOOTH);
glBegin(GL_LINES);
- std::vector<DebugLine>::const_iterator iter = m_DebugLines.begin();
+ Common::Array<DebugLine>::const_iterator iter = m_DebugLines.begin();
for (; iter != m_DebugLines.end(); ++iter)
{
const unsigned int & Color = (*iter).Color;
@@ -303,7 +303,7 @@ bool BS_OpenGLGfx::GetScreenshot(unsigned int & Width, unsigned int & Height, ve
// -----------------------------------------------------------------------------
-bool BS_OpenGLGfx::ReadFramebufferContents(unsigned int Width, unsigned int Height, std::vector<unsigned int> & Data)
+bool BS_OpenGLGfx::ReadFramebufferContents(unsigned int Width, unsigned int Height, Common::Array<unsigned int> & Data)
{
Data.resize(Width * Height);
glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, &Data[0]);
@@ -350,17 +350,17 @@ void BS_OpenGLGfx::FlipImagedataVertical(unsigned int Width, unsigned int Height
// RESOURCE MANAGING
// -----------------------------------------------------------------------------
-static bool DoesStringEndWith(const std::string & String, const std::string & OtherString)
+static bool DoesStringEndWith(const Common::String & String, const std::string & OtherString)
{
- std::string::size_type StringPos = String.rfind(OtherString);
- if (StringPos == std::string::npos) return false;
+ Common::String::size_type StringPos = String.rfind(OtherString);
+ if (StringPos == Common::String::npos) return false;
return StringPos + OtherString.size() == String.size();
}
// -----------------------------------------------------------------------------
-BS_Resource * BS_OpenGLGfx::LoadResource(const std::string& FileName)
+BS_Resource * BS_OpenGLGfx::LoadResource(const Common::String& FileName)
{
BS_ASSERT(CanLoadResource(FileName));
@@ -476,7 +476,7 @@ BS_Resource * BS_OpenGLGfx::LoadResource(const std::string& FileName)
// -----------------------------------------------------------------------------
-bool BS_OpenGLGfx::CanLoadResource(const std::string& FileName)
+bool BS_OpenGLGfx::CanLoadResource(const Common::String& FileName)
{
return DoesStringEndWith(FileName, PNG_EXTENSION) ||
DoesStringEndWith(FileName, ANI_EXTENSION) ||
diff --git a/engines/sword25/gfx/opengl/openglgfx.h b/engines/sword25/gfx/opengl/openglgfx.h
index c1b6143827..df0d81cb04 100644
--- a/engines/sword25/gfx/opengl/openglgfx.h
+++ b/engines/sword25/gfx/opengl/openglgfx.h
@@ -85,12 +85,12 @@ public:
virtual bool GetVsync() const;
virtual bool Fill(const BS_Rect* FillRectPtr = 0, unsigned int Color = BS_RGB(0, 0, 0));
- virtual bool GetScreenshot(unsigned int & Width, unsigned int & Height, std::vector<unsigned int> & Data);
+ virtual bool GetScreenshot(unsigned int & Width, unsigned int & Height, Common::Array<unsigned int> & Data);
// Resource-Managing Methoden
// --------------------------
- virtual BS_Resource* LoadResource(const std::string& FileName);
- virtual bool CanLoadResource(const std::string& FileName);
+ virtual BS_Resource* LoadResource(const Common::String& FileName);
+ virtual bool CanLoadResource(const Common::String& FileName);
// Debugging Methoden
// ------------------
@@ -121,11 +121,11 @@ private:
unsigned int Color;
};
- std::vector<DebugLine> m_DebugLines;
+ Common::Array<DebugLine> m_DebugLines;
- static bool ReadFramebufferContents(unsigned int Width, unsigned int Height, std::vector<unsigned int> & Data);
- static void ReverseRGBAComponentOrder(std::vector<unsigned int> & Data);
- static void FlipImagedataVertical(unsigned int Width, unsigned int Height, std::vector<unsigned int> & Data);
+ static bool ReadFramebufferContents(unsigned int Width, unsigned int Height, Common::Array<unsigned int> & Data);
+ static void ReverseRGBAComponentOrder(Common::Array<unsigned int> & Data);
+ static void FlipImagedataVertical(unsigned int Width, unsigned int Height, Common::Array<unsigned int> & Data);
};
} // End of namespace Sword25
diff --git a/engines/sword25/gfx/opengl/swimage.cpp b/engines/sword25/gfx/opengl/swimage.cpp
index c8efd357a4..1429572767 100644
--- a/engines/sword25/gfx/opengl/swimage.cpp
+++ b/engines/sword25/gfx/opengl/swimage.cpp
@@ -50,7 +50,7 @@ namespace Sword25 {
// CONSTRUCTION / DESTRUCTION
// -----------------------------------------------------------------------------
-BS_SWImage::BS_SWImage(const std::string & Filename, bool & Result) :
+BS_SWImage::BS_SWImage(const Common::String & Filename, bool & Result) :
_ImageDataPtr(0),
m_Width(0),
m_Height(0)
@@ -125,7 +125,7 @@ bool BS_SWImage::Fill(const BS_Rect* pFillRect, unsigned int Color)
// -----------------------------------------------------------------------------
-bool BS_SWImage::SetContent(const std::vector<unsigned char> & Pixeldata, unsigned int Offset, unsigned int Stride)
+bool BS_SWImage::SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride)
{
BS_LOG_ERRORLN("SetContent() is not supported.");
return false;
diff --git a/engines/sword25/gfx/opengl/swimage.h b/engines/sword25/gfx/opengl/swimage.h
index cb27a089a1..bbab7c3833 100644
--- a/engines/sword25/gfx/opengl/swimage.h
+++ b/engines/sword25/gfx/opengl/swimage.h
@@ -53,7 +53,7 @@ namespace Sword25 {
class BS_SWImage : public BS_Image
{
public:
- BS_SWImage(const std::string & Filename, bool & Result);
+ BS_SWImage(const Common::String & Filename, bool & Result);
virtual ~BS_SWImage();
virtual int GetWidth() const { return m_Width; }
@@ -66,7 +66,7 @@ public:
unsigned int Color = BS_ARGB(255, 255, 255, 255),
int Width = -1, int Height = -1);
virtual bool Fill(const BS_Rect* FillRectPtr, unsigned int Color);
- virtual bool SetContent(const std::vector<unsigned char> & Pixeldata, unsigned int Offset, unsigned int Stride);
+ virtual bool SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride);
virtual unsigned int GetPixel(int X, int Y);
virtual bool IsBlitSource() const { return false; }
diff --git a/engines/sword25/gfx/renderobjectmanager.h b/engines/sword25/gfx/renderobjectmanager.h
index 31b5a56d28..f7ba5a71b5 100644
--- a/engines/sword25/gfx/renderobjectmanager.h
+++ b/engines/sword25/gfx/renderobjectmanager.h
@@ -119,7 +119,7 @@ public:
private:
bool m_FrameStarted;
- typedef std::vector<BS_RenderObjectPtr<BS_TimedRenderObject> > RenderObjectList;
+ typedef Common::Array<BS_RenderObjectPtr<BS_TimedRenderObject> > RenderObjectList;
RenderObjectList m_TimedRenderObjects;
// RenderObject-Tree Variablen
diff --git a/engines/sword25/gfx/screenshot.h b/engines/sword25/gfx/screenshot.h
index f1e8bbde10..9e9fef422b 100644
--- a/engines/sword25/gfx/screenshot.h
+++ b/engines/sword25/gfx/screenshot.h
@@ -54,8 +54,8 @@ namespace Sword25 {
class BS_Screenshot
{
public:
- static bool SaveToFile(unsigned int Width, unsigned int Height, const std::vector<unsigned int> & Data, const Common::String & Filename);
- static bool SaveThumbnailToFile(unsigned int Width, unsigned int Height, const std::vector<unsigned int> & Data, const Common::String & Filename);
+ static bool SaveToFile(unsigned int Width, unsigned int Height, const Common::Array<unsigned int> & Data, const Common::String & Filename);
+ static bool SaveThumbnailToFile(unsigned int Width, unsigned int Height, const Common::Array<unsigned int> & Data, const Common::String & Filename);
};
} // End of namespace Sword25
diff --git a/engines/sword25/gfx/staticbitmap.cpp b/engines/sword25/gfx/staticbitmap.cpp
index 21544b8b3c..161d8f8f8f 100644
--- a/engines/sword25/gfx/staticbitmap.cpp
+++ b/engines/sword25/gfx/staticbitmap.cpp
@@ -163,7 +163,7 @@ unsigned int BS_StaticBitmap::GetPixel(int X, int Y) const
// -----------------------------------------------------------------------------
-bool BS_StaticBitmap::SetContent(const std::vector<unsigned char> & Pixeldata, unsigned int Offset, unsigned int Stride)
+bool BS_StaticBitmap::SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride)
{
BS_LOG_ERRORLN("SetContent() ist not supported with this object.");
return false;
diff --git a/engines/sword25/gfx/staticbitmap.h b/engines/sword25/gfx/staticbitmap.h
index 51e51f843b..c204d8fb9d 100644
--- a/engines/sword25/gfx/staticbitmap.h
+++ b/engines/sword25/gfx/staticbitmap.h
@@ -64,7 +64,7 @@ public:
virtual unsigned int GetPixel(int X, int Y) const;
- virtual bool SetContent(const std::vector<unsigned char> & Pixeldata, unsigned int Offset, unsigned int Stride);
+ virtual bool SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride);
virtual bool IsScalingAllowed() const;
virtual bool IsAlphaAllowed() const;
diff --git a/engines/sword25/gfx/text.cpp b/engines/sword25/gfx/text.cpp
index a469a929d5..b1bf673fa5 100644
--- a/engines/sword25/gfx/text.cpp
+++ b/engines/sword25/gfx/text.cpp
@@ -192,7 +192,7 @@ bool BS_Text::DoRender()
BS_ASSERT(GfxPtr);
bool Result = true;
- std::vector<LINE>::iterator Iter = m_Lines.begin();
+ Common::Array<LINE>::iterator Iter = m_Lines.begin();
for (; Iter != m_Lines.end(); ++Iter)
{
// Feststellen, ob überhaupt Buchstaben der aktuellen Zeile vom Update betroffen sind.
@@ -328,7 +328,7 @@ void BS_Text::UpdateFormat()
// Bounding-Box der einzelnen Zeilen relativ zur ersten festlegen (vor allem zentrieren).
m_Height = 0;
- std::vector<LINE>::iterator Iter = m_Lines.begin();
+ Common::Array<LINE>::iterator Iter = m_Lines.begin();
for (; Iter != m_Lines.end(); ++Iter)
{
BS_Rect & BBox = (*Iter).BBox;
diff --git a/engines/sword25/gfx/text.h b/engines/sword25/gfx/text.h
index 4f4d76c72c..597eb00839 100644
--- a/engines/sword25/gfx/text.h
+++ b/engines/sword25/gfx/text.h
@@ -162,7 +162,7 @@ private:
Common::String Text;
};
- std::vector<LINE> m_Lines;
+ Common::Array<LINE> m_Lines;
void UpdateFormat();
void UpdateMetrics(BS_FontResource & FontResource);
diff --git a/engines/sword25/module.mk b/engines/sword25/module.mk
index 48666617b7..ab5d8cd9f8 100644
--- a/engines/sword25/module.mk
+++ b/engines/sword25/module.mk
@@ -18,15 +18,6 @@ MODULE_OBJS := \
gfx/framecounter.o \
gfx/graphicengine.o \
gfx/graphicengine_script.o \
- gfx/image/b25sloader.o \
- gfx/image/imageloader.o \
- gfx/image/pngloader.o \
- gfx/image/vectorimage.o \
- gfx/image/vectorimagerenderer.o \
- gfx/opengl/glimage.o \
- gfx/opengl/glvectorimageblit.o \
- gfx/opengl/openglgfx.o \
- gfx/opengl/swimage.o \
gfx/panel.o \
gfx/renderobject.o \
gfx/renderobjectmanager.o \
@@ -36,6 +27,15 @@ MODULE_OBJS := \
gfx/staticbitmap.o \
gfx/text.o \
gfx/timedrenderobject.o \
+ gfx/image/b25sloader.o \
+ gfx/image/imageloader.o \
+ gfx/image/pngloader.o \
+ gfx/image/vectorimage.o \
+ gfx/image/vectorimagerenderer.o \
+ gfx/opengl/glimage.o \
+ gfx/opengl/glvectorimageblit.o \
+ gfx/opengl/openglgfx.o \
+ gfx/opengl/swimage.o \
input/inputengine.o \
input/inputengine_script.o \
input/stdwininput.o \