aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2010-08-10 12:16:31 +0000
committerEugene Sandulenko2010-10-12 22:38:23 +0000
commitad5b74c9de1eb3d6eda91e1bf21b24c87a78391e (patch)
tree8e2591e31c02ba29ad6c6927fbf1a0a4292973e0
parentab85540a1bb59d7f69b89868805d1fe2a2adc89c (diff)
downloadscummvm-rg350-ad5b74c9de1eb3d6eda91e1bf21b24c87a78391e.tar.gz
scummvm-rg350-ad5b74c9de1eb3d6eda91e1bf21b24c87a78391e.tar.bz2
scummvm-rg350-ad5b74c9de1eb3d6eda91e1bf21b24c87a78391e.zip
SWORD25: Clean compile!
Under MinGW, with OpenGL and tinyxml. svn-id: r53225
-rw-r--r--engines/sword25/gfx/animationtemplate.h2
-rw-r--r--engines/sword25/gfx/bitmap.h2
-rw-r--r--engines/sword25/gfx/dynamicbitmap.cpp6
-rw-r--r--engines/sword25/gfx/dynamicbitmap.h2
-rw-r--r--engines/sword25/gfx/image/image.h2
-rw-r--r--engines/sword25/gfx/image/vectorimage.cpp31
-rw-r--r--engines/sword25/gfx/image/vectorimage.h46
-rw-r--r--engines/sword25/gfx/image/vectorimagerenderer.cpp28
-rw-r--r--engines/sword25/gfx/image/vectorimagerenderer.h7
-rw-r--r--engines/sword25/gfx/opengl/glimage.cpp5
-rw-r--r--engines/sword25/gfx/opengl/glimage.h2
-rw-r--r--engines/sword25/gfx/opengl/glvectorimageblit.cpp4
-rw-r--r--engines/sword25/gfx/opengl/openglgfx.cpp66
-rw-r--r--engines/sword25/gfx/opengl/openglgfx.h11
-rw-r--r--engines/sword25/gfx/opengl/swimage.cpp2
-rw-r--r--engines/sword25/gfx/opengl/swimage.h2
-rw-r--r--engines/sword25/gfx/staticbitmap.cpp2
-rw-r--r--engines/sword25/gfx/staticbitmap.h2
-rw-r--r--engines/sword25/input/inputengine_script.cpp40
-rw-r--r--engines/sword25/kernel/kernel_script.cpp116
-rw-r--r--engines/sword25/module.mk82
-rw-r--r--engines/sword25/package/packagemanager_script.cpp24
-rw-r--r--engines/sword25/sfx/soundengine.cpp10
-rw-r--r--engines/sword25/sfx/soundengine_script.cpp57
-rw-r--r--engines/sword25/util/lua/luaconf.h2
25 files changed, 286 insertions, 267 deletions
diff --git a/engines/sword25/gfx/animationtemplate.h b/engines/sword25/gfx/animationtemplate.h
index 48c20b9910..df94547411 100644
--- a/engines/sword25/gfx/animationtemplate.h
+++ b/engines/sword25/gfx/animationtemplate.h
@@ -123,7 +123,7 @@ public:
virtual bool Unpersist(BS_InputPersistenceBlock &Reader);
private:
- Common::Array<const Frame> m_Frames;
+ Common::Array<Frame> m_Frames;
BS_AnimationResource *m_SourceAnimationPtr;
bool m_Valid;
diff --git a/engines/sword25/gfx/bitmap.h b/engines/sword25/gfx/bitmap.h
index 00d9308ec5..a6c451d674 100644
--- a/engines/sword25/gfx/bitmap.h
+++ b/engines/sword25/gfx/bitmap.h
@@ -172,7 +172,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 byte *Pixeldata, unsigned int Offset = 0, unsigned int Stride = 0) = 0;
+ virtual bool SetContent(const byte *Pixeldata, uint size, 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 22a0d3d1dd..c042f5b88d 100644
--- a/engines/sword25/gfx/dynamicbitmap.cpp
+++ b/engines/sword25/gfx/dynamicbitmap.cpp
@@ -123,8 +123,8 @@ bool BS_DynamicBitmap::DoRender() {
// -----------------------------------------------------------------------------
-bool BS_DynamicBitmap::SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride) {
- return m_Image->SetContent(Pixeldata, Offset, Stride);
+bool BS_DynamicBitmap::SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride) {
+ return m_Image->SetContent(Pixeldata, size, Offset, Stride);
}
// -----------------------------------------------------------------------------
@@ -184,7 +184,7 @@ bool BS_DynamicBitmap::Unpersist(BS_InputPersistenceBlock &Reader) {
// Bild mit durchsichtigen Bilddaten initialisieren.
byte *TransparentImageData = (byte *)calloc(m_Width * m_Height * 4, 1);
- m_Image->SetContent(TransparentImageData);
+ m_Image->SetContent(TransparentImageData, m_Width * m_Height);
free(TransparentImageData);
Result &= BS_RenderObject::UnpersistChildren(Reader);
diff --git a/engines/sword25/gfx/dynamicbitmap.h b/engines/sword25/gfx/dynamicbitmap.h
index 04d1ce5c7a..4209c6e1a6 100644
--- a/engines/sword25/gfx/dynamicbitmap.h
+++ b/engines/sword25/gfx/dynamicbitmap.h
@@ -62,7 +62,7 @@ public:
virtual unsigned int GetPixel(int X, int Y) const;
- virtual bool SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride);
+ virtual bool SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride);
virtual bool IsScalingAllowed() const;
virtual bool IsAlphaAllowed() const;
diff --git a/engines/sword25/gfx/image/image.h b/engines/sword25/gfx/image/image.h
index 1489af97b3..805a4b80a5 100644
--- a/engines/sword25/gfx/image/image.h
+++ b/engines/sword25/gfx/image/image.h
@@ -165,7 +165,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 byte *Pixeldata, unsigned int Offset, unsigned int Stride) = 0;
+ virtual bool SetContent(const byte *Pixeldata, uint size, 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 9e3e2fef71..549ef96d39 100644
--- a/engines/sword25/gfx/image/vectorimage.cpp
+++ b/engines/sword25/gfx/image/vectorimage.cpp
@@ -38,12 +38,8 @@
#include "sword25/kernel/bs_stdint.h"
#include "sword25/gfx/image/vectorimage.h"
-#include <vector>
-#include <stdexcept>
-#include "agg_bounding_rect.h"
-
-using namespace std;
+#include "graphics/colormasks.h"
namespace Sword25 {
@@ -195,9 +191,9 @@ BS_Rect FlashRectToBSRect(BS_VectorImage::SWFBitStream &bs) {
// Konvertiert SWF-Farben in AntiGrain Farben
// -----------------------------------------------------------------------------
-agg::rgba8 FlashColorToAGGRGBA8(unsigned int FlashColor) {
- agg::rgba8 ResultColor((FlashColor >> 16) & 0xff, (FlashColor >> 8) & 0xff, FlashColor & 0xff, FlashColor >> 24);
- ResultColor.premultiply();
+uint32 FlashColorToAGGRGBA8(unsigned int FlashColor) {
+ uint32 ResultColor = Graphics::ARGBToColor<Graphics::ColorMasks<8888> >(FlashColor >> 24, (FlashColor >> 16) & 0xff, (FlashColor >> 8) & 0xff, FlashColor & 0xff);
+
return ResultColor;
}
@@ -215,12 +211,16 @@ struct CBBGetId {
};
BS_Rect CalculateBoundingBox(const BS_VectorImageElement &VectorImageElement) {
+#if 0 // TODO
agg::path_storage Path = VectorImageElement.GetPaths();
CBBGetId IdSource(VectorImageElement);
double x1, x2, y1, y2;
agg::bounding_rect(Path, IdSource, 0, VectorImageElement.GetPathCount(), &x1, &y1, &x2, &y2);
-
+#else
+ double x1, x2, y1, y2;
+ x1 = x2 = y1 = y2 = 0;
+#endif
return BS_Rect(static_cast<int>(x1), static_cast<int>(y1), static_cast<int>(x2) + 1, static_cast<int>(y2) + 1);
}
}
@@ -388,6 +388,7 @@ bool BS_VectorImage::ParseDefineShape(unsigned int ShapeType, SWFBitStream &bs)
// Ein neuen Pfad erzeugen, es sei denn, es wurden nur neue Styles definiert
if (StateLineStyle || StateFillStyle0 || StateFillStyle1 || StateMoveTo) {
// Letzte Zeichenposition merken, beim Aufruf von start_new_path() wird die Zeichenpostionen auf 0, 0 zurückgesetzt
+#if 0 // TODO
double LastX = m_Elements.back().m_Paths.last_x();
double LastY = m_Elements.back().m_Paths.last_y();
@@ -400,6 +401,7 @@ bool BS_VectorImage::ParseDefineShape(unsigned int ShapeType, SWFBitStream &bs)
m_Elements.back().m_Paths.move_to(MoveDeltaX, MoveDeltaY);
else
m_Elements.back().m_Paths.move_to(LastX, LastY);
+#endif
}
}
} else {
@@ -414,11 +416,13 @@ bool BS_VectorImage::ParseDefineShape(unsigned int ShapeType, SWFBitStream &bs)
s32 AnchorDeltaX = bs.GetSignedBits(NumBits);
s32 AnchorDeltaY = bs.GetSignedBits(NumBits);
+#if 0 // TODO
double ControlX = m_Elements.back().m_Paths.last_x() + ControlDeltaX;
double ControlY = m_Elements.back().m_Paths.last_y() + ControlDeltaY;
double AnchorX = ControlX + AnchorDeltaX;
double AnchorY = ControlY + AnchorDeltaY;
m_Elements.back().m_Paths.curve3(ControlX, ControlY, AnchorX, AnchorY);
+#endif
} else {
// Staight edge
s32 DeltaX = 0;
@@ -436,13 +440,15 @@ bool BS_VectorImage::ParseDefineShape(unsigned int ShapeType, SWFBitStream &bs)
DeltaX = bs.GetSignedBits(NumBits);
}
+#if 0 // TODO
m_Elements.back().m_Paths.line_rel(DeltaX, DeltaY);
+#endif
}
}
}
// Bounding-Boxes der einzelnen Elemente berechnen
- vector<BS_VectorImageElement>::iterator it = m_Elements.begin();
+ Common::Array<BS_VectorImageElement>::iterator it = m_Elements.begin();
for (; it != m_Elements.end(); ++it) it->m_BoundingBox = CalculateBoundingBox(*it);
return true;
@@ -481,7 +487,8 @@ bool BS_VectorImage::ParseStyles(unsigned int ShapeType, SWFBitStream &bs, unsig
// Anzahl an Linestyles bestimmen
unsigned int LineStyleCount = bs.GetU8();
- if (LineStyleCount == 0xff) LineStyleCount = bs.GetU16();
+ if (LineStyleCount == 0xff)
+ LineStyleCount = bs.GetU16();
// Alle Linestyles einlesen
m_Elements.back().m_LineStyles.reserve(LineStyleCount);
@@ -521,7 +528,7 @@ unsigned int BS_VectorImage::GetPixel(int X, int Y) {
// -----------------------------------------------------------------------------
-bool BS_VectorImage::SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride) {
+bool BS_VectorImage::SetContent(const byte *Pixeldata, uint size, 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 f791a36f03..b17951bbdf 100644
--- a/engines/sword25/gfx/image/vectorimage.h
+++ b/engines/sword25/gfx/image/vectorimage.h
@@ -43,10 +43,10 @@
#include "sword25/gfx/image/image.h"
#include "sword25/math/rect.h"
+#if 0
#include <vector>
#include "agg_path_storage.h"
-#include "agg_color_rgba.h"
-
+#endif
namespace Sword25 {
@@ -62,7 +62,11 @@ class BS_VectorImage;
class BS_VectorPathInfo {
public:
BS_VectorPathInfo(unsigned int ID, unsigned int LineStyle, unsigned int FillStyle0, unsigned int FillStyle1) :
- m_ID(ID), m_LineStyle(LineStyle), m_FillStyle0(FillStyle0), m_FillStyle1(FillStyle1) {};
+ m_ID(ID), m_LineStyle(LineStyle), m_FillStyle0(FillStyle0), m_FillStyle1(FillStyle1) {}
+
+ BS_VectorPathInfo() {
+ m_ID = m_LineStyle = m_FillStyle0 = m_FillStyle1 = 0;
+ }
unsigned int GetID() const {
return m_ID;
@@ -90,15 +94,18 @@ private:
Werden alle Elemente eines Vektorbildes übereinandergelegt, ergibt sich das komplette Bild.
*/
class BS_VectorImageElement {
- friend BS_VectorImage;
+ friend class BS_VectorImage;
public:
- const agg::path_storage &GetPaths() const {
+#if 0 // TODO
+ const agg::path_storage &GetPaths() const {
return m_Paths;
}
- unsigned int GetPathCount() const {
+#endif
+
+ unsigned int GetPathCount() const {
return m_PathInfos.size();
}
- const BS_VectorPathInfo &GetPathInfo(unsigned int PathNr) const {
+ const BS_VectorPathInfo &GetPathInfo(unsigned int PathNr) const {
BS_ASSERT(PathNr < GetPathCount());
return m_PathInfos[PathNr];
}
@@ -112,7 +119,7 @@ public:
return m_LineStyles.size();
}
- const agg::rgba8 &GetLineStyleColor(unsigned int LineStyle) const {
+ uint32 GetLineStyleColor(unsigned int LineStyle) const {
BS_ASSERT(LineStyle < m_LineStyles.size());
return m_LineStyles[LineStyle].Color;
}
@@ -121,7 +128,7 @@ public:
return m_FillStyles.size();
}
- const agg::rgba8 &GetFillStyleColor(unsigned int FillStyle) const {
+ uint32 GetFillStyleColor(unsigned int FillStyle) const {
BS_ASSERT(FillStyle < m_FillStyles.size());
return m_FillStyles[FillStyle];
}
@@ -132,16 +139,19 @@ public:
private:
struct LineStyleType {
- LineStyleType(double Width_, const agg::rgba8 &Color_) : Width(Width_), Color(Color_) {};
- double Width;
- agg::rgba8 Color;
+ LineStyleType(double Width_, uint32 Color_) : Width(Width_), Color(Color_) {}
+ LineStyleType() { Width = 0; Color = 0; }
+ double Width;
+ uint32 Color;
};
- agg::path_storage m_Paths;
- Common::Array<BS_VectorPathInfo> m_PathInfos;
- Common::Array<LineStyleType> m_LineStyles;
- Common::Array<agg::rgba8> m_FillStyles;
- BS_Rect m_BoundingBox;
+#if 0 // TODO
+ agg::path_storage m_Paths;
+#endif
+ Common::Array<BS_VectorPathInfo> m_PathInfos;
+ Common::Array<LineStyleType> m_LineStyles;
+ Common::Array<uint32> m_FillStyles;
+ BS_Rect m_BoundingBox;
};
@@ -201,7 +211,7 @@ public:
virtual bool IsSetContentAllowed() const {
return false;
}
- virtual bool SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride);
+ virtual bool SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride);
virtual bool Blit(int PosX = 0, int PosY = 0,
int Flipping = FLIP_NONE,
BS_Rect *pPartRect = NULL,
diff --git a/engines/sword25/gfx/image/vectorimagerenderer.cpp b/engines/sword25/gfx/image/vectorimagerenderer.cpp
index 0c7f93c130..1b7fe29cdf 100644
--- a/engines/sword25/gfx/image/vectorimagerenderer.cpp
+++ b/engines/sword25/gfx/image/vectorimagerenderer.cpp
@@ -38,13 +38,16 @@
#include "sword25/gfx/image/vectorimagerenderer.h"
#include "sword25/gfx/image/vectorimage.h"
+
+#if 0 // TODO
#include "agg_conv_curve.h"
#include "agg_path_storage.h"
#include "agg_conv_stroke.h"
-
+#endif
namespace Sword25 {
+#if 0 // TODO
// -----------------------------------------------------------------------------
// CompoundShape
// -----------------------------------------------------------------------------
@@ -109,23 +112,16 @@ private:
const BS_VectorImageElement &m_ImageElement;
};
-
-// -----------------------------------------------------------------------------
-// Konstruktion
-// -----------------------------------------------------------------------------
-
BS_VectorImageRenderer::BS_VectorImageRenderer() :
PixelFormat(rbuf) {
}
-// -----------------------------------------------------------------------------
-
bool BS_VectorImageRenderer::Render(const BS_VectorImage &VectorImage,
float ScaleFactorX, float ScaleFactorY,
unsigned int &Width, unsigned int &Height,
- Common::Array<char> & ImageData,
+ byte *ImageData,
float LineScaleFactor,
bool NoAlphaShapes) {
Width = static_cast<unsigned int>(VectorImage.GetWidth() * ScaleFactorX);
@@ -200,4 +196,18 @@ bool BS_VectorImageRenderer::Render(const BS_VectorImage &VectorImage,
return true;
}
+#else
+
+BS_VectorImageRenderer::BS_VectorImageRenderer() {}
+
+bool BS_VectorImageRenderer::Render(const BS_VectorImage &VectorImage,
+ float ScaleFactorX, float ScaleFactorY,
+ unsigned int &Width, unsigned int &Height,
+ byte *ImageData,
+ float LineScaleFactor,
+ bool NoAlphaShapes) {
+ return true;
+}
+#endif
+
} // End of namespace Sword25
diff --git a/engines/sword25/gfx/image/vectorimagerenderer.h b/engines/sword25/gfx/image/vectorimagerenderer.h
index ed073abb56..41e633ba76 100644
--- a/engines/sword25/gfx/image/vectorimagerenderer.h
+++ b/engines/sword25/gfx/image/vectorimagerenderer.h
@@ -40,8 +40,8 @@
// -----------------------------------------------------------------------------
#include "sword25/kernel/common.h"
-#include <vector>
+#if 0 // TODO
#include "agg_rendering_buffer.h"
#include "agg_pixfmt_rgba.h"
#include "agg_renderer_scanline.h"
@@ -51,6 +51,7 @@
#include "agg_scanline_bin.h"
#include "agg_trans_affine.h"
#include "agg_span_allocator.h"
+#endif
namespace Sword25 {
@@ -68,11 +69,12 @@ public:
bool Render(const BS_VectorImage &VectorImage,
float ScaleFactorX, float ScaleFactorY,
unsigned int &Width, unsigned int &Height,
- Common::Array<char> & ImageData,
+ byte *ImageData,
float LineScaleFactor = 1.0f,
bool NoAlphaShapes = false);
private:
+#if 0
typedef agg::pixfmt_rgba32_pre PixelFormatType;
typedef agg::renderer_base<PixelFormatType> BaseRendererType;
typedef agg::renderer_scanline_aa_solid<BaseRendererType> ScanlineRendererType;
@@ -87,6 +89,7 @@ private:
agg::scanline_bin ScanlineBin;
agg::trans_affine Scale;
agg::span_allocator<agg::rgba8> Alloc;
+#endif
};
} // End of namespace Sword25
diff --git a/engines/sword25/gfx/opengl/glimage.cpp b/engines/sword25/gfx/opengl/glimage.cpp
index 1434a93e4e..d5e1376299 100644
--- a/engines/sword25/gfx/opengl/glimage.cpp
+++ b/engines/sword25/gfx/opengl/glimage.cpp
@@ -36,7 +36,6 @@
// INCLUDES
// -----------------------------------------------------------------------------
-#include "sword25/util/glsprites/glsprites.h"
#include "sword25/package/packagemanager.h"
#include "sword25/gfx/image/imageloader.h"
#include "sword25/gfx/opengl/openglgfx.h"
@@ -139,9 +138,9 @@ bool BS_GLImage::Fill(const BS_Rect *pFillRect, unsigned int Color) {
// -----------------------------------------------------------------------------
-bool BS_GLImage::SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride) {
+bool BS_GLImage::SetContent(const byte *Pixeldata, uint size, 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)) {
+ if (size < static_cast<unsigned int>(m_Width * m_Height * 4)) {
BS_LOG_ERRORLN("PixelData vector is too small to define a 32 bit %dx%d image.", m_Width, m_Height);
return false;
}
diff --git a/engines/sword25/gfx/opengl/glimage.h b/engines/sword25/gfx/opengl/glimage.h
index c5a7480874..9679089cee 100644
--- a/engines/sword25/gfx/opengl/glimage.h
+++ b/engines/sword25/gfx/opengl/glimage.h
@@ -88,7 +88,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 byte *Pixeldata, unsigned int Offset = 0, unsigned int Stride = 0);
+ virtual bool SetContent(const byte *Pixeldata, uint size, unsigned int Offset = 0, unsigned int Stride = 0);
virtual unsigned int GetPixel(int X, int Y);
virtual bool IsBlitSource() const {
diff --git a/engines/sword25/gfx/opengl/glvectorimageblit.cpp b/engines/sword25/gfx/opengl/glvectorimageblit.cpp
index 9368e921e1..5689fdfcba 100644
--- a/engines/sword25/gfx/opengl/glvectorimageblit.cpp
+++ b/engines/sword25/gfx/opengl/glvectorimageblit.cpp
@@ -62,7 +62,7 @@ bool BS_VectorImage::Blit(int PosX, int PosY,
unsigned int Color,
int Width, int Height) {
static BS_VectorImageRenderer VectorImageRenderer;
- static vector<char> PixelData;
+ static byte *PixelData;
static GLS_Sprite Sprite = 0;
static BS_VectorImage *OldThis = 0;
static int OldWidth;
@@ -98,7 +98,7 @@ bool BS_VectorImage::Blit(int PosX, int PosY,
return true;
}
- GLS_Result Result = GLS_SetSpriteData(Sprite, RenderedWidth, RenderedHeight, &PixelData[0], 0);
+ GLS_Result Result = GLS_SetSpriteData(Sprite, RenderedWidth, RenderedHeight, PixelData, 0);
if (Result != GLS_OK) {
BS_LOG_ERRORLN("Call to GLS_SetSpriteData() failed. Reason: %s", GLS_ResultString(Result));
return false;
diff --git a/engines/sword25/gfx/opengl/openglgfx.cpp b/engines/sword25/gfx/opengl/openglgfx.cpp
index 612e1c209e..6937efb813 100644
--- a/engines/sword25/gfx/opengl/openglgfx.cpp
+++ b/engines/sword25/gfx/opengl/openglgfx.cpp
@@ -55,12 +55,8 @@
#include "sword25/gfx/opengl/glimage.h"
#include "sword25/gfx/opengl/swimage.h"
-#include <algorithm>
-
namespace Sword25 {
-using namespace std;
-
#define BS_LOG_PREFIX "OPENGLGFX"
@@ -266,48 +262,50 @@ bool BS_OpenGLGfx::Fill(const BS_Rect *FillRectPtr, unsigned int Color) {
// -----------------------------------------------------------------------------
-bool BS_OpenGLGfx::GetScreenshot(unsigned int &Width, unsigned int &Height, vector<unsigned int> & Data) {
- if (!ReadFramebufferContents(m_Width, m_Height, Data)) return false;
+bool BS_OpenGLGfx::GetScreenshot(unsigned int &Width, unsigned int &Height, byte **Data) {
+ if (!ReadFramebufferContents(m_Width, m_Height, Data))
+ return false;
// Die Größe des Framebuffers zurückgeben.
Width = m_Width;
Height = m_Height;
// Bilddaten vom OpenGL-Format in unser eigenes Format umwandeln.
- ReverseRGBAComponentOrder(Data);
- FlipImagedataVertical(Width, Height, Data);
+ ReverseRGBAComponentOrder(*Data, Width * Height);
+ FlipImagedataVertical(Width, Height, *Data);
return true;
}
// -----------------------------------------------------------------------------
-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]);
+bool BS_OpenGLGfx::ReadFramebufferContents(unsigned int Width, unsigned int Height, byte **Data) {
+ *Data = (byte *)malloc(Width * Height * 4);
+ glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, *Data);
if (glGetError() == 0)
return true;
else {
- Data.clear();
return false;
}
}
// -----------------------------------------------------------------------------
-void BS_OpenGLGfx::ReverseRGBAComponentOrder(vector<unsigned int> & Data) {
- vector<unsigned int>::iterator It = Data.begin();
- while (It != Data.end()) {
- unsigned int Pixel = *It;
- *It = (Pixel & 0xff00ff00) | ((Pixel >> 16) & 0xff) | ((Pixel & 0xff) << 16);
- ++It;
+void BS_OpenGLGfx::ReverseRGBAComponentOrder(byte *Data, uint size) {
+ uint32 *ptr = (uint32 *)Data;
+
+ for (uint i = 0; i < size; i++) {
+ unsigned int Pixel = *ptr;
+ *ptr = (Pixel & 0xff00ff00) | ((Pixel >> 16) & 0xff) | ((Pixel & 0xff) << 16);
+ ++ptr;
}
}
// -----------------------------------------------------------------------------
-void BS_OpenGLGfx::FlipImagedataVertical(unsigned int Width, unsigned int Height, vector<unsigned int> & Data) {
+void BS_OpenGLGfx::FlipImagedataVertical(unsigned int Width, unsigned int Height, byte *Data) {
+#if 0 // TODO
vector<unsigned int> LineBuffer(Width);
for (unsigned int Y = 0; Y < Height / 2; ++Y) {
@@ -317,26 +315,18 @@ void BS_OpenGLGfx::FlipImagedataVertical(unsigned int Width, unsigned int Height
copy(Line2It, Line2It + Width, Line1It);
copy(LineBuffer.begin(), LineBuffer.end(), Line2It);
}
+#endif
}
// -----------------------------------------------------------------------------
// RESOURCE MANAGING
// -----------------------------------------------------------------------------
-static bool DoesStringEndWith(const Common::String &String, const std::string &OtherString) {
- 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 Common::String &FileName) {
BS_ASSERT(CanLoadResource(FileName));
// Bild für den Softwarebuffer laden
- if (DoesStringEndWith(FileName, PNG_S_EXTENSION)) {
+ if (FileName.hasSuffix(PNG_S_EXTENSION)) {
bool Result;
BS_SWImage *pImage = new BS_SWImage(FileName, Result);
if (!Result) {
@@ -354,7 +344,7 @@ BS_Resource *BS_OpenGLGfx::LoadResource(const Common::String &FileName) {
}
// Sprite-Bild laden
- if (DoesStringEndWith(FileName, PNG_EXTENSION) || DoesStringEndWith(FileName, B25S_EXTENSION)) {
+ if (FileName.hasSuffix(PNG_EXTENSION) || FileName.hasSuffix(B25S_EXTENSION)) {
bool Result;
BS_GLImage *pImage = new BS_GLImage(FileName, Result);
if (!Result) {
@@ -373,7 +363,7 @@ BS_Resource *BS_OpenGLGfx::LoadResource(const Common::String &FileName) {
// Vectorgraphik laden
- if (DoesStringEndWith(FileName, SWF_EXTENSION)) {
+ if (FileName.hasSuffix(SWF_EXTENSION)) {
// Pointer auf Package-Manager holen
BS_PackageManager *pPackage = BS_Kernel::GetInstance()->GetPackage();
BS_ASSERT(pPackage);
@@ -406,7 +396,7 @@ BS_Resource *BS_OpenGLGfx::LoadResource(const Common::String &FileName) {
}
// Animation laden
- if (DoesStringEndWith(FileName, ANI_EXTENSION)) {
+ if (FileName.hasSuffix(ANI_EXTENSION)) {
BS_AnimationResource *pResource = new BS_AnimationResource(FileName);
if (pResource->IsValid())
return pResource;
@@ -417,7 +407,7 @@ BS_Resource *BS_OpenGLGfx::LoadResource(const Common::String &FileName) {
}
// Font laden
- if (DoesStringEndWith(FileName, FNT_EXTENSION)) {
+ if (FileName.hasSuffix(FNT_EXTENSION)) {
BS_FontResource *pResource = new BS_FontResource(BS_Kernel::GetInstance(), FileName);
if (pResource->IsValid())
return pResource;
@@ -434,11 +424,11 @@ BS_Resource *BS_OpenGLGfx::LoadResource(const Common::String &FileName) {
// -----------------------------------------------------------------------------
bool BS_OpenGLGfx::CanLoadResource(const Common::String &FileName) {
- return DoesStringEndWith(FileName, PNG_EXTENSION) ||
- DoesStringEndWith(FileName, ANI_EXTENSION) ||
- DoesStringEndWith(FileName, FNT_EXTENSION) ||
- DoesStringEndWith(FileName, SWF_EXTENSION) ||
- DoesStringEndWith(FileName, B25S_EXTENSION);
+ return FileName.hasSuffix(PNG_EXTENSION) ||
+ FileName.hasSuffix(ANI_EXTENSION) ||
+ FileName.hasSuffix(FNT_EXTENSION) ||
+ FileName.hasSuffix(SWF_EXTENSION) ||
+ FileName.hasSuffix(B25S_EXTENSION);
}
diff --git a/engines/sword25/gfx/opengl/openglgfx.h b/engines/sword25/gfx/opengl/openglgfx.h
index 5a7ca8a85e..ae56ff7fe3 100644
--- a/engines/sword25/gfx/opengl/openglgfx.h
+++ b/engines/sword25/gfx/opengl/openglgfx.h
@@ -84,7 +84,7 @@ 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, Common::Array<unsigned int> & Data);
+ virtual bool GetScreenshot(unsigned int &Width, unsigned int &Height, byte **Data);
// Resource-Managing Methoden
// --------------------------
@@ -112,7 +112,8 @@ private:
DebugLine(const BS_Vertex &_Start, const BS_Vertex &_End, unsigned int _Color) :
Start(_Start),
End(_End),
- Color(_Color) {};
+ Color(_Color) {}
+ DebugLine() {}
BS_Vertex Start;
BS_Vertex End;
@@ -121,9 +122,9 @@ private:
Common::Array<DebugLine> m_DebugLines;
- 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);
+ static bool ReadFramebufferContents(unsigned int Width, unsigned int Height, byte **Data);
+ static void ReverseRGBAComponentOrder(byte *Data, uint size);
+ static void FlipImagedataVertical(unsigned int Width, unsigned int Height, byte *Data);
};
} // End of namespace Sword25
diff --git a/engines/sword25/gfx/opengl/swimage.cpp b/engines/sword25/gfx/opengl/swimage.cpp
index 5eebf44b10..f3aa9c1533 100644
--- a/engines/sword25/gfx/opengl/swimage.cpp
+++ b/engines/sword25/gfx/opengl/swimage.cpp
@@ -118,7 +118,7 @@ bool BS_SWImage::Fill(const BS_Rect *pFillRect, unsigned int Color) {
// -----------------------------------------------------------------------------
-bool BS_SWImage::SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride) {
+ bool BS_SWImage::SetContent(const byte *Pixeldata, uint size, 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 870cbeb830..d6e066661c 100644
--- a/engines/sword25/gfx/opengl/swimage.h
+++ b/engines/sword25/gfx/opengl/swimage.h
@@ -71,7 +71,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 byte *Pixeldata, unsigned int Offset, unsigned int Stride);
+ virtual bool SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride);
virtual unsigned int GetPixel(int X, int Y);
virtual bool IsBlitSource() const {
diff --git a/engines/sword25/gfx/staticbitmap.cpp b/engines/sword25/gfx/staticbitmap.cpp
index f4ad8151dc..00df44c83a 100644
--- a/engines/sword25/gfx/staticbitmap.cpp
+++ b/engines/sword25/gfx/staticbitmap.cpp
@@ -152,7 +152,7 @@ unsigned int BS_StaticBitmap::GetPixel(int X, int Y) const {
// -----------------------------------------------------------------------------
-bool BS_StaticBitmap::SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride) {
+bool BS_StaticBitmap::SetContent(const byte *Pixeldata, uint size, 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 816f2a2b20..b5b2aac64a 100644
--- a/engines/sword25/gfx/staticbitmap.h
+++ b/engines/sword25/gfx/staticbitmap.h
@@ -63,7 +63,7 @@ public:
virtual unsigned int GetPixel(int X, int Y) const;
- virtual bool SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride);
+ virtual bool SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride);
virtual bool IsScalingAllowed() const;
virtual bool IsAlphaAllowed() const;
diff --git a/engines/sword25/input/inputengine_script.cpp b/engines/sword25/input/inputengine_script.cpp
index 70c26e5282..6b91c4b73e 100644
--- a/engines/sword25/input/inputengine_script.cpp
+++ b/engines/sword25/input/inputengine_script.cpp
@@ -298,28 +298,28 @@ static int UnregisterCommandCallback(lua_State *L) {
static const char *PACKAGE_LIBRARY_NAME = "Input";
static const luaL_reg PACKAGE_FUNCTIONS[] = {
- "Init", Init,
- "Update", Update,
- "IsLeftMouseDown", IsLeftMouseDown,
- "IsRightMouseDown", IsRightMouseDown,
- "WasLeftMouseDown", WasLeftMouseDown,
- "WasRightMouseDown", WasRightMouseDown,
- "IsLeftDoubleClick", IsLeftDoubleClick,
- "GetMouseX", GetMouseX,
- "GetMouseY", GetMouseY,
- "SetMouseX", SetMouseX,
- "SetMouseY", SetMouseY,
- "IsKeyDown", IsKeyDown,
- "WasKeyDown", WasKeyDown,
- "RegisterCharacterCallback", RegisterCharacterCallback,
- "UnregisterCharacterCallback", UnregisterCharacterCallback,
- "RegisterCommandCallback", RegisterCommandCallback,
- "UnregisterCommandCallback", UnregisterCommandCallback,
- 0, 0,
+ {"Init", Init},
+ {"Update", Update},
+ {"IsLeftMouseDown", IsLeftMouseDown},
+ {"IsRightMouseDown", IsRightMouseDown},
+ {"WasLeftMouseDown", WasLeftMouseDown},
+ {"WasRightMouseDown", WasRightMouseDown},
+ {"IsLeftDoubleClick", IsLeftDoubleClick},
+ {"GetMouseX", GetMouseX},
+ {"GetMouseY", GetMouseY},
+ {"SetMouseX", SetMouseX},
+ {"SetMouseY", SetMouseY},
+ {"IsKeyDown", IsKeyDown},
+ {"WasKeyDown", WasKeyDown},
+ {"RegisterCharacterCallback", RegisterCharacterCallback},
+ {"UnregisterCharacterCallback", UnregisterCharacterCallback},
+ {"RegisterCommandCallback", RegisterCommandCallback},
+ {"UnregisterCommandCallback", UnregisterCommandCallback},
+ {0, 0}
};
-#define X(k) "KEY_" #k, BS_InputEngine::KEY_##k
-#define Y(k) "KEY_COMMAND_" #k, BS_InputEngine::KEY_COMMAND_##k
+#define X(k) {"KEY_" #k, BS_InputEngine::KEY_##k}
+#define Y(k) {"KEY_COMMAND_" #k, BS_InputEngine::KEY_COMMAND_##k}
static const lua_constant_reg PACKAGE_CONSTANTS[] = {
X(BACKSPACE), X(TAB), X(CLEAR), X(RETURN), X(PAUSE), X(CAPSLOCK), X(ESCAPE), X(SPACE), X(PAGEUP), X(PAGEDOWN), X(END), X(HOME), X(LEFT),
X(UP), X(RIGHT), X(DOWN), X(PRINTSCREEN), X(INSERT), X(DELETE), X(0), X(1), X(2), X(3), X(4), X(5), X(6), X(7), X(8), X(9), X(A), X(B),
diff --git a/engines/sword25/kernel/kernel_script.cpp b/engines/sword25/kernel/kernel_script.cpp
index 11caaf9d79..9d62694ad3 100644
--- a/engines/sword25/kernel/kernel_script.cpp
+++ b/engines/sword25/kernel/kernel_script.cpp
@@ -234,26 +234,26 @@ static int GetUsedMemory(lua_State *L) {
static const char *KERNEL_LIBRARY_NAME = "Kernel";
static const luaL_reg KERNEL_FUNCTIONS[] = {
- "DisconnectService", DisconnectService,
- "GetActiveServiceIdentifier", GetActiveServiceIdentifier,
- "GetSuperclassCount", GetSuperclassCount,
- "GetSuperclassIdentifier", GetSuperclassIdentifier,
- "GetServiceCount", GetServiceCount,
- "GetServiceIdentifier", GetServiceIdentifier,
- "GetMilliTicks", GetMilliTicks,
- "GetTimer", GetTimer,
- "StartService", StartService,
- "Sleep", Sleep,
- "Crash", Crash,
- "ExecuteFile", ExecuteFile,
- "GetUserdataDirectory", GetUserdataDirectory,
- "GetPathSeparator", GetPathSeparator,
- "FileExists", FileExists,
- "CreateDirectory", CreateDirectory,
- "GetWinCode", GetWinCode,
- "GetSubversionRevision", GetSubversionRevision,
- "GetUsedMemory", GetUsedMemory,
- 0, 0,
+ {"DisconnectService", DisconnectService},
+ {"GetActiveServiceIdentifier", GetActiveServiceIdentifier},
+ {"GetSuperclassCount", GetSuperclassCount},
+ {"GetSuperclassIdentifier", GetSuperclassIdentifier},
+ {"GetServiceCount", GetServiceCount},
+ {"GetServiceIdentifier", GetServiceIdentifier},
+ {"GetMilliTicks", GetMilliTicks},
+ {"GetTimer", GetTimer},
+ {"StartService", StartService},
+ {"Sleep", Sleep},
+ {"Crash", Crash},
+ {"ExecuteFile", ExecuteFile},
+ {"GetUserdataDirectory", GetUserdataDirectory},
+ {"GetPathSeparator", GetPathSeparator},
+ {"FileExists", FileExists},
+ {"CreateDirectory", CreateDirectory},
+ {"GetWinCode", GetWinCode},
+ {"GetSubversionRevision", GetSubversionRevision},
+ {"GetUsedMemory", GetUsedMemory},
+ {0, 0}
};
// -----------------------------------------------------------------------------
@@ -495,25 +495,25 @@ static int HasFocus(lua_State *L) {
static const char *WINDOW_LIBRARY_NAME = "Window";
static const luaL_reg WINDOW_FUNCTIONS[] = {
- "IsVisible", IsVisible,
- "SetVisible", SetVisible,
- "GetX", GetX,
- "SetX", SetX,
- "GetY", GetY,
- "SetY", SetY,
- "GetClientX", GetClientX,
- "GetClientY", GetClientY,
- "GetWidth", GetWidth,
- "GetHeight", GetHeight,
- "SetWidth", SetWidth,
- "SetHeight", SetHeight,
- "GetTitle", GetTitle,
- "SetTitle", SetTitle,
- "ProcessMessages", ProcessMessages,
- "CloseWanted", CloseWanted,
- "WaitForFocus", WaitForFocus,
- "HasFocus", HasFocus,
- 0, 0,
+ {"IsVisible", IsVisible},
+ {"SetVisible", SetVisible},
+ {"GetX", GetX},
+ {"SetX", SetX},
+ {"GetY", GetY},
+ {"SetY", SetY},
+ {"GetClientX", GetClientX},
+ {"GetClientY", GetClientY},
+ {"GetWidth", GetWidth},
+ {"GetHeight", GetHeight},
+ {"SetWidth", SetWidth},
+ {"SetHeight", SetHeight},
+ {"GetTitle", GetTitle},
+ {"SetTitle", SetTitle},
+ {"ProcessMessages", ProcessMessages},
+ {"CloseWanted", CloseWanted},
+ {"WaitForFocus", WaitForFocus},
+ {"HasFocus", HasFocus},
+ {0, 0}
};
// -----------------------------------------------------------------------------
@@ -625,15 +625,15 @@ static int DumpLockedResources(lua_State *L) {
static const char *RESOURCE_LIBRARY_NAME = "Resource";
static const luaL_reg RESOURCE_FUNCTIONS[] = {
- "PrecacheResource", PrecacheResource,
- "ForcePrecacheResource", ForcePrecacheResource,
- "GetMaxMemoryUsage", GetMaxMemoryUsage,
- "SetMaxMemoryUsage", SetMaxMemoryUsage,
- "EmptyCache", EmptyCache,
- "IsLogCacheMiss", IsLogCacheMiss,
- "SetLogCacheMiss", SetLogCacheMiss,
- "DumpLockedResources", DumpLockedResources,
- 0, 0,
+ {"PrecacheResource", PrecacheResource},
+ {"ForcePrecacheResource", ForcePrecacheResource},
+ {"GetMaxMemoryUsage", GetMaxMemoryUsage},
+ {"SetMaxMemoryUsage", SetMaxMemoryUsage},
+ {"EmptyCache", EmptyCache},
+ {"IsLogCacheMiss", IsLogCacheMiss},
+ {"SetLogCacheMiss", SetLogCacheMiss},
+ {"DumpLockedResources", DumpLockedResources},
+ {0, 0}
};
// -----------------------------------------------------------------------------
@@ -708,16 +708,16 @@ static int SaveGame(lua_State *L) {
static const char *PERSISTENCE_LIBRARY_NAME = "Persistence";
static const luaL_reg PERSISTENCE_FUNCTIONS[] = {
- "ReloadSlots", ReloadSlots,
- "GetSlotCount", GetSlotCount,
- "IsSlotOccupied", IsSlotOccupied,
- "GetSavegameDirectory", GetSavegameDirectory,
- "IsSavegameCompatible", IsSavegameCompatible,
- "GetSavegameDescription", GetSavegameDescription,
- "GetSavegameFilename", GetSavegameFilename,
- "LoadGame", LoadGame,
- "SaveGame", SaveGame,
- 0, 0,
+ {"ReloadSlots", ReloadSlots},
+ {"GetSlotCount", GetSlotCount},
+ {"IsSlotOccupied", IsSlotOccupied},
+ {"GetSavegameDirectory", GetSavegameDirectory},
+ {"IsSavegameCompatible", IsSavegameCompatible},
+ {"GetSavegameDescription", GetSavegameDescription},
+ {"GetSavegameFilename", GetSavegameFilename},
+ {"LoadGame", LoadGame},
+ {"SaveGame", SaveGame},
+ {0, 0}
};
// -----------------------------------------------------------------------------
diff --git a/engines/sword25/module.mk b/engines/sword25/module.mk
index b64a0f371e..62e3c8e200 100644
--- a/engines/sword25/module.mk
+++ b/engines/sword25/module.mk
@@ -31,6 +31,10 @@ MODULE_OBJS := \
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 \
kernel/callbackregistry.o \
@@ -60,54 +64,48 @@ MODULE_OBJS := \
script/luacallback.o \
script/luascript.o \
script/lua_extensions.o \
- sfx/fmodexchannel.o \
- sfx/fmodexresource.o \
- sfx/fmodexsound.o \
sfx/soundengine.o \
sfx/soundengine_script.o \
- util/glsprites/internal/core.o \
- util/glsprites/internal/glswindow.o \
- util/glsprites/internal/sprite.o \
- util/glsprites/internal/sprite_pow2.o \
- util/glsprites/internal/sprite_rectangle.o \
- util/glsprites/internal/sprite_tiled.o \
- util/glsprites/internal/util.o \
- util/lua/src/lapi.o \
- util/lua/src/lauxlib.o \
- util/lua/src/lbaselib.o \
- util/lua/src/lcode.o \
- util/lua/src/ldblib.o \
- util/lua/src/ldebug.o \
- util/lua/src/ldo.o \
- util/lua/src/ldump.o \
- util/lua/src/lfunc.o \
- util/lua/src/lgc.o \
- util/lua/src/linit.o \
- util/lua/src/liolib.o \
- util/lua/src/llex.o \
- util/lua/src/lmathlib.o \
- util/lua/src/lmem.o \
- util/lua/src/loadlib.o \
- util/lua/src/lobject.o \
- util/lua/src/lopcodes.o \
- util/lua/src/loslib.o \
- util/lua/src/lparser.o \
- util/lua/src/lstate.o \
- util/lua/src/lstring.o \
- util/lua/src/lstrlib.o \
- util/lua/src/ltable.o \
- util/lua/src/ltablib.o \
- util/lua/src/ltm.o \
- util/lua/src/lua.o \
- util/lua/src/luac.o \
- util/lua/src/lundump.o \
- util/lua/src/lvm.o \
- util/lua/src/lzio.o \
- util/lua/src/print.o \
+ util/lua/lapi.o \
+ util/lua/lauxlib.o \
+ util/lua/lbaselib.o \
+ util/lua/lcode.o \
+ util/lua/ldblib.o \
+ util/lua/ldebug.o \
+ util/lua/ldo.o \
+ util/lua/ldump.o \
+ util/lua/lfunc.o \
+ util/lua/lgc.o \
+ util/lua/linit.o \
+ util/lua/liolib.o \
+ util/lua/llex.o \
+ util/lua/lmathlib.o \
+ util/lua/lmem.o \
+ util/lua/loadlib.o \
+ util/lua/lobject.o \
+ util/lua/lopcodes.o \
+ util/lua/loslib.o \
+ util/lua/lparser.o \
+ util/lua/lstate.o \
+ util/lua/lstring.o \
+ util/lua/lstrlib.o \
+ util/lua/ltable.o \
+ util/lua/ltablib.o \
+ util/lua/ltm.o \
+ util/lua/lua.o \
+ util/lua/luac.o \
+ util/lua/lundump.o \
+ util/lua/lvm.o \
+ util/lua/lzio.o \
+ util/lua/print.o \
util/pluto/pdep.o \
util/pluto/pluto.o \
util/pluto/plzio.o
+%.o: %.c
+ $(QUIET)$(MKDIR) $(*D)/$(DEPDIR)
+ $(QUIET_CXX)$(CXX) $(CXX_UPDATE_DEP_FLAG) $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
+
# This module can be built as a plugin
ifeq ($(ENABLE_SWORD25), DYNAMIC_PLUGIN)
PLUGIN := 1
diff --git a/engines/sword25/package/packagemanager_script.cpp b/engines/sword25/package/packagemanager_script.cpp
index 803c346fdb..a7c845d32f 100644
--- a/engines/sword25/package/packagemanager_script.cpp
+++ b/engines/sword25/package/packagemanager_script.cpp
@@ -217,18 +217,18 @@ static int FileExists(lua_State *L) {
static const char *PACKAGE_LIBRARY_NAME = "Package";
static const luaL_reg PACKAGE_FUNCTIONS[] = {
- "LoadPackage", LoadPackage,
- "LoadDirectoryAsPackage", LoadDirectoryAsPackage,
- "GetCurrentDirectory", GetCurrentDirectory,
- "ChangeDirectory", ChangeDirectory,
- "GetAbsolutePath", GetAbsolutePath,
- "GetFileSize", GetFileSize,
- "GetFileType", GetFileType,
- "FindFiles", FindFiles,
- "FindDirectories", FindDirectories,
- "GetFileAsString", GetFileAsString,
- "FileExists", FileExists,
- 0, 0
+ {"LoadPackage", LoadPackage},
+ {"LoadDirectoryAsPackage", LoadDirectoryAsPackage},
+ {"GetCurrentDirectory", GetCurrentDirectory},
+ {"ChangeDirectory", ChangeDirectory},
+ {"GetAbsolutePath", GetAbsolutePath},
+ {"GetFileSize", GetFileSize},
+ {"GetFileType", GetFileType},
+ {"FindFiles", FindFiles},
+ {"FindDirectories", FindDirectories},
+ {"GetFileAsString", GetFileAsString},
+ {"FileExists", FileExists},
+ {0, 0}
};
// -----------------------------------------------------------------------------
diff --git a/engines/sword25/sfx/soundengine.cpp b/engines/sword25/sfx/soundengine.cpp
index c3d845ad50..039ca55cdd 100644
--- a/engines/sword25/sfx/soundengine.cpp
+++ b/engines/sword25/sfx/soundengine.cpp
@@ -34,17 +34,15 @@
#define BS_LOG_PREFIX "SOUNDENGINE"
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
#include "sword25/sfx/soundengine.h"
-// -----------------------------------------------------------------------------
+namespace Sword25 {
BS_SoundEngine::BS_SoundEngine(BS_Kernel *pKernel) : BS_ResourceService(pKernel) {
if (!_RegisterScriptBindings())
BS_LOG_ERRORLN("Script bindings could not be registered.");
else
BS_LOGLN("Script bindings registered.");
-} \ No newline at end of file
+}
+
+} // End of namespace Sword25
diff --git a/engines/sword25/sfx/soundengine_script.cpp b/engines/sword25/sfx/soundengine_script.cpp
index ecffd2b42a..4df80b07cb 100644
--- a/engines/sword25/sfx/soundengine_script.cpp
+++ b/engines/sword25/sfx/soundengine_script.cpp
@@ -43,6 +43,7 @@
#include "sword25/sfx/soundengine.h"
+namespace Sword25 {
// -----------------------------------------------------------------------------
static int Init(lua_State *L) {
@@ -155,7 +156,7 @@ static int ResumeLayer(lua_State *L) {
// -----------------------------------------------------------------------------
-static void ProcessPlayParams(lua_State *L, std::string &FileName, BS_SoundEngine::SOUND_TYPES &Type, float &Volume, float &Pan, bool &Loop, int &LoopStart, int &LoopEnd, unsigned int &Layer) {
+static void ProcessPlayParams(lua_State *L, Common::String &FileName, BS_SoundEngine::SOUND_TYPES &Type, float &Volume, float &Pan, bool &Loop, int &LoopStart, int &LoopEnd, unsigned int &Layer) {
FileName = luaL_checkstring(L, 1);
Type = static_cast<BS_SoundEngine::SOUND_TYPES>(static_cast<unsigned int>(luaL_checknumber(L, 2)));
@@ -185,7 +186,7 @@ static int PlaySound(lua_State *L) {
BS_SoundEngine *pSfx = static_cast<BS_SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx"));
BS_ASSERT(pSfx);
- std::string FileName;
+ Common::String FileName;
BS_SoundEngine::SOUND_TYPES Type;
float Volume;
float Pan;
@@ -206,7 +207,7 @@ static int PlaySoundEx(lua_State *L) {
BS_SoundEngine *pSfx = static_cast<BS_SoundEngine *>(BS_Kernel::GetInstance()->GetService("sfx"));
BS_ASSERT(pSfx);
- std::string FileName;
+ Common::String FileName;
BS_SoundEngine::SOUND_TYPES Type;
float Volume;
float Pan;
@@ -343,33 +344,33 @@ static int GetSoundPanning(lua_State *L) {
static const char *SFX_LIBRARY_NAME = "Sfx";
static const luaL_reg SFX_FUNCTIONS[] = {
- "Init", Init,
- "Update", Update,
- "__SetVolume", SetVolume,
- "__GetVolume", GetVolume,
- "PauseAll", PauseAll,
- "ResumeAll", ResumeAll,
- "PauseLayer", PauseLayer,
- "ResumeLayer", ResumeLayer,
- "__PlaySound", PlaySound,
- "__PlaySoundEx", PlaySoundEx,
- "__SetSoundVolume", SetSoundVolume,
- "__SetSoundPanning", SetSoundPanning,
- "__PauseSound", PauseSound,
- "__ResumeSound", ResumeSound,
- "__StopSound", StopSound,
- "__IsSoundPaused", IsSoundPaused,
- "__IsSoundPlaying", IsSoundPlaying,
- "__GetSoundVolume", GetSoundVolume,
- "__GetSoundPanning", GetSoundPanning,
- 0, 0,
+ {"Init", Init},
+ {"Update", Update},
+ {"__SetVolume", SetVolume},
+ {"__GetVolume", GetVolume},
+ {"PauseAll", PauseAll},
+ {"ResumeAll", ResumeAll},
+ {"PauseLayer", PauseLayer},
+ {"ResumeLayer", ResumeLayer},
+ {"__PlaySound", PlaySound},
+ {"__PlaySoundEx", PlaySoundEx},
+ {"__SetSoundVolume", SetSoundVolume},
+ {"__SetSoundPanning", SetSoundPanning},
+ {"__PauseSound", PauseSound},
+ {"__ResumeSound", ResumeSound},
+ {"__StopSound", StopSound},
+ {"__IsSoundPaused", IsSoundPaused},
+ {"__IsSoundPlaying", IsSoundPlaying},
+ {"__GetSoundVolume", GetSoundVolume},
+ {"__GetSoundPanning", GetSoundPanning},
+ {0, 0}
};
static const lua_constant_reg SFX_CONSTANTS[] = {
- "MUSIC", BS_SoundEngine::MUSIC,
- "SPEECH", BS_SoundEngine::SPEECH,
- "SFX", BS_SoundEngine::SFX,
- 0, 0,
+ {"MUSIC", BS_SoundEngine::MUSIC},
+ {"SPEECH", BS_SoundEngine::SPEECH},
+ {"SFX", BS_SoundEngine::SFX},
+ {0, 0}
};
// -----------------------------------------------------------------------------
@@ -387,3 +388,5 @@ bool BS_SoundEngine::_RegisterScriptBindings() {
return true;
}
+
+} // End of namespace Sword25
diff --git a/engines/sword25/util/lua/luaconf.h b/engines/sword25/util/lua/luaconf.h
index 803a3f9e7b..d4eb2c9cd4 100644
--- a/engines/sword25/util/lua/luaconf.h
+++ b/engines/sword25/util/lua/luaconf.h
@@ -603,7 +603,7 @@ union luai_Cast { double l_d; long l_l; };
** compiling as C++ code, with _longjmp/_setjmp when asked to use them,
** and with longjmp/setjmp otherwise.
*/
-#if defined(__cplusplus)
+#if 0 /* defined(__cplusplus) */
/* C++ exceptions */
#define LUAI_THROW(L,c) throw(c)
#define LUAI_TRY(L,c,a) try { a } catch(...) \