From a683a420a9e43705c972b5e74d55e319729e1a81 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 29 Jul 2010 19:53:02 +0000 Subject: SWORD25: Importing original sources svn-id: r53171 --- engines/sword25/gfx/graphicengine.cpp | 218 ++++++++++++++++++++++++++++++++++ 1 file changed, 218 insertions(+) create mode 100755 engines/sword25/gfx/graphicengine.cpp (limited to 'engines/sword25/gfx/graphicengine.cpp') diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp new file mode 100755 index 0000000000..b8ad3a04bd --- /dev/null +++ b/engines/sword25/gfx/graphicengine.cpp @@ -0,0 +1,218 @@ +// ----------------------------------------------------------------------------- +// This file is part of Broken Sword 2.5 +// Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdörfer +// +// Broken Sword 2.5 is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// Broken Sword 2.5 is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Broken Sword 2.5; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// ----------------------------------------------------------------------------- + +#define BS_LOG_PREFIX "GRAPHICENGINE" + +#include "image/image.h" +#include "screenshot.h" +#include "kernel/memlog_off.h" +#include +#include +#include "kernel/memlog_on.h" +#include "kernel/inputpersistenceblock.h" +#include "kernel/outputpersistenceblock.h" + +extern "C" +{ +#include +#include +} + +using namespace std; + +// ----------------------------------------------------------------------------- +// Constants +// ----------------------------------------------------------------------------- + +static const unsigned int FRAMETIME_SAMPLE_COUNT = 5; // Anzahl der Framezeiten über die, die Framezeit gemittelt wird + +// Includes +// ----------------------------------------------------------------------------- + +#include "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_LastFrameDuration(0), + m_TimerActive(true), + m_FrameTimeSamples(FRAMETIME_SAMPLE_COUNT, 0), + m_FrameTimeSampleSlot(0), + m_RepaintedPixels(0), + BS_ResourceService(pKernel) +{ + if (!RegisterScriptBindings()) + BS_LOG_ERRORLN("Script bindings could not be registered."); + else + BS_LOGLN("Script bindings registered."); +} + +// ----------------------------------------------------------------------------- + +void BS_GraphicEngine::UpdateLastFrameDuration() +{ + // Aktuelle Zeit holen + uint64_t CurrentTime = BS_Kernel::GetInstance()->GetMicroTicks(); + + // Verstrichene Zeit seit letztem Frame berechnen und zu große Zeitsprünge ( > 250 msek.) unterbinden + // (kann vorkommen bei geladenen Spielständen, während des Debuggings oder Hardwareungenauigkeiten) + m_FrameTimeSamples[m_FrameTimeSampleSlot] = static_cast(CurrentTime - m_LastTimeStamp); + if (m_FrameTimeSamples[m_FrameTimeSampleSlot] > 250000) m_FrameTimeSamples[m_FrameTimeSampleSlot] = 250000; + m_FrameTimeSampleSlot = (m_FrameTimeSampleSlot + 1) % FRAMETIME_SAMPLE_COUNT; + + // Die Framezeit wird über mehrere Frames gemittelt um Ausreisser zu eliminieren + std::vector::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; + + // _LastTimeStamp auf die Zeit des aktuellen Frames setzen + m_LastTimeStamp = CurrentTime; +} + +// ----------------------------------------------------------------------------- + +namespace +{ + bool DoSaveScreenshot(BS_GraphicEngine & GraphicEngine, const std::string & Filename, bool Thumbnail) + { + unsigned int Width; + unsigned int Height; + vector Data; + if (!GraphicEngine.GetScreenshot(Width, Height, Data)) + { + BS_LOG_ERRORLN("Call to GetScreenshot() failed. Cannot save screenshot."); + return false; + } + + unsigned int test = Data.size(); + + if (Thumbnail) + return BS_Screenshot::SaveThumbnailToFile(Width, Height, Data, Filename); + else + return BS_Screenshot::SaveToFile(Width, Height, Data, Filename); + } +} + +// ----------------------------------------------------------------------------- + +bool BS_GraphicEngine::SaveScreenshot(const std::string & Filename) +{ + return DoSaveScreenshot(*this, Filename, false); +} + +// ----------------------------------------------------------------------------- + +bool BS_GraphicEngine::SaveThumbnailScreenshot( const std::string & Filename ) +{ + return DoSaveScreenshot(*this, Filename, true); +} + +// ----------------------------------------------------------------------------- + +void BS_GraphicEngine::ARGBColorToLuaColor(lua_State * L, unsigned int Color) +{ + lua_Number Components[4] = + { + (Color >> 16) & 0xff, // Rot + (Color >> 8) & 0xff, // Grün + Color & 0xff, // Blau + Color >> 24, // Alpha + }; + + lua_newtable(L); + + for (unsigned int i = 1; i <= 4; i++) + { + lua_pushnumber(L, i); + lua_pushnumber(L, Components[i - 1]); + lua_settable(L, -3); + } +} + +// ----------------------------------------------------------------------------- + +unsigned int BS_GraphicEngine::LuaColorToARGBColor(lua_State * L, int StackIndex) +{ +#ifdef DEBUG + int __startStackDepth = lua_gettop(L); +#endif + + // Sicherstellen, dass wir wirklich eine Tabelle betrachten + luaL_checktype(L, StackIndex, LUA_TTABLE); + // Größe der Tabelle auslesen + unsigned int n = luaL_getn(L, StackIndex); + // RGB oder RGBA Farben werden unterstützt und sonst keine + if (n != 3 && n != 4) luaL_argcheck(L, 0, StackIndex, "at least 3 of the 4 color components have to be specified"); + + // Rote Farbkomponente auslesen + lua_rawgeti(L, StackIndex, 1); + unsigned int Red = static_cast(lua_tonumber(L, -1)); + if (!lua_isnumber(L, -1) || Red >= 256) luaL_argcheck(L, 0, StackIndex, "red color component must be an integer between 0 and 255"); + lua_pop(L, 1); + + // Grüne Farbkomponente auslesen + lua_rawgeti(L, StackIndex, 2); + unsigned int Green = static_cast(lua_tonumber(L, -1)); + if (!lua_isnumber(L, -1) || Green >= 256) luaL_argcheck(L, 0, StackIndex, "green color component must be an integer between 0 and 255"); + lua_pop(L, 1); + + // Blaue Farbkomponente auslesen + lua_rawgeti(L, StackIndex, 3); + unsigned int Blue = static_cast(lua_tonumber(L, -1)); + if (!lua_isnumber(L, -1) || Blue >= 256) luaL_argcheck(L, 0, StackIndex, "blue color component must be an integer between 0 and 255"); + lua_pop(L, 1); + + // Alpha Farbkomponente auslesen + unsigned int Alpha = 0xff; + if (n == 4) + { + lua_rawgeti(L, StackIndex, 4); + Alpha = static_cast(lua_tonumber(L, -1)); + if (!lua_isnumber(L, -1) || Alpha >= 256) luaL_argcheck(L, 0, StackIndex, "alpha color component must be an integer between 0 and 255"); + lua_pop(L, 1); + } + +#ifdef DEBUG + BS_ASSERT(__startStackDepth == lua_gettop(L)); +#endif + + return (Alpha << 24) | (Red << 16) | (Green << 8) | Blue; +} + +// ----------------------------------------------------------------------------- + +bool BS_GraphicEngine::Persist(BS_OutputPersistenceBlock & Writer) +{ + Writer.Write(m_TimerActive); + return true; +} + +// ----------------------------------------------------------------------------- + +bool BS_GraphicEngine::Unpersist(BS_InputPersistenceBlock & Reader) +{ + Reader.Read(m_TimerActive); + return Reader.IsGood(); +} -- cgit v1.2.3 From e8bca8b8fe0f80e0d5053b190840b034f50ae163 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 30 Jul 2010 09:02:39 +0000 Subject: SWORD25: Fixed rest of the include paths svn-id: r53181 --- engines/sword25/gfx/graphicengine.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'engines/sword25/gfx/graphicengine.cpp') diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp index b8ad3a04bd..ea03e7f652 100755 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -19,19 +19,19 @@ #define BS_LOG_PREFIX "GRAPHICENGINE" -#include "image/image.h" -#include "screenshot.h" -#include "kernel/memlog_off.h" +#include "sword25/image/image.h" +#include "sword25/gfx/screenshot.h" +#include "sword25/kernel/memlog_off.h" #include #include -#include "kernel/memlog_on.h" -#include "kernel/inputpersistenceblock.h" -#include "kernel/outputpersistenceblock.h" +#include "sword25/kernel/memlog_on.h" +#include "sword25/kernel/inputpersistenceblock.h" +#include "sword25/kernel/outputpersistenceblock.h" extern "C" { -#include -#include +#include "sword25/util/lua/lua.h" +#include "sword25/util/lua/lauxlib.h" } using namespace std; @@ -45,7 +45,7 @@ static const unsigned int FRAMETIME_SAMPLE_COUNT = 5; // Anzahl der Framezeiten // Includes // ----------------------------------------------------------------------------- -#include "graphicengine.h" +#include "sword25/gfx/graphicengine.h" // ----------------------------------------------------------------------------- -- cgit v1.2.3 From 69b618a8f5517c609a5e94d9609dc27aea2ad573 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 30 Jul 2010 12:19:13 +0000 Subject: SWORD25: Compilation fixes Majority of files now compile under Windoze. svn-id: r53182 --- engines/sword25/gfx/graphicengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/sword25/gfx/graphicengine.cpp') diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp index ea03e7f652..25e07d190d 100755 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -19,7 +19,7 @@ #define BS_LOG_PREFIX "GRAPHICENGINE" -#include "sword25/image/image.h" +#include "sword25/gfx/image/image.h" #include "sword25/gfx/screenshot.h" #include "sword25/kernel/memlog_off.h" #include -- cgit v1.2.3 From 293bf95c01f76c8d812a300eb038854f1246ab3d Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 31 Jul 2010 09:53:02 +0000 Subject: SWORD25: Replacing headers with ScummVM ones plus original (C) svn-id: r53188 --- engines/sword25/gfx/graphicengine.cpp | 51 ++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 18 deletions(-) mode change 100755 => 100644 engines/sword25/gfx/graphicengine.cpp (limited to 'engines/sword25/gfx/graphicengine.cpp') diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp old mode 100755 new mode 100644 index 25e07d190d..be379ecf68 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -1,21 +1,36 @@ -// ----------------------------------------------------------------------------- -// This file is part of Broken Sword 2.5 -// Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdörfer -// -// Broken Sword 2.5 is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// Broken Sword 2.5 is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Broken Sword 2.5; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -// ----------------------------------------------------------------------------- +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +/* + * This code is based on Broken Sword 2.5 engine + * + * Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer + * + * Licensed under GNU GPL v2 + * + */ #define BS_LOG_PREFIX "GRAPHICENGINE" -- cgit v1.2.3 From de0fe1db4939bbb787de60231dd30a7b5391f269 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 5 Aug 2010 12:48:19 +0000 Subject: SWORD25: Mass-putting of all files in gfx/ into Sword25 namespace svn-id: r53214 --- engines/sword25/gfx/graphicengine.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'engines/sword25/gfx/graphicengine.cpp') diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp index be379ecf68..cd35718d5e 100644 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -49,6 +49,8 @@ extern "C" #include "sword25/util/lua/lauxlib.h" } +namespace Sword25 { + using namespace std; // ----------------------------------------------------------------------------- @@ -231,3 +233,5 @@ bool BS_GraphicEngine::Unpersist(BS_InputPersistenceBlock & Reader) Reader.Read(m_TimerActive); return Reader.IsGood(); } + +} // End of namespace Sword25 -- cgit v1.2.3 From 6dcf9f0ee557e692df3c70a263ca35068ff45380 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 6 Aug 2010 10:59:35 +0000 Subject: SWORD25: std::string -> Common::String in gfx/ svn-id: r53218 --- engines/sword25/gfx/graphicengine.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines/sword25/gfx/graphicengine.cpp') diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp index cd35718d5e..f8a3a1a44a 100644 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -112,7 +112,7 @@ void BS_GraphicEngine::UpdateLastFrameDuration() namespace { - bool DoSaveScreenshot(BS_GraphicEngine & GraphicEngine, const std::string & Filename, bool Thumbnail) + bool DoSaveScreenshot(BS_GraphicEngine & GraphicEngine, const Common::String & Filename, bool Thumbnail) { unsigned int Width; unsigned int Height; @@ -134,14 +134,14 @@ namespace // ----------------------------------------------------------------------------- -bool BS_GraphicEngine::SaveScreenshot(const std::string & Filename) +bool BS_GraphicEngine::SaveScreenshot(const Common::String & Filename) { return DoSaveScreenshot(*this, Filename, false); } // ----------------------------------------------------------------------------- -bool BS_GraphicEngine::SaveThumbnailScreenshot( const std::string & Filename ) +bool BS_GraphicEngine::SaveThumbnailScreenshot( const Common::String & Filename ) { return DoSaveScreenshot(*this, Filename, true); } -- cgit v1.2.3 From a17ec87b7dd09e7b251a3f578d1f788917550451 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 6 Aug 2010 10:59:50 +0000 Subject: SWORD25: Number of compilation and warning fixes svn-id: r53219 --- engines/sword25/gfx/graphicengine.cpp | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'engines/sword25/gfx/graphicengine.cpp') 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::const_iterator it = m_FrameTimeSamples.begin(); + Common::Array::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 Data; + Common::Array Data; if (!GraphicEngine.GetScreenshot(Width, Height, Data)) { BS_LOG_ERRORLN("Call to GetScreenshot() failed. Cannot save screenshot."); -- cgit v1.2.3 From 47904bc7b2992189bb554833f00a79ff0fea9fb8 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 6 Aug 2010 13:13:25 +0000 Subject: SWORD25: Mass-astyle. svn-id: r53222 --- engines/sword25/gfx/graphicengine.cpp | 84 +++++++++++++++-------------------- 1 file changed, 35 insertions(+), 49 deletions(-) (limited to 'engines/sword25/gfx/graphicengine.cpp') diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp index c35fba4159..075bf9757a 100644 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -23,7 +23,7 @@ * */ -/* +/* * This code is based on Broken Sword 2.5 engine * * Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer @@ -58,20 +58,19 @@ namespace Sword25 { using namespace std; using namespace Lua; -static const unsigned int FRAMETIME_SAMPLE_COUNT = 5; // Anzahl der Framezeiten über die, die Framezeit gemittelt wird +static const unsigned int FRAMETIME_SAMPLE_COUNT = 5; // Anzahl der Framezeiten über die, die Framezeit gemittelt wird -BS_GraphicEngine::BS_GraphicEngine(BS_Kernel * pKernel) : +BS_GraphicEngine::BS_GraphicEngine(BS_Kernel *pKernel) : m_Width(0), m_Height(0), m_BitDepth(0), m_Windowed(0), - m_LastTimeStamp((uint64)-1), // 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_FrameTimeSampleSlot(0), m_RepaintedPixels(0), - BS_ResourceService(pKernel) -{ + BS_ResourceService(pKernel) { for (int i = 0; i < FRAMETIME_SAMPLE_COUNT; i++) m_FrameTimeSamples[i] = 0; @@ -83,8 +82,7 @@ BS_GraphicEngine::BS_GraphicEngine(BS_Kernel * pKernel) : // ----------------------------------------------------------------------------- -void BS_GraphicEngine::UpdateLastFrameDuration() -{ +void BS_GraphicEngine::UpdateLastFrameDuration() { // Aktuelle Zeit holen uint64_t CurrentTime = BS_Kernel::GetInstance()->GetMicroTicks(); @@ -106,58 +104,50 @@ void BS_GraphicEngine::UpdateLastFrameDuration() // ----------------------------------------------------------------------------- -namespace -{ - bool DoSaveScreenshot(BS_GraphicEngine & GraphicEngine, const Common::String & Filename, bool Thumbnail) - { - unsigned int Width; - unsigned int Height; - Common::Array Data; - if (!GraphicEngine.GetScreenshot(Width, Height, Data)) - { - BS_LOG_ERRORLN("Call to GetScreenshot() failed. Cannot save screenshot."); - return false; - } - - unsigned int test = Data.size(); - - if (Thumbnail) - return BS_Screenshot::SaveThumbnailToFile(Width, Height, Data, Filename); - else - return BS_Screenshot::SaveToFile(Width, Height, Data, Filename); +namespace { +bool DoSaveScreenshot(BS_GraphicEngine &GraphicEngine, const Common::String &Filename, bool Thumbnail) { + unsigned int Width; + unsigned int Height; + Common::Array Data; + if (!GraphicEngine.GetScreenshot(Width, Height, Data)) { + BS_LOG_ERRORLN("Call to GetScreenshot() failed. Cannot save screenshot."); + return false; } + + unsigned int test = Data.size(); + + if (Thumbnail) + return BS_Screenshot::SaveThumbnailToFile(Width, Height, Data, Filename); + else + return BS_Screenshot::SaveToFile(Width, Height, Data, Filename); +} } // ----------------------------------------------------------------------------- -bool BS_GraphicEngine::SaveScreenshot(const Common::String & Filename) -{ +bool BS_GraphicEngine::SaveScreenshot(const Common::String &Filename) { return DoSaveScreenshot(*this, Filename, false); } // ----------------------------------------------------------------------------- -bool BS_GraphicEngine::SaveThumbnailScreenshot( const Common::String & Filename ) -{ +bool BS_GraphicEngine::SaveThumbnailScreenshot(const Common::String &Filename) { return DoSaveScreenshot(*this, Filename, true); } // ----------------------------------------------------------------------------- -void BS_GraphicEngine::ARGBColorToLuaColor(lua_State * L, unsigned int Color) -{ - lua_Number Components[4] = - { - (Color >> 16) & 0xff, // Rot - (Color >> 8) & 0xff, // Grün - Color & 0xff, // Blau - Color >> 24, // Alpha +void BS_GraphicEngine::ARGBColorToLuaColor(lua_State *L, unsigned int Color) { + lua_Number Components[4] = { + (Color >> 16) & 0xff, // Rot + (Color >> 8) & 0xff, // Grün + Color & 0xff, // Blau + Color >> 24, // Alpha }; lua_newtable(L); - for (unsigned int i = 1; i <= 4; i++) - { + for (unsigned int i = 1; i <= 4; i++) { lua_pushnumber(L, i); lua_pushnumber(L, Components[i - 1]); lua_settable(L, -3); @@ -166,8 +156,7 @@ void BS_GraphicEngine::ARGBColorToLuaColor(lua_State * L, unsigned int Color) // ----------------------------------------------------------------------------- -unsigned int BS_GraphicEngine::LuaColorToARGBColor(lua_State * L, int StackIndex) -{ +unsigned int BS_GraphicEngine::LuaColorToARGBColor(lua_State *L, int StackIndex) { #ifdef DEBUG int __startStackDepth = lua_gettop(L); #endif @@ -199,8 +188,7 @@ unsigned int BS_GraphicEngine::LuaColorToARGBColor(lua_State * L, int StackIndex // Alpha Farbkomponente auslesen unsigned int Alpha = 0xff; - if (n == 4) - { + if (n == 4) { lua_rawgeti(L, StackIndex, 4); Alpha = static_cast(lua_tonumber(L, -1)); if (!lua_isnumber(L, -1) || Alpha >= 256) luaL_argcheck(L, 0, StackIndex, "alpha color component must be an integer between 0 and 255"); @@ -216,16 +204,14 @@ unsigned int BS_GraphicEngine::LuaColorToARGBColor(lua_State * L, int StackIndex // ----------------------------------------------------------------------------- -bool BS_GraphicEngine::Persist(BS_OutputPersistenceBlock & Writer) -{ +bool BS_GraphicEngine::Persist(BS_OutputPersistenceBlock &Writer) { Writer.Write(m_TimerActive); return true; } // ----------------------------------------------------------------------------- -bool BS_GraphicEngine::Unpersist(BS_InputPersistenceBlock & Reader) -{ +bool BS_GraphicEngine::Unpersist(BS_InputPersistenceBlock &Reader) { Reader.Read(m_TimerActive); return Reader.IsGood(); } -- cgit v1.2.3 From ab85540a1bb59d7f69b89868805d1fe2a2adc89c Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 7 Aug 2010 20:09:40 +0000 Subject: SWORD25: More compilation fixes Now almost everything compiles fine. Several files were tricked and there are references to tinyxml.h and of course fmod and agg. OpenGL gfx renderer removed from the project, we need to create our own from the scratch. svn-id: r53224 --- engines/sword25/gfx/graphicengine.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'engines/sword25/gfx/graphicengine.cpp') diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp index 075bf9757a..f20d858707 100644 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -108,14 +108,12 @@ namespace { bool DoSaveScreenshot(BS_GraphicEngine &GraphicEngine, const Common::String &Filename, bool Thumbnail) { unsigned int Width; unsigned int Height; - Common::Array Data; - if (!GraphicEngine.GetScreenshot(Width, Height, Data)) { + byte *Data; + if (!GraphicEngine.GetScreenshot(Width, Height, &Data)) { BS_LOG_ERRORLN("Call to GetScreenshot() failed. Cannot save screenshot."); return false; } - unsigned int test = Data.size(); - if (Thumbnail) return BS_Screenshot::SaveThumbnailToFile(Width, Height, Data, Filename); else -- cgit v1.2.3 From f4024d7d14a0101e88ca2e49d97c0da353a893d9 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 14 Aug 2010 22:32:23 +0000 Subject: SWORD25: Fix initialization. svn-id: r53245 --- engines/sword25/gfx/graphicengine.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'engines/sword25/gfx/graphicengine.cpp') diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp index f20d858707..150c87366e 100644 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -71,8 +71,7 @@ BS_GraphicEngine::BS_GraphicEngine(BS_Kernel *pKernel) : m_FrameTimeSampleSlot(0), m_RepaintedPixels(0), BS_ResourceService(pKernel) { - for (int i = 0; i < FRAMETIME_SAMPLE_COUNT; i++) - m_FrameTimeSamples[i] = 0; + m_FrameTimeSamples.resize(FRAMETIME_SAMPLE_COUNT); if (!RegisterScriptBindings()) BS_LOG_ERRORLN("Script bindings could not be registered."); -- cgit v1.2.3 From 485ff15d23b3ae9545f5c9df794f1326185eae7a Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 18 Aug 2010 10:52:24 +0000 Subject: SWORD25: Mass-eliminating of BS_ prefix in fmv/ and gfx/ svn-id: r53258 --- engines/sword25/gfx/graphicengine.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'engines/sword25/gfx/graphicengine.cpp') diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp index 150c87366e..1f7f253a53 100644 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -60,7 +60,7 @@ using namespace Lua; static const unsigned int FRAMETIME_SAMPLE_COUNT = 5; // Anzahl der Framezeiten über die, die Framezeit gemittelt wird -BS_GraphicEngine::BS_GraphicEngine(BS_Kernel *pKernel) : +GraphicEngine::GraphicEngine(BS_Kernel *pKernel) : m_Width(0), m_Height(0), m_BitDepth(0), @@ -81,7 +81,7 @@ BS_GraphicEngine::BS_GraphicEngine(BS_Kernel *pKernel) : // ----------------------------------------------------------------------------- -void BS_GraphicEngine::UpdateLastFrameDuration() { +void GraphicEngine::UpdateLastFrameDuration() { // Aktuelle Zeit holen uint64_t CurrentTime = BS_Kernel::GetInstance()->GetMicroTicks(); @@ -104,7 +104,7 @@ void BS_GraphicEngine::UpdateLastFrameDuration() { // ----------------------------------------------------------------------------- namespace { -bool DoSaveScreenshot(BS_GraphicEngine &GraphicEngine, const Common::String &Filename, bool Thumbnail) { +bool DoSaveScreenshot(GraphicEngine &GraphicEngine, const Common::String &Filename, bool Thumbnail) { unsigned int Width; unsigned int Height; byte *Data; @@ -114,27 +114,27 @@ bool DoSaveScreenshot(BS_GraphicEngine &GraphicEngine, const Common::String &Fil } if (Thumbnail) - return BS_Screenshot::SaveThumbnailToFile(Width, Height, Data, Filename); + return Screenshot::SaveThumbnailToFile(Width, Height, Data, Filename); else - return BS_Screenshot::SaveToFile(Width, Height, Data, Filename); + return Screenshot::SaveToFile(Width, Height, Data, Filename); } } // ----------------------------------------------------------------------------- -bool BS_GraphicEngine::SaveScreenshot(const Common::String &Filename) { +bool GraphicEngine::SaveScreenshot(const Common::String &Filename) { return DoSaveScreenshot(*this, Filename, false); } // ----------------------------------------------------------------------------- -bool BS_GraphicEngine::SaveThumbnailScreenshot(const Common::String &Filename) { +bool GraphicEngine::SaveThumbnailScreenshot(const Common::String &Filename) { return DoSaveScreenshot(*this, Filename, true); } // ----------------------------------------------------------------------------- -void BS_GraphicEngine::ARGBColorToLuaColor(lua_State *L, unsigned int Color) { +void GraphicEngine::ARGBColorToLuaColor(lua_State *L, unsigned int Color) { lua_Number Components[4] = { (Color >> 16) & 0xff, // Rot (Color >> 8) & 0xff, // Grün @@ -153,7 +153,7 @@ void BS_GraphicEngine::ARGBColorToLuaColor(lua_State *L, unsigned int Color) { // ----------------------------------------------------------------------------- -unsigned int BS_GraphicEngine::LuaColorToARGBColor(lua_State *L, int StackIndex) { +unsigned int GraphicEngine::LuaColorToARGBColor(lua_State *L, int StackIndex) { #ifdef DEBUG int __startStackDepth = lua_gettop(L); #endif @@ -201,14 +201,14 @@ unsigned int BS_GraphicEngine::LuaColorToARGBColor(lua_State *L, int StackIndex) // ----------------------------------------------------------------------------- -bool BS_GraphicEngine::Persist(BS_OutputPersistenceBlock &Writer) { +bool GraphicEngine::Persist(BS_OutputPersistenceBlock &Writer) { Writer.Write(m_TimerActive); return true; } // ----------------------------------------------------------------------------- -bool BS_GraphicEngine::Unpersist(BS_InputPersistenceBlock &Reader) { +bool GraphicEngine::Unpersist(BS_InputPersistenceBlock &Reader) { Reader.Read(m_TimerActive); return Reader.IsGood(); } -- cgit v1.2.3 From b01994a53bbc96da907a4c28934e644184291017 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 18 Aug 2010 12:58:22 +0000 Subject: SWORD25: removed BS_ prefix from rest of the classes. The things which are intentionally left with the prefix: BS_LOG, BS_ASSERT, BS_Rect, BS_String. svn-id: r53261 --- engines/sword25/gfx/graphicengine.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'engines/sword25/gfx/graphicengine.cpp') diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp index 1f7f253a53..d51157e4ac 100644 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -60,7 +60,7 @@ using namespace Lua; static const unsigned int FRAMETIME_SAMPLE_COUNT = 5; // Anzahl der Framezeiten über die, die Framezeit gemittelt wird -GraphicEngine::GraphicEngine(BS_Kernel *pKernel) : +GraphicEngine::GraphicEngine(Kernel *pKernel) : m_Width(0), m_Height(0), m_BitDepth(0), @@ -70,7 +70,7 @@ GraphicEngine::GraphicEngine(BS_Kernel *pKernel) : m_TimerActive(true), m_FrameTimeSampleSlot(0), m_RepaintedPixels(0), - BS_ResourceService(pKernel) { + ResourceService(pKernel) { m_FrameTimeSamples.resize(FRAMETIME_SAMPLE_COUNT); if (!RegisterScriptBindings()) @@ -83,7 +83,7 @@ GraphicEngine::GraphicEngine(BS_Kernel *pKernel) : void GraphicEngine::UpdateLastFrameDuration() { // Aktuelle Zeit holen - uint64_t CurrentTime = BS_Kernel::GetInstance()->GetMicroTicks(); + uint64_t CurrentTime = Kernel::GetInstance()->GetMicroTicks(); // Verstrichene Zeit seit letztem Frame berechnen und zu große Zeitsprünge ( > 250 msek.) unterbinden // (kann vorkommen bei geladenen Spielständen, während des Debuggings oder Hardwareungenauigkeiten) @@ -201,14 +201,14 @@ unsigned int GraphicEngine::LuaColorToARGBColor(lua_State *L, int StackIndex) { // ----------------------------------------------------------------------------- -bool GraphicEngine::Persist(BS_OutputPersistenceBlock &Writer) { +bool GraphicEngine::Persist(OutputPersistenceBlock &Writer) { Writer.Write(m_TimerActive); return true; } // ----------------------------------------------------------------------------- -bool GraphicEngine::Unpersist(BS_InputPersistenceBlock &Reader) { +bool GraphicEngine::Unpersist(InputPersistenceBlock &Reader) { Reader.Read(m_TimerActive); return Reader.IsGood(); } -- cgit v1.2.3 From 3fb0e9383b7da395d2d715c6f1abeb0252cac229 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 18 Aug 2010 12:58:45 +0000 Subject: SWORD25: Removed last traces of STL svn-id: r53262 --- engines/sword25/gfx/graphicengine.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'engines/sword25/gfx/graphicengine.cpp') diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp index d51157e4ac..9aab74f820 100644 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -36,10 +36,6 @@ #include "sword25/gfx/image/image.h" #include "sword25/gfx/screenshot.h" -#include "sword25/kernel/memlog_off.h" -#include -#include -#include "sword25/kernel/memlog_on.h" #include "sword25/kernel/inputpersistenceblock.h" #include "sword25/kernel/outputpersistenceblock.h" #include "sword25/gfx/graphicengine.h" -- cgit v1.2.3 From 9efd8bac2681d8078b08c0136f450cd7fdd55795 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 19 Aug 2010 00:47:59 +0000 Subject: SWORD25: Removed now redundant 'using namespace std' lines svn-id: r53263 --- engines/sword25/gfx/graphicengine.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'engines/sword25/gfx/graphicengine.cpp') diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp index 9aab74f820..046a636951 100644 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -51,7 +51,6 @@ extern "C" namespace Sword25 { -using namespace std; using namespace Lua; static const unsigned int FRAMETIME_SAMPLE_COUNT = 5; // Anzahl der Framezeiten über die, die Framezeit gemittelt wird -- cgit v1.2.3 From 086f5961b6575c50bb386750b6e9a3ed1efdd8cd Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 2 Sep 2010 12:14:04 +0000 Subject: SWORD25: unsigned int -> uint svn-id: r53309 --- engines/sword25/gfx/graphicengine.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'engines/sword25/gfx/graphicengine.cpp') diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp index 046a636951..edbf34ed35 100644 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -53,7 +53,7 @@ namespace Sword25 { using namespace Lua; -static const unsigned int FRAMETIME_SAMPLE_COUNT = 5; // Anzahl der Framezeiten über die, die Framezeit gemittelt wird +static const uint FRAMETIME_SAMPLE_COUNT = 5; // Anzahl der Framezeiten über die, die Framezeit gemittelt wird GraphicEngine::GraphicEngine(Kernel *pKernel) : m_Width(0), @@ -82,13 +82,13 @@ void GraphicEngine::UpdateLastFrameDuration() { // Verstrichene Zeit seit letztem Frame berechnen und zu große Zeitsprünge ( > 250 msek.) unterbinden // (kann vorkommen bei geladenen Spielständen, während des Debuggings oder Hardwareungenauigkeiten) - m_FrameTimeSamples[m_FrameTimeSampleSlot] = static_cast(CurrentTime - m_LastTimeStamp); + m_FrameTimeSamples[m_FrameTimeSampleSlot] = static_cast(CurrentTime - m_LastTimeStamp); if (m_FrameTimeSamples[m_FrameTimeSampleSlot] > 250000) m_FrameTimeSamples[m_FrameTimeSampleSlot] = 250000; m_FrameTimeSampleSlot = (m_FrameTimeSampleSlot + 1) % FRAMETIME_SAMPLE_COUNT; // Die Framezeit wird über mehrere Frames gemittelt um Ausreisser zu eliminieren - Common::Array::const_iterator it = m_FrameTimeSamples.begin(); - unsigned int Sum = *it; + Common::Array::const_iterator it = m_FrameTimeSamples.begin(); + uint Sum = *it; for (it++; it != m_FrameTimeSamples.end(); it++) Sum += *it; m_LastFrameDuration = Sum / FRAMETIME_SAMPLE_COUNT; @@ -100,8 +100,8 @@ void GraphicEngine::UpdateLastFrameDuration() { namespace { bool DoSaveScreenshot(GraphicEngine &GraphicEngine, const Common::String &Filename, bool Thumbnail) { - unsigned int Width; - unsigned int Height; + uint Width; + uint Height; byte *Data; if (!GraphicEngine.GetScreenshot(Width, Height, &Data)) { BS_LOG_ERRORLN("Call to GetScreenshot() failed. Cannot save screenshot."); @@ -129,7 +129,7 @@ bool GraphicEngine::SaveThumbnailScreenshot(const Common::String &Filename) { // ----------------------------------------------------------------------------- -void GraphicEngine::ARGBColorToLuaColor(lua_State *L, unsigned int Color) { +void GraphicEngine::ARGBColorToLuaColor(lua_State *L, uint Color) { lua_Number Components[4] = { (Color >> 16) & 0xff, // Rot (Color >> 8) & 0xff, // Grün @@ -139,7 +139,7 @@ void GraphicEngine::ARGBColorToLuaColor(lua_State *L, unsigned int Color) { lua_newtable(L); - for (unsigned int i = 1; i <= 4; i++) { + for (uint i = 1; i <= 4; i++) { lua_pushnumber(L, i); lua_pushnumber(L, Components[i - 1]); lua_settable(L, -3); @@ -148,7 +148,7 @@ void GraphicEngine::ARGBColorToLuaColor(lua_State *L, unsigned int Color) { // ----------------------------------------------------------------------------- -unsigned int GraphicEngine::LuaColorToARGBColor(lua_State *L, int StackIndex) { +uint GraphicEngine::LuaColorToARGBColor(lua_State *L, int StackIndex) { #ifdef DEBUG int __startStackDepth = lua_gettop(L); #endif @@ -156,33 +156,33 @@ unsigned int GraphicEngine::LuaColorToARGBColor(lua_State *L, int StackIndex) { // Sicherstellen, dass wir wirklich eine Tabelle betrachten luaL_checktype(L, StackIndex, LUA_TTABLE); // Größe der Tabelle auslesen - unsigned int n = luaL_getn(L, StackIndex); + uint n = luaL_getn(L, StackIndex); // RGB oder RGBA Farben werden unterstützt und sonst keine if (n != 3 && n != 4) luaL_argcheck(L, 0, StackIndex, "at least 3 of the 4 color components have to be specified"); // Rote Farbkomponente auslesen lua_rawgeti(L, StackIndex, 1); - unsigned int Red = static_cast(lua_tonumber(L, -1)); + uint Red = static_cast(lua_tonumber(L, -1)); if (!lua_isnumber(L, -1) || Red >= 256) luaL_argcheck(L, 0, StackIndex, "red color component must be an integer between 0 and 255"); lua_pop(L, 1); // Grüne Farbkomponente auslesen lua_rawgeti(L, StackIndex, 2); - unsigned int Green = static_cast(lua_tonumber(L, -1)); + uint Green = static_cast(lua_tonumber(L, -1)); if (!lua_isnumber(L, -1) || Green >= 256) luaL_argcheck(L, 0, StackIndex, "green color component must be an integer between 0 and 255"); lua_pop(L, 1); // Blaue Farbkomponente auslesen lua_rawgeti(L, StackIndex, 3); - unsigned int Blue = static_cast(lua_tonumber(L, -1)); + uint Blue = static_cast(lua_tonumber(L, -1)); if (!lua_isnumber(L, -1) || Blue >= 256) luaL_argcheck(L, 0, StackIndex, "blue color component must be an integer between 0 and 255"); lua_pop(L, 1); // Alpha Farbkomponente auslesen - unsigned int Alpha = 0xff; + uint Alpha = 0xff; if (n == 4) { lua_rawgeti(L, StackIndex, 4); - Alpha = static_cast(lua_tonumber(L, -1)); + Alpha = static_cast(lua_tonumber(L, -1)); if (!lua_isnumber(L, -1) || Alpha >= 256) luaL_argcheck(L, 0, StackIndex, "alpha color component must be an integer between 0 and 255"); lua_pop(L, 1); } -- cgit v1.2.3 From 06bce68860696f67f0a0ac1e9682635081918801 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 2 Sep 2010 17:11:45 +0000 Subject: SWORD25: Comply to the code conventions for several classes svn-id: r53310 --- engines/sword25/gfx/graphicengine.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'engines/sword25/gfx/graphicengine.cpp') diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp index edbf34ed35..f36993784d 100644 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -196,16 +196,16 @@ uint GraphicEngine::LuaColorToARGBColor(lua_State *L, int StackIndex) { // ----------------------------------------------------------------------------- -bool GraphicEngine::Persist(OutputPersistenceBlock &Writer) { - Writer.Write(m_TimerActive); +bool GraphicEngine::persist(OutputPersistenceBlock &writer) { + writer.write(m_TimerActive); return true; } // ----------------------------------------------------------------------------- -bool GraphicEngine::Unpersist(InputPersistenceBlock &Reader) { - Reader.Read(m_TimerActive); - return Reader.IsGood(); +bool GraphicEngine::unpersist(InputPersistenceBlock &reader) { + reader.read(m_TimerActive); + return reader.isGood(); } } // End of namespace Sword25 -- cgit v1.2.3 From 69cae2e7dd5f52801093a4ab069924673f6e307c Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 14 Sep 2010 19:58:25 +0000 Subject: SWORD25: Got rid of OpenGLGfx class svn-id: r53356 --- engines/sword25/gfx/graphicengine.cpp | 358 ++++++++++++++++++++++++++++++++-- 1 file changed, 342 insertions(+), 16 deletions(-) (limited to 'engines/sword25/gfx/graphicengine.cpp') diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp index f36993784d..199ca8a84c 100644 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -34,10 +34,22 @@ #define BS_LOG_PREFIX "GRAPHICENGINE" -#include "sword25/gfx/image/image.h" +#include "common/system.h" + +#include "sword25/gfx/bitmapresource.h" +#include "sword25/gfx/animationresource.h" +#include "sword25/gfx/fontresource.h" +#include "sword25/gfx/panel.h" +#include "sword25/gfx/renderobjectmanager.h" #include "sword25/gfx/screenshot.h" +#include "sword25/gfx/image/vectorimage.h" +#include "sword25/gfx/opengl/glimage.h" +#include "sword25/gfx/opengl/swimage.h" +#include "sword25/package/packagemanager.h" #include "sword25/kernel/inputpersistenceblock.h" #include "sword25/kernel/outputpersistenceblock.h" + + #include "sword25/gfx/graphicengine.h" namespace Lua { @@ -46,9 +58,20 @@ extern "C" #include "sword25/util/lua/lua.h" #include "sword25/util/lua/lauxlib.h" } +} +namespace { +const int BIT_DEPTH = 32; +const int BACKBUFFER_COUNT = 1; +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"); } + namespace Sword25 { using namespace Lua; @@ -74,8 +97,320 @@ GraphicEngine::GraphicEngine(Kernel *pKernel) : BS_LOGLN("Script bindings registered."); } +GraphicEngine::~GraphicEngine() { + _backSurface.free(); +} + +Service *GraphicEngine_CreateObject(Kernel *pKernel) { + return new GraphicEngine(pKernel); +} + +bool GraphicEngine::Init(int Width, int Height, int BitDepth, int BackbufferCount, bool Windowed) { + // Warnung ausgeben, wenn eine nicht unterstützte Bittiefe gewählt wurde. + if (BitDepth != BIT_DEPTH) { + BS_LOG_WARNINGLN("Can't use a bit depth of %d (not supported). Falling back to %d.", BitDepth, BIT_DEPTH); + m_BitDepth = BIT_DEPTH; + } + + // Warnung ausgeben, wenn nicht genau ein Backbuffer gewählt wurde. + if (BackbufferCount != BACKBUFFER_COUNT) { + BS_LOG_WARNINGLN("Can't use %d backbuffers (not supported). Falling back to %d.", BackbufferCount, BACKBUFFER_COUNT); + BackbufferCount = BACKBUFFER_COUNT; + } + + // Parameter in lokale Variablen kopieren + m_Width = Width; + m_Height = Height; + m_BitDepth = BitDepth; + m_Windowed = Windowed; + m_ScreenRect.left = 0; + m_ScreenRect.top = 0; + m_ScreenRect.right = m_Width; + m_ScreenRect.bottom = m_Height; + + _backSurface.create(Width, Height, 4); + + // Standardmäßig ist Vsync an. + SetVsync(true); + + // Layer-Manager initialisieren. + _renderObjectManagerPtr.reset(new RenderObjectManager(Width, Height, BackbufferCount + 1)); + + // Hauptpanel erstellen + m_MainPanelPtr = _renderObjectManagerPtr->getTreeRoot()->addPanel(Width, Height, BS_ARGB(0, 0, 0, 0)); + if (!m_MainPanelPtr.isValid()) return false; + m_MainPanelPtr->setVisible(true); + + return true; +} + +// ----------------------------------------------------------------------------- + +bool GraphicEngine::StartFrame(bool UpdateAll) { + // Berechnen, wie viel Zeit seit dem letzten Frame vergangen ist. + // Dieser Wert kann über GetLastFrameDuration() von Modulen abgefragt werden, die zeitabhängig arbeiten. + UpdateLastFrameDuration(); + + // Den Layer-Manager auf den nächsten Frame vorbereiten + _renderObjectManagerPtr->startFrame(); + + return true; +} + +// ----------------------------------------------------------------------------- + +bool GraphicEngine::EndFrame() { + // Scene zeichnen + _renderObjectManagerPtr->render(); + + g_system->updateScreen(); + + // Debug-Lines zeichnen + if (!m_DebugLines.empty()) { +#if 0 + glEnable(GL_LINE_SMOOTH); + glBegin(GL_LINES); + + Common::Array::const_iterator iter = m_DebugLines.begin(); + for (; iter != m_DebugLines.end(); ++iter) { + const uint &Color = (*iter).Color; + const BS_Vertex &Start = (*iter).Start; + const BS_Vertex &End = (*iter).End; + + glColor4ub((Color >> 16) & 0xff, (Color >> 8) & 0xff, Color & 0xff, Color >> 24); + glVertex2d(Start.X, Start.Y); + glVertex2d(End.X, End.Y); + } + + glEnd(); + glDisable(GL_LINE_SMOOTH); +#endif + + warning("STUB: Drawing debug lines"); + + m_DebugLines.clear(); + } + + // Framecounter aktualisieren + m_FPSCounter.Update(); + + return true; +} + +// ----------------------------------------------------------------------------- + +RenderObjectPtr GraphicEngine::GetMainPanel() { + return m_MainPanelPtr; +} + +// ----------------------------------------------------------------------------- + +void GraphicEngine::SetVsync(bool Vsync) { + warning("STUB: SetVsync(%d)", Vsync); +} + +// ----------------------------------------------------------------------------- + +bool GraphicEngine::GetVsync() const { + warning("STUB: GetVsync()"); + + return true; +} + +// ----------------------------------------------------------------------------- + +bool GraphicEngine::fill(const Common::Rect *fillRectPtr, uint color) { + Common::Rect rect(m_Width - 1, m_Height - 1); + + if (fillRectPtr) { + rect = *fillRectPtr; + } + + if (fillRectPtr->width() > 0 && fillRectPtr->height() > 0) { + _backSurface.fillRect(rect, color); + g_system->copyRectToScreen((byte *)_backSurface.getBasePtr(fillRectPtr->left, fillRectPtr->top), _backSurface.pitch, fillRectPtr->left, fillRectPtr->top, fillRectPtr->width(), fillRectPtr->height()); + } + + return true; +} + // ----------------------------------------------------------------------------- +bool GraphicEngine::GetScreenshot(uint &Width, uint &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, Width * Height); + FlipImagedataVertical(Width, Height, *Data); + + return true; +} + +// ----------------------------------------------------------------------------- + +bool GraphicEngine::ReadFramebufferContents(uint Width, uint Height, byte **Data) { + *Data = (byte *)malloc(Width * Height * 4); + + return true; +} + +// ----------------------------------------------------------------------------- + +void GraphicEngine::ReverseRGBAComponentOrder(byte *Data, uint size) { + uint32 *ptr = (uint32 *)Data; + + for (uint i = 0; i < size; i++) { + uint Pixel = *ptr; + *ptr = (Pixel & 0xff00ff00) | ((Pixel >> 16) & 0xff) | ((Pixel & 0xff) << 16); + ++ptr; + } +} + +// ----------------------------------------------------------------------------- + +void GraphicEngine::FlipImagedataVertical(uint Width, uint Height, byte *Data) { +#if 0 // TODO + vector LineBuffer(Width); + + for (uint Y = 0; Y < Height / 2; ++Y) { + vector::iterator Line1It = Data.begin() + Y * Width; + vector::iterator Line2It = Data.begin() + (Height - 1 - Y) * Width; + copy(Line1It, Line1It + Width, LineBuffer.begin()); + copy(Line2It, Line2It + Width, Line1It); + copy(LineBuffer.begin(), LineBuffer.end(), Line2It); + } +#endif +} + +// ----------------------------------------------------------------------------- +// RESOURCE MANAGING +// ----------------------------------------------------------------------------- + +Resource *GraphicEngine::LoadResource(const Common::String &FileName) { + BS_ASSERT(CanLoadResource(FileName)); + + // Bild für den Softwarebuffer laden + if (FileName.hasSuffix(PNG_S_EXTENSION)) { + bool Result = false; + SWImage *pImage = new SWImage(FileName, Result); + if (!Result) { + delete pImage; + return 0; + } + + BitmapResource *pResource = new BitmapResource(FileName, pImage); + if (!pResource->isValid()) { + delete pResource; + return 0; + } + + return pResource; + } + + // Sprite-Bild laden + if (FileName.hasSuffix(PNG_EXTENSION) || FileName.hasSuffix(B25S_EXTENSION)) { + bool Result = false; + GLImage *pImage = new GLImage(FileName, Result); + if (!Result) { + delete pImage; + return 0; + } + + BitmapResource *pResource = new BitmapResource(FileName, pImage); + if (!pResource->isValid()) { + delete pResource; + return 0; + } + + return pResource; + } + + + // Vectorgraphik laden + if (FileName.hasSuffix(SWF_EXTENSION)) { + debug(2, "VectorImage: %s", FileName.c_str()); + + // Pointer auf Package-Manager holen + PackageManager *pPackage = Kernel::GetInstance()->GetPackage(); + BS_ASSERT(pPackage); + + // Datei laden + byte *pFileData; + uint FileSize; + if (!(pFileData = static_cast(pPackage->GetFile(FileName, &FileSize)))) { + BS_LOG_ERRORLN("File \"%s\" could not be loaded.", FileName.c_str()); + return 0; + } + + bool Result = false; + VectorImage *pImage = new VectorImage(pFileData, FileSize, Result, FileName); + if (!Result) { + delete pImage; + delete [] pFileData; + return 0; + } + + BitmapResource *pResource = new BitmapResource(FileName, pImage); + if (!pResource->isValid()) { + delete pResource; + delete[] pFileData; + return 0; + } + + delete[] pFileData; + return pResource; + } + + // Animation laden + if (FileName.hasSuffix(ANI_EXTENSION)) { + AnimationResource *pResource = new AnimationResource(FileName); + if (pResource->isValid()) + return pResource; + else { + delete pResource; + return 0; + } + } + + // Font laden + if (FileName.hasSuffix(FNT_EXTENSION)) { + FontResource *pResource = new FontResource(Kernel::GetInstance(), FileName); + if (pResource->IsValid()) + return pResource; + else { + delete pResource; + return 0; + } + } + + BS_LOG_ERRORLN("Service cannot load \"%s\".", FileName.c_str()); + return 0; +} + +// ----------------------------------------------------------------------------- + +bool GraphicEngine::CanLoadResource(const Common::String &FileName) { + return FileName.hasSuffix(PNG_EXTENSION) || + FileName.hasSuffix(ANI_EXTENSION) || + FileName.hasSuffix(FNT_EXTENSION) || + FileName.hasSuffix(SWF_EXTENSION) || + FileName.hasSuffix(B25S_EXTENSION); +} + + +// ----------------------------------------------------------------------------- +// DEBUGGING +// ----------------------------------------------------------------------------- + +void GraphicEngine::DrawDebugLine(const Vertex &Start, const Vertex &End, uint Color) { + m_DebugLines.push_back(DebugLine(Start, End, Color)); +} + void GraphicEngine::UpdateLastFrameDuration() { // Aktuelle Zeit holen uint64_t CurrentTime = Kernel::GetInstance()->GetMicroTicks(); @@ -96,8 +431,6 @@ void GraphicEngine::UpdateLastFrameDuration() { m_LastTimeStamp = CurrentTime; } -// ----------------------------------------------------------------------------- - namespace { bool DoSaveScreenshot(GraphicEngine &GraphicEngine, const Common::String &Filename, bool Thumbnail) { uint Width; @@ -115,20 +448,14 @@ bool DoSaveScreenshot(GraphicEngine &GraphicEngine, const Common::String &Filena } } -// ----------------------------------------------------------------------------- - bool GraphicEngine::SaveScreenshot(const Common::String &Filename) { return DoSaveScreenshot(*this, Filename, false); } -// ----------------------------------------------------------------------------- - bool GraphicEngine::SaveThumbnailScreenshot(const Common::String &Filename) { return DoSaveScreenshot(*this, Filename, true); } -// ----------------------------------------------------------------------------- - void GraphicEngine::ARGBColorToLuaColor(lua_State *L, uint Color) { lua_Number Components[4] = { (Color >> 16) & 0xff, // Rot @@ -146,8 +473,6 @@ void GraphicEngine::ARGBColorToLuaColor(lua_State *L, uint Color) { } } -// ----------------------------------------------------------------------------- - uint GraphicEngine::LuaColorToARGBColor(lua_State *L, int StackIndex) { #ifdef DEBUG int __startStackDepth = lua_gettop(L); @@ -194,17 +519,18 @@ uint GraphicEngine::LuaColorToARGBColor(lua_State *L, int StackIndex) { return (Alpha << 24) | (Red << 16) | (Green << 8) | Blue; } -// ----------------------------------------------------------------------------- - bool GraphicEngine::persist(OutputPersistenceBlock &writer) { writer.write(m_TimerActive); - return true; -} -// ----------------------------------------------------------------------------- + bool result = _renderObjectManagerPtr->persist(writer); + + return result; +} bool GraphicEngine::unpersist(InputPersistenceBlock &reader) { reader.read(m_TimerActive); + _renderObjectManagerPtr->unpersist(reader); + return reader.isGood(); } -- cgit v1.2.3 From 97164f058c28d4258dfba7a0fccec8b6930e71e4 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 14 Sep 2010 20:08:01 +0000 Subject: SWORD25: Adjust the paths accordingly svn-id: r53359 --- engines/sword25/gfx/graphicengine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/sword25/gfx/graphicengine.cpp') diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp index 199ca8a84c..a6cbbdbde2 100644 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -42,9 +42,9 @@ #include "sword25/gfx/panel.h" #include "sword25/gfx/renderobjectmanager.h" #include "sword25/gfx/screenshot.h" +#include "sword25/gfx/image/glimage.h" +#include "sword25/gfx/image/swimage.h" #include "sword25/gfx/image/vectorimage.h" -#include "sword25/gfx/opengl/glimage.h" -#include "sword25/gfx/opengl/swimage.h" #include "sword25/package/packagemanager.h" #include "sword25/kernel/inputpersistenceblock.h" #include "sword25/kernel/outputpersistenceblock.h" -- cgit v1.2.3 From cefa844b51e8e1416cf3a1e0a92a0ebf1660e9e5 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 14 Sep 2010 20:15:36 +0000 Subject: SWORD25: Rename GLImage to RenderedImage svn-id: r53362 --- engines/sword25/gfx/graphicengine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/sword25/gfx/graphicengine.cpp') diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp index a6cbbdbde2..b0e1b17359 100644 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -42,7 +42,7 @@ #include "sword25/gfx/panel.h" #include "sword25/gfx/renderobjectmanager.h" #include "sword25/gfx/screenshot.h" -#include "sword25/gfx/image/glimage.h" +#include "sword25/gfx/image/renderedimage.h" #include "sword25/gfx/image/swimage.h" #include "sword25/gfx/image/vectorimage.h" #include "sword25/package/packagemanager.h" @@ -315,7 +315,7 @@ Resource *GraphicEngine::LoadResource(const Common::String &FileName) { // Sprite-Bild laden if (FileName.hasSuffix(PNG_EXTENSION) || FileName.hasSuffix(B25S_EXTENSION)) { bool Result = false; - GLImage *pImage = new GLImage(FileName, Result); + RenderedImage *pImage = new RenderedImage(FileName, Result); if (!Result) { delete pImage; return 0; -- cgit v1.2.3 From 80521ed5dd279316d0534fc3cc4b61c27d19ef4e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 19 Sep 2010 05:00:45 +0000 Subject: SWORD25: Further savegame work, including savegame screenshots This handles saving (but not yet re-loaded display) of screenshots into savegame files. It also changes the original engine behaviour of temporarily saving the screenshots in a file 'tmp.png' to keeping the raw PNG file data in a memory block. svn-id: r53373 --- engines/sword25/gfx/graphicengine.cpp | 95 +++++++++++++---------------------- 1 file changed, 35 insertions(+), 60 deletions(-) (limited to 'engines/sword25/gfx/graphicengine.cpp') diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp index b0e1b17359..fe19dc7df5 100644 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -88,6 +88,7 @@ GraphicEngine::GraphicEngine(Kernel *pKernel) : m_TimerActive(true), m_FrameTimeSampleSlot(0), m_RepaintedPixels(0), + _thumbnail(NULL), ResourceService(pKernel) { m_FrameTimeSamples.resize(FRAMETIME_SAMPLE_COUNT); @@ -99,6 +100,8 @@ GraphicEngine::GraphicEngine(Kernel *pKernel) : GraphicEngine::~GraphicEngine() { _backSurface.free(); + _frameBuffer.free(); + delete _thumbnail; } Service *GraphicEngine_CreateObject(Kernel *pKernel) { @@ -129,6 +132,7 @@ bool GraphicEngine::Init(int Width, int Height, int BitDepth, int BackbufferCoun m_ScreenRect.bottom = m_Height; _backSurface.create(Width, Height, 4); + _frameBuffer.create(Width, Height, 4); // Standardmäßig ist Vsync an. SetVsync(true); @@ -163,6 +167,15 @@ bool GraphicEngine::EndFrame() { // Scene zeichnen _renderObjectManagerPtr->render(); + // FIXME: The frame buffer surface is only used as the base for creating thumbnails when saving the + // game, since the _backSurface is blanked. Currently I'm doing a slightly hacky check and only + // copying the back surface if line 50 (the first line after the interface area) is non-blank + if (READ_LE_UINT32((byte *)_backSurface.pixels + (_backSurface.pitch * 50)) & 0xffffff) { + // Make a copy of the current frame into the frame buffer + Common::copy((byte *)_backSurface.pixels, (byte *)_backSurface.pixels + + (_backSurface.pitch * _backSurface.h), (byte *)_frameBuffer.pixels); + } + g_system->updateScreen(); // Debug-Lines zeichnen @@ -236,55 +249,8 @@ bool GraphicEngine::fill(const Common::Rect *fillRectPtr, uint color) { // ----------------------------------------------------------------------------- -bool GraphicEngine::GetScreenshot(uint &Width, uint &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, Width * Height); - FlipImagedataVertical(Width, Height, *Data); - - return true; -} - -// ----------------------------------------------------------------------------- - -bool GraphicEngine::ReadFramebufferContents(uint Width, uint Height, byte **Data) { - *Data = (byte *)malloc(Width * Height * 4); - - return true; -} - -// ----------------------------------------------------------------------------- - -void GraphicEngine::ReverseRGBAComponentOrder(byte *Data, uint size) { - uint32 *ptr = (uint32 *)Data; - - for (uint i = 0; i < size; i++) { - uint Pixel = *ptr; - *ptr = (Pixel & 0xff00ff00) | ((Pixel >> 16) & 0xff) | ((Pixel & 0xff) << 16); - ++ptr; - } -} - -// ----------------------------------------------------------------------------- - -void GraphicEngine::FlipImagedataVertical(uint Width, uint Height, byte *Data) { -#if 0 // TODO - vector LineBuffer(Width); - - for (uint Y = 0; Y < Height / 2; ++Y) { - vector::iterator Line1It = Data.begin() + Y * Width; - vector::iterator Line2It = Data.begin() + (Height - 1 - Y) * Width; - copy(Line1It, Line1It + Width, LineBuffer.begin()); - copy(Line2It, Line2It + Width, Line1It); - copy(LineBuffer.begin(), LineBuffer.end(), Line2It); - } -#endif +Graphics::Surface *GraphicEngine::GetScreenshot() { + return &_frameBuffer; } // ----------------------------------------------------------------------------- @@ -432,28 +398,37 @@ void GraphicEngine::UpdateLastFrameDuration() { } namespace { -bool DoSaveScreenshot(GraphicEngine &GraphicEngine, const Common::String &Filename, bool Thumbnail) { - uint Width; - uint Height; - byte *Data; - if (!GraphicEngine.GetScreenshot(Width, Height, &Data)) { +bool DoSaveScreenshot(GraphicEngine &GraphicEngine, const Common::String &Filename) { + Graphics::Surface *data = GraphicEngine.GetScreenshot(); + if (!data) { BS_LOG_ERRORLN("Call to GetScreenshot() failed. Cannot save screenshot."); return false; } - if (Thumbnail) - return Screenshot::SaveThumbnailToFile(Width, Height, Data, Filename); - else - return Screenshot::SaveToFile(Width, Height, Data, Filename); + Common::FSNode f(Filename); + Common::WriteStream *stream = f.createWriteStream(); + if (!stream) { + BS_LOG_ERRORLN("Call to GetScreenshot() failed. Cannot save screenshot."); + return false; + } + + bool result = Screenshot::SaveToFile(data, stream); + delete stream; + + return result; } } bool GraphicEngine::SaveScreenshot(const Common::String &Filename) { - return DoSaveScreenshot(*this, Filename, false); + return DoSaveScreenshot(*this, Filename); } bool GraphicEngine::SaveThumbnailScreenshot(const Common::String &Filename) { - return DoSaveScreenshot(*this, Filename, true); + // Note: In ScumMVM, rather than saivng the thumbnail to a file, we store it in memory + // until needed when creating savegame files + delete _thumbnail; + _thumbnail = Screenshot::createThumbnail(&_frameBuffer); + return true; } void GraphicEngine::ARGBColorToLuaColor(lua_State *L, uint Color) { -- cgit v1.2.3 From 8582c1ad5770b6385381f524a4610934d115cd88 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 25 Sep 2010 19:48:26 +0000 Subject: SWORD25: Enforse code naming conventions in PackageManager and Sword25Engine svn-id: r53380 --- engines/sword25/gfx/graphicengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/sword25/gfx/graphicengine.cpp') diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp index fe19dc7df5..fa1c0300da 100644 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -308,7 +308,7 @@ Resource *GraphicEngine::LoadResource(const Common::String &FileName) { // Datei laden byte *pFileData; uint FileSize; - if (!(pFileData = static_cast(pPackage->GetFile(FileName, &FileSize)))) { + if (!(pFileData = static_cast(pPackage->getFile(FileName, &FileSize)))) { BS_LOG_ERRORLN("File \"%s\" could not be loaded.", FileName.c_str()); return 0; } -- cgit v1.2.3 From 1e15d8efb73503d9f613cc60023771b0c11f0dd6 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 3 Oct 2010 13:25:11 +0000 Subject: SWORD25: Enforced code naming conventions in sfx/ and reservice.h svn-id: r53390 --- engines/sword25/gfx/graphicengine.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines/sword25/gfx/graphicengine.cpp') diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp index fa1c0300da..ea0c8c82c5 100644 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -257,8 +257,8 @@ Graphics::Surface *GraphicEngine::GetScreenshot() { // RESOURCE MANAGING // ----------------------------------------------------------------------------- -Resource *GraphicEngine::LoadResource(const Common::String &FileName) { - BS_ASSERT(CanLoadResource(FileName)); +Resource *GraphicEngine::loadResource(const Common::String &FileName) { + BS_ASSERT(canLoadResource(FileName)); // Bild für den Softwarebuffer laden if (FileName.hasSuffix(PNG_S_EXTENSION)) { @@ -360,7 +360,7 @@ Resource *GraphicEngine::LoadResource(const Common::String &FileName) { // ----------------------------------------------------------------------------- -bool GraphicEngine::CanLoadResource(const Common::String &FileName) { +bool GraphicEngine::canLoadResource(const Common::String &FileName) { return FileName.hasSuffix(PNG_EXTENSION) || FileName.hasSuffix(ANI_EXTENSION) || FileName.hasSuffix(FNT_EXTENSION) || -- cgit v1.2.3