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

sev at users.sourceforge.net sev at users.sourceforge.net
Wed Oct 13 00:28:22 CEST 2010


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

Log Message:
-----------
SWORD25: Converted remainder of Kernel/ folder

Modified Paths:
--------------
    scummvm/trunk/engines/sword25/gfx/framecounter.cpp
    scummvm/trunk/engines/sword25/gfx/framecounter.h
    scummvm/trunk/engines/sword25/input/scummvminput.cpp
    scummvm/trunk/engines/sword25/kernel/outputpersistenceblock.cpp
    scummvm/trunk/engines/sword25/kernel/window.cpp
    scummvm/trunk/engines/sword25/kernel/window.h
    scummvm/trunk/engines/sword25/module.mk
    scummvm/trunk/engines/sword25/sword25.cpp
    scummvm/trunk/engines/sword25/sword25.h

Added Paths:
-----------
    scummvm/trunk/engines/sword25/kernel/scummvmwindow.cpp
    scummvm/trunk/engines/sword25/kernel/scummvmwindow.h

Removed Paths:
-------------
    scummvm/trunk/engines/sword25/kernel/timer.cpp
    scummvm/trunk/engines/sword25/kernel/timer.h
    scummvm/trunk/engines/sword25/kernel/win32window.cpp
    scummvm/trunk/engines/sword25/kernel/win32window.h

Modified: scummvm/trunk/engines/sword25/gfx/framecounter.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/framecounter.cpp	2010-10-12 22:27:32 UTC (rev 53215)
+++ scummvm/trunk/engines/sword25/gfx/framecounter.cpp	2010-10-12 22:28:21 UTC (rev 53216)
@@ -32,36 +32,33 @@
  *
  */
 
+#include "common/system.h"
 #include "sword25/gfx/framecounter.h"
-#include "sword25/kernel/timer.h"
 
 namespace Sword25 {
 
 BS_Framecounter::BS_Framecounter(int UpdateFrequency) :
-	m_FPS(0),
-	m_FPSCount(0),
-	m_LastUpdateTime(-1)
-{
+		m_FPS(0),
+		m_FPSCount(0),
+		m_LastUpdateTime(-1) {
 	SetUpdateFrequency(UpdateFrequency);
 }
 
 void BS_Framecounter::Update()
 {
 	// Aktuellen Systemtimerstand auslesen
-	uint64_t Timer = BS_Timer::GetMicroTicks();
+	uint64_t Timer = g_system->getMillis() * 1000;
 
 	// Falls m_LastUpdateTime == -1 ist, wird der Frame-Counter zum ersten Mal aufgerufen und der aktuelle Systemtimer als erster
 	// Messzeitpunkt genommen.
 	if (m_LastUpdateTime == -1)
 		m_LastUpdateTime = Timer;
-	else
-	{
+	else {
 		// Die Anzahl der Frames im aktuellen Messzeitraum wird erh\xF6ht.
 		m_FPSCount++;
 
 		// Falls der Messzeitraum verstrichen ist, wird die durchschnittliche Framerate berechnet und ein neuer Messzeitraum begonnen.
-		if (Timer - m_LastUpdateTime >= m_UpdateDelay)
-		{
+		if (Timer - m_LastUpdateTime >= m_UpdateDelay) {
 			m_FPS = static_cast<int>((1000000 * (uint64_t)m_FPSCount) / (Timer - m_LastUpdateTime));
 			m_LastUpdateTime = Timer;
 			m_FPSCount = 0;

Modified: scummvm/trunk/engines/sword25/gfx/framecounter.h
===================================================================
--- scummvm/trunk/engines/sword25/gfx/framecounter.h	2010-10-12 22:27:32 UTC (rev 53215)
+++ scummvm/trunk/engines/sword25/gfx/framecounter.h	2010-10-12 22:28:21 UTC (rev 53216)
@@ -77,7 +77,7 @@
 private:
 	int	m_FPS;
 	int m_FPSCount;
-	uint64_t m_LastUpdateTime;
+	int64_t m_LastUpdateTime;
 	uint64_t m_UpdateDelay;
 };
 

Modified: scummvm/trunk/engines/sword25/input/scummvminput.cpp
===================================================================
--- scummvm/trunk/engines/sword25/input/scummvminput.cpp	2010-10-12 22:27:32 UTC (rev 53215)
+++ scummvm/trunk/engines/sword25/input/scummvminput.cpp	2010-10-12 22:28:21 UTC (rev 53216)
@@ -121,6 +121,10 @@
 			AlterKeyboardState(event.kbd.keycode, (event.type == Common::EVENT_KEYDOWN) ? 0x80 : 0);
 			break;
 
+		case Common::EVENT_QUIT:
+			BS_Kernel::GetInstance()->GetWindow()->SetWindowAlive(false);
+			break;
+
 		default:
 			break;
 		}

Modified: scummvm/trunk/engines/sword25/kernel/outputpersistenceblock.cpp
===================================================================
--- scummvm/trunk/engines/sword25/kernel/outputpersistenceblock.cpp	2010-10-12 22:27:32 UTC (rev 53215)
+++ scummvm/trunk/engines/sword25/kernel/outputpersistenceblock.cpp	2010-10-12 22:28:21 UTC (rev 53216)
@@ -44,17 +44,17 @@
 // Constants
 // -----------------------------------------------------------------------------
 
-namespace
-{
+namespace {
 	const unsigned int INITIAL_BUFFER_SIZE = 1024 * 64;
 }
 
+namespace Sword25 {
+
 // -----------------------------------------------------------------------------
 // Construction / Destruction
 // -----------------------------------------------------------------------------
 
-BS_OutputPersistenceBlock::BS_OutputPersistenceBlock()
-{
+BS_OutputPersistenceBlock::BS_OutputPersistenceBlock() {
 	m_Data.reserve(INITIAL_BUFFER_SIZE);
 }
 
@@ -62,8 +62,7 @@
 // Writing
 // -----------------------------------------------------------------------------
 
-void BS_OutputPersistenceBlock::Write(signed int Value)
-{
+void BS_OutputPersistenceBlock::Write(signed int Value) {
 	WriteMarker(SINT_MARKER);
 	Value = ConvertEndianessFromSystemToStorage(Value);
 	RawWrite(&Value, sizeof(Value));
@@ -71,8 +70,7 @@
 
 // -----------------------------------------------------------------------------
 
-void BS_OutputPersistenceBlock::Write(unsigned int Value)
-{
+void BS_OutputPersistenceBlock::Write(unsigned int Value) {
 	WriteMarker(UINT_MARKER);
 	Value = ConvertEndianessFromSystemToStorage(Value);
 	RawWrite(&Value, sizeof(Value));
@@ -80,8 +78,7 @@
 
 // -----------------------------------------------------------------------------
 
-void BS_OutputPersistenceBlock::Write(float Value)
-{
+void BS_OutputPersistenceBlock::Write(float Value) {
 	WriteMarker(FLOAT_MARKER);
 	Value = ConvertEndianessFromSystemToStorage(Value);
 	RawWrite(&Value, sizeof(Value));
@@ -89,8 +86,7 @@
 
 // -----------------------------------------------------------------------------
 
-void BS_OutputPersistenceBlock::Write(bool Value)
-{
+void BS_OutputPersistenceBlock::Write(bool Value) {
 	WriteMarker(BOOL_MARKER);
 
 	unsigned int UIntBool = Value ? 1 : 0;
@@ -100,8 +96,7 @@
 
 // -----------------------------------------------------------------------------
 
-void BS_OutputPersistenceBlock::Write(const std::string & String)
-{
+void BS_OutputPersistenceBlock::Write(const Common::String &String) {
 	WriteMarker(STRING_MARKER);
 
 	Write(String.size());
@@ -110,8 +105,7 @@
 
 // -----------------------------------------------------------------------------
 
-void BS_OutputPersistenceBlock::Write(const void * BufferPtr, size_t Size)
-{
+void BS_OutputPersistenceBlock::Write(const void *BufferPtr, size_t Size) {
 	WriteMarker(BLOCK_MARKER);
 
 	Write(Size);
@@ -120,19 +114,18 @@
 
 // -----------------------------------------------------------------------------
 
-void BS_OutputPersistenceBlock::WriteMarker(unsigned char Marker)
-{
+void BS_OutputPersistenceBlock::WriteMarker(unsigned char Marker) {
 	m_Data.push_back(Marker);
 }
 
 // -----------------------------------------------------------------------------
 
-void BS_OutputPersistenceBlock::RawWrite(const void * DataPtr, size_t Size)
-{
-	if (Size > 0)
-	{
+void BS_OutputPersistenceBlock::RawWrite(const void *DataPtr, size_t Size) {
+	if (Size > 0) {
 		unsigned int OldSize = m_Data.size();
 		m_Data.resize(OldSize + Size);
 		memcpy(&m_Data[OldSize], DataPtr, Size);
 	}
 }
+
+} // End of namespace Sword25

Added: scummvm/trunk/engines/sword25/kernel/scummvmwindow.cpp
===================================================================
--- scummvm/trunk/engines/sword25/kernel/scummvmwindow.cpp	                        (rev 0)
+++ scummvm/trunk/engines/sword25/kernel/scummvmwindow.cpp	2010-10-12 22:28:21 UTC (rev 53216)
@@ -0,0 +1,296 @@
+/* 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
+ *
+ */
+
+#include "common/system.h"
+#include "engines/util.h"
+#include "graphics/pixelformat.h"
+#include "sword25/kernel/scummvmwindow.h"
+#include "sword25/kernel/kernel.h"
+#include "sword25/input/inputengine.h"
+
+#define BS_LOG_PREFIX "WIN32WINDOW"
+
+namespace Sword25 {
+
+bool BS_ScummVMWindow::_ClassRegistered = false;
+
+// Constructor / Destructor 
+// ------------------------
+BS_ScummVMWindow::BS_ScummVMWindow(int X, int Y, int Width, int Height, bool Visible) {
+	// Presume that init will fail
+	_InitSuccess = false;
+
+	// We don't support any window creation except at the origin 0,0
+	assert(X == 0);
+	assert(Y == 0);
+
+	if (!_ClassRegistered) {
+		// Nothing here currently
+
+		_ClassRegistered = true;
+	}
+
+	// Fenstersichtbarkeit setzen
+	SetVisible(Visible);
+
+	// Indicate success
+	_InitSuccess = true;
+	_WindowAlive = true;
+	_CloseWanted = false;
+}
+
+BS_ScummVMWindow::~BS_ScummVMWindow() {
+}
+
+// Get Methods
+// ------------
+int BS_ScummVMWindow::GetX() {
+	return 0;
+}
+
+int BS_ScummVMWindow::GetY() {
+	return 0;
+}
+
+int BS_ScummVMWindow::GetClientX() {
+	return 0;
+}
+
+int BS_ScummVMWindow::GetClientY() {
+	return 0;
+}
+
+int BS_ScummVMWindow::GetWidth() {
+	return g_system->getWidth();
+}
+
+int BS_ScummVMWindow::GetHeight() {
+	return g_system->getHeight();
+}
+
+Common::String BS_ScummVMWindow::GetTitle() {
+	return Common::String("");
+}
+
+bool BS_ScummVMWindow::IsVisible() {
+	return true;
+}
+
+bool BS_ScummVMWindow::HasFocus() {
+	// FIXME: Is there a way to tell if ScummVM has the focus in Windowed mode?
+	return true;
+}
+
+uint BS_ScummVMWindow::GetWindowHandle() {
+	return 0;
+}
+
+void BS_ScummVMWindow::SetWindowAlive(bool v) {
+	_WindowAlive = v;
+}
+
+
+// Set Methods
+// ------------
+
+void BS_ScummVMWindow::SetX(int X) {
+	// No implementation
+}
+
+void BS_ScummVMWindow::SetY(int Y) {
+	// No implementation
+}
+
+void BS_ScummVMWindow::SetWidth(int Width) {
+	// No implementation
+}
+
+void BS_ScummVMWindow::SetHeight(int Height) {
+	// No implementation
+}
+
+void BS_ScummVMWindow::SetVisible(bool Visible) {
+	// No implementation
+}
+
+void BS_ScummVMWindow::SetTitle(const Common::String &Title) {
+	// No implementation
+}
+
+bool BS_ScummVMWindow::ProcessMessages() {
+	// No implementation
+	return false;
+}
+
+bool BS_ScummVMWindow::WaitForFocus() {
+	// No implementation
+	return true;
+}
+
+// FIXME: Special keys detected here need to be moved into the Input Engine
+/*
+// Die WindowProc aller Fenster der Klasse
+LRESULT CALLBACK BS_ScummVMWindow::WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+	switch(uMsg)
+	{
+	case WM_PAINT:
+		ValidateRect(hwnd, NULL);
+		break;
+		
+	case WM_DESTROY:
+		// Das Fenster wird zerst\xF6rt
+		PostQuitMessage(0);
+		break;
+
+	case WM_CLOSE:
+		{
+			BS_Window * WindowPtr = BS_Kernel::GetInstance()->GetWindow();
+			if (WindowPtr) {
+				WindowPtr->SetCloseWanted(true);
+			}
+			break;
+		}
+
+	case WM_KEYDOWN:
+		{
+			// Tastendr\xFCcke, die f\xFCr das Inputmodul interessant sind, werden diesem gemeldet.
+			BS_InputEngine * InputPtr = BS_Kernel::GetInstance()->GetInput();
+
+			if (InputPtr)
+			{
+				switch (wParam)
+				{
+				case VK_RETURN:
+					InputPtr->ReportCommand(BS_InputEngine::KEY_COMMAND_ENTER);
+					break;
+
+				case VK_LEFT:
+					InputPtr->ReportCommand(BS_InputEngine::KEY_COMMAND_LEFT);
+					break;
+
+				case VK_RIGHT:
+					InputPtr->ReportCommand(BS_InputEngine::KEY_COMMAND_RIGHT);
+					break;
+
+				case VK_HOME:
+					InputPtr->ReportCommand(BS_InputEngine::KEY_COMMAND_HOME);
+					break;
+
+				case VK_END:
+					InputPtr->ReportCommand(BS_InputEngine::KEY_COMMAND_END);
+					break;
+
+				case VK_BACK:
+					InputPtr->ReportCommand(BS_InputEngine::KEY_COMMAND_BACKSPACE);
+					break;
+
+				case VK_TAB:
+					InputPtr->ReportCommand(BS_InputEngine::KEY_COMMAND_TAB);
+					break;
+
+				case VK_INSERT:
+					InputPtr->ReportCommand(BS_InputEngine::KEY_COMMAND_INSERT);
+					break;
+
+				case VK_DELETE:
+					InputPtr->ReportCommand(BS_InputEngine::KEY_COMMAND_DELETE);
+					break;
+				}
+			}
+			break;
+		}
+
+	case WM_KEYUP:
+	case WM_SYSKEYUP:
+		// Alle Tastendr\xFCcke werden ignoriert, damit Windows per DefWindowProc() nicht darauf
+		// reagieren kann und damit unerwartete Seiteneffekte ausl\xF6st.
+		// Zum Beispiel w\xFCrden ALT und F10 Tastendr\xFCcke das "Men\xFC" aktivieren und somit den Message-Loop zum Stillstand bringen.
+		break;
+
+	case WM_SYSCOMMAND:
+		// Verhindern, dass der Bildschirmschoner aktiviert wird, w\xE4hrend das Spiel l\xE4uft
+		if (wParam != SC_SCREENSAVE) return DefWindowProc(hwnd,uMsg,wParam,lParam);
+		break;
+
+	case WM_CHAR:
+		{
+			unsigned char theChar = static_cast<unsigned char>(wParam & 0xff);
+
+			// Alle Zeichen, die keine Steuerzeichen sind, werden als Buchstaben dem Input-Service mitgeteilt.
+			if (theChar >= 32)
+			{
+				BS_InputEngine * InputPtr = BS_Kernel::GetInstance()->GetInput();
+				if (InputPtr) InputPtr->ReportCharacter(theChar);
+			}
+		}
+		break;
+
+	case WM_SETCURSOR:
+		{
+			// Der Systemcursor wird in der Client-Area des Fensters nicht angezeigt, jedoch in der nicht Client-Area, damit der Benutzer das Fenster wie gewohnt
+			// schlie\xDFen und verschieben kann.
+
+			// Koordinaten des Cursors in der Client-Area berechnen.
+			POINT pt;
+			GetCursorPos(&pt);
+			ScreenToClient(hwnd, &pt);
+
+			// Feststellen, ob sich der Cursor in der Client-Area befindet.
+			// Get client rect
+			RECT rc;
+			GetClientRect(hwnd, &rc);
+
+			// See if cursor is in client area
+			if(PtInRect(&rc, pt))
+				// In der Client-Area keinen Cursor anzeigen.
+				SetCursor(NULL);
+			else
+				// Ausserhalb der Client-Area den Cursor anzeigen.
+				SetCursor(LoadCursor(NULL, IDC_ARROW));
+
+			return TRUE;
+		}
+		break;
+
+	default:
+		// Um alle anderen Vorkommnisse k\xFCmmert sich Windows
+		return DefWindowProc(hwnd,uMsg,wParam,lParam);
+	}
+
+	return 0;
+}
+*/
+
+} // End of namespace Sword25


Property changes on: scummvm/trunk/engines/sword25/kernel/scummvmwindow.cpp
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Copied: scummvm/trunk/engines/sword25/kernel/scummvmwindow.h (from rev 53215, scummvm/trunk/engines/sword25/kernel/win32window.h)
===================================================================
--- scummvm/trunk/engines/sword25/kernel/scummvmwindow.h	                        (rev 0)
+++ scummvm/trunk/engines/sword25/kernel/scummvmwindow.h	2010-10-12 22:28:21 UTC (rev 53216)
@@ -0,0 +1,85 @@
+/* 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
+ *
+ */
+
+/*
+	BS_ScummVMWindow
+	----------------
+	Implementation of the BS_Window Interfaces for ScummVM
+*/
+
+#ifndef SWORD25_SCUMMVMWINDOW_H
+#define SWORD25_SCUMMVMWINDOW_H
+
+// Includes
+#include "sword25/kernel/common.h"
+#include "sword25/kernel/window.h"
+
+namespace Sword25 {
+
+// Class definition
+class BS_ScummVMWindow : public BS_Window {
+public:
+	BS_ScummVMWindow(int X, int Y, int Width, int Height, bool Visible);
+	virtual ~BS_ScummVMWindow();
+
+	bool IsVisible();
+	void SetVisible(bool Visible);
+	int GetX();
+	void SetX(int X);
+	int GetY();
+	void SetY(int X);
+	int GetClientX();
+	int GetClientY();
+	int GetWidth();
+	void SetWidth(int Width);
+	int GetHeight();
+	void SetHeight(int Height);
+	Common::String GetTitle();
+	void SetWindowAlive(bool v);
+	void SetTitle(const Common::String &Title);
+	bool HasFocus();
+	uint GetWindowHandle();
+	bool WaitForFocus();
+	bool ProcessMessages();
+
+private:
+	static bool _ClassRegistered;
+	bool _WindowAlive;	
+	int	 _ClientXDelta;
+	int	 _ClientYDelta;
+};
+
+} // End of namespace Sword25
+
+#endif


Property changes on: scummvm/trunk/engines/sword25/kernel/scummvmwindow.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Deleted: scummvm/trunk/engines/sword25/kernel/timer.cpp
===================================================================
--- scummvm/trunk/engines/sword25/kernel/timer.cpp	2010-10-12 22:27:32 UTC (rev 53215)
+++ scummvm/trunk/engines/sword25/kernel/timer.cpp	2010-10-12 22:28:21 UTC (rev 53216)
@@ -1,68 +0,0 @@
-/* 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 WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
-#include "sword25/kernel/timer.h"
-
-#define BS_LOG_PREFIX "BS_TIMER"
-
-uint64_t BS_Timer::GetMicroTicks()
-{
-	HANDLE ThreadID = ::GetCurrentThread();
-
-	DWORD_PTR OldAffinityMask = ::SetThreadAffinityMask(ThreadID, 1);
-
-	uint64_t Frequency;
-	::QueryPerformanceFrequency(reinterpret_cast<LARGE_INTEGER*>(&Frequency));
-
-	uint64_t Tick;
-	::QueryPerformanceCounter(reinterpret_cast<LARGE_INTEGER*>(&Tick));
-
-	::SetThreadAffinityMask(ThreadID, OldAffinityMask);
-	
-	return Tick * 1000000 / Frequency;
-}
-
-unsigned int BS_Timer::GetMilliTicks()
-{
-	return (unsigned int)(GetMicroTicks() / 1000);
-}
-
-bool BS_Timer::IsTimerAvaliable()
-{
-	LARGE_INTEGER Dummy;
-	return ::QueryPerformanceFrequency(&Dummy) ? true : false;
-}

Deleted: scummvm/trunk/engines/sword25/kernel/timer.h
===================================================================
--- scummvm/trunk/engines/sword25/kernel/timer.h	2010-10-12 22:27:32 UTC (rev 53215)
+++ scummvm/trunk/engines/sword25/kernel/timer.h	2010-10-12 22:28:21 UTC (rev 53216)
@@ -1,84 +0,0 @@
-/* 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
- *
- */
-
-/*
-	BS_Timer
-	--------
-	Eine Klasse zum Auslesen des Systemtimers.
-
-	Autor: Malte Thiesen
-*/
-
-#ifndef SWORD25_TIMER_H
-#define SWORD25_TIMER_H
-
-// Includes
-#include "sword25/kernel/common.h"
-#include "sword25/kernel/bs_stdint.h"
-
-/**
-	@brief Eine Klasse zum Auslesen des Systemtimers.
-
-	Vor der Benutzung sollte immer mit IsTimerAvaliable() getestet werden, ob der Timer von der benutzten
-	Hardware unterst\xFCtzt wird.
-*/
-class BS_Timer
-{
-public:
-	/**
-		@brief List den Systemtimer in Microsekunden aus.
-		@return Die Zahl vergangener Microsekunden seit dem Systemstart.<br>
-	*/
-	static uint64_t GetMicroTicks();
-
-	/**
-		@brief List den Systemtimer in Millisekunden aus.
-		@return Die Zahl vergangener Millisekunden seit dem Systemstart.<br>
-	*/
-	static unsigned int GetMilliTicks();
-
-	/**
-		@brief Pr\xFCft, ob der Timer auf der vorhandenen Hardware existiert.
-		@return Gibt false zur\xFCck, fals der Timer auf der vorhandenen Hardware nicht existiert.
-	*/
-	static bool IsTimerAvaliable();
-
-private:
-	/**
-		@brief Initialisiert den Timer.
-	*/
-	static void Init();
-};
-
-#endif

Deleted: scummvm/trunk/engines/sword25/kernel/win32window.cpp
===================================================================
--- scummvm/trunk/engines/sword25/kernel/win32window.cpp	2010-10-12 22:27:32 UTC (rev 53215)
+++ scummvm/trunk/engines/sword25/kernel/win32window.cpp	2010-10-12 22:28:21 UTC (rev 53216)
@@ -1,440 +0,0 @@
-/* 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
- *
- */
-
-#include "sword25/kernel/win32window.h"
-#include "../../projects/resource.h"
-
-#include "sword25/kernel/kernel.h"
-#include "sword25/input/inputengine.h"
-
-bool BS_Win32Window::_ClassRegistered = false;
-
-#define BS_LOG_PREFIX "WIN32WINDOW"
-
-
-// Konstanten
-// ----------
-static const UINT WINDOW_STYLE			= WS_BORDER | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX;
-static const UINT WINDOW_STYLE_EX		= 0;
-static const UINT WINDOW_MAX_MESSAGES	= 50;
-
-// Konstruktion/Destruktion
-// ------------------------
-BS_Win32Window::BS_Win32Window(int X, int Y, int Width, int Height, bool Visible)
-{
-	const char WINDOW_CLASS[] = "BSEngine-Class";
-
-	// Von negativen Fall ausgehen
-	_InitSuccess = false;
-
-	// Fensterklasse registrieren falls n\xF6tig
-	if (!_ClassRegistered)
-	{
-		//Fensterklasse
-		WNDCLASSEX wndclass;
-		
-		//Werte der Fensterklasse festlegen
-		ZeroMemory(&wndclass, sizeof(WNDCLASSEX));
-		wndclass.cbSize = sizeof(WNDCLASSEX);
-		wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
-		wndclass.lpfnWndProc = BS_Win32Window::WindowProc;
-		wndclass.hInstance = GetModuleHandle(NULL);
-		wndclass.hIcon = LoadIcon(NULL,IDI_APPLICATION);
-		wndclass.hIconSm = LoadIcon(NULL,IDI_APPLICATION);
-		wndclass.hCursor = NULL;
-		wndclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
-		wndclass.lpszClassName = WINDOW_CLASS;
-		
-		//Fensterklasse registrieren
-		if (!RegisterClassEx(&wndclass)) return;
-
-		_ClassRegistered = true;
-	}
-
-	//Fenster erstellen
-	if (!(_Window=CreateWindowEx(
-		WINDOW_STYLE_EX,					// Erweiterte Darstellungsflags
-		WINDOW_CLASS,						// Registrierter Fenstername
-		"",									// Kein Fenstertitel
-		WINDOW_STYLE,						// Darstellungsflags
-		0,0,								// Default-Position
-		0,0,								// Default-Gr\xF6sse
-		NULL,								// Kein Parent-Fenster
-		NULL,								// Kein Men\xFC
-		GetModuleHandle(NULL),				// Instance-Handle
-		NULL)))
-		return;
-
-	// Fensterposition und Fenstergr\xF6\xDFe setzen
-	SetWidth(Width);
-	SetHeight(Height);
-	SetX(X);
-	SetY(Y);
-
-	// Fenstersichtbarkeit setzen
-	SetVisible(Visible);
-
-	// Icon setzen
-	HICON hIcon = LoadIcon(GetModuleHandle(0), MAKEINTRESOURCE(IDI_ICON1));
-	if (hIcon)
-	{
-		SendMessage(_Window, WM_SETICON, ICON_BIG, (LPARAM) hIcon);
-		SendMessage(_Window, WM_SETICON, ICON_SMALL, (LPARAM) hIcon);
-	}
-
-	// Erfolg signalisieren
-	_InitSuccess = true;
-	_WindowAlive = true;
-	_CloseWanted = false;
-}
-
-BS_Win32Window::~BS_Win32Window()
-{
-	// Fenster zerst\xF6ren, falls dies nicht ohnehin schon passiert ist
-	if (_WindowAlive) DestroyWindow(_Window);
-}
-
-// Get-Methoden
-// ------------
-int BS_Win32Window::GetX()
-{
-	RECT Rect;
-	GetWindowRect(_Window, &Rect);
-	return Rect.left;
-}
-
-int BS_Win32Window::GetY()
-{
-	RECT Rect;
-	GetWindowRect(_Window, &Rect);
-	return Rect.top;
-}
-
-int BS_Win32Window::GetClientX()
-{
-	POINT Point = {0, 0};
-	ClientToScreen(_Window, &Point);
-	return Point.x;
-}
-
-int BS_Win32Window::GetClientY()
-{
-	POINT Point = {0, 0};
-	ClientToScreen(_Window, &Point);
-	return Point.y;
-}
-
-int BS_Win32Window::GetWidth()
-{
-	RECT Rect;
-	GetClientRect(_Window, &Rect);
-	return Rect.right - Rect.left;
-}
-
-int BS_Win32Window::GetHeight()
-{
-	RECT Rect;
-	GetClientRect(_Window, &Rect);
-	return Rect.bottom - Rect.top;
-}
-
-std::string BS_Win32Window::GetTitle()
-{
-	char String[512];
-	if (GetWindowText(_Window, String, sizeof(String)))
-		return std::string(String);
-
-	return std::string("");
-}
-
-bool BS_Win32Window::IsVisible()
-{
-	return IsWindowVisible(_Window) ? true : false;
-}
-
-bool BS_Win32Window::HasFocus()
-{
-	return GetForegroundWindow() == _Window ? true : false;
-}
-
-UINT BS_Win32Window::GetWindowHandle()
-{
-	return (UINT)_Window;
-}
-
-// Set Methoden
-// ------------
-
-void BS_Win32Window::SetX(int X)
-{
-	int RealX;
-	if (X == -1)
-	{
-		RECT Rect;
-		GetWindowRect(_Window, &Rect);
-		RealX = (GetSystemMetrics(SM_CXSCREEN) - (Rect.right - Rect.left)) / 2;
-	}
-	else
-		RealX = X;
-
-	SetWindowPos(_Window, NULL, RealX, GetY(), 0, 0, SWP_NOSIZE | SWP_NOZORDER);
-}
-
-void BS_Win32Window::SetY(int Y)
-{
-	int RealY;
-	if (Y == -1)
-	{
-		RECT Rect;
-		GetWindowRect(_Window, &Rect);
-		RealY = (GetSystemMetrics(SM_CYSCREEN) - (Rect.bottom - Rect.top)) / 2;
-	}
-	else
-		RealY = Y;
-	
-	SetWindowPos(_Window, NULL, GetX(), RealY, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
-}
-
-void BS_Win32Window::SetWidth(int Width)
-{
-	RECT Rect = {0, 0, Width, GetHeight()};
-	AdjustWindowRectEx(&Rect, WINDOW_STYLE, false, WINDOW_STYLE_EX);
-	SetWindowPos(_Window, NULL, 0, 0, Rect.right - Rect.left, Rect.bottom - Rect.top, SWP_NOMOVE | SWP_NOZORDER);
-}
-
-void BS_Win32Window::SetHeight(int Height)
-{
-	RECT Rect = {0, 0, GetWidth(), Height};
-	AdjustWindowRectEx(&Rect, WINDOW_STYLE, false, WINDOW_STYLE_EX);
-	SetWindowPos(_Window, NULL, 0, 0, Rect.right - Rect.left, Rect.bottom - Rect.top, SWP_NOMOVE | SWP_NOZORDER);	
-}
-
-void BS_Win32Window::SetVisible(bool Visible)
-{
-	ShowWindow(_Window, Visible ? SW_SHOW : SW_HIDE);
-}
-
-void BS_Win32Window::SetTitle(std::string Title)
-{
-	SetWindowText(_Window, Title.c_str());
-}
-
-// Asynchroner Message-Loop
-bool BS_Win32Window::ProcessMessages()
-{
-	for (UINT i = 0; i < WINDOW_MAX_MESSAGES; i++)
-	{
-		MSG msg;
-		if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
-		{
-			if (msg.message == WM_QUIT)
-			{
-				_WindowAlive = false;
-				return false;
-			}
-
-			// Alle Nachrichten zur Verarbeitung durch WindowProc vorbereiten
-			TranslateMessage(&msg);
-			// Nachricht an WindowProc \xFCbergeben
-			DispatchMessage(&msg);
-		}
-		else
-			return true;
-	}
-
-	return true;
-}
-
-// Synchroner Message-Loop
-bool BS_Win32Window::WaitForFocus()
-{
-	MSG msg;
-	
-	// Fenster minimieren
-	ShowWindow(_Window, SW_MINIMIZE);
-
-	for (;;)
-	{
-		// Auf Nachricht warten
-		WaitMessage();
-		// Nachricht einlesen
-		GetMessage(&msg, NULL, 0, 0);
-		// Nachricht zur Verarbeitung durch WindowProc vorbereiten
-		TranslateMessage(&msg);
-		// Nachricht an WindowProc \xFCbergeben
-		DispatchMessage(&msg);
-
-		// \xDCberpr\xFCfen ob das Fenster geschlossen wurde
-		if (msg.message == WM_QUIT)
-		{
-			_WindowAlive = false;
-			return false;
-		}
-
-		// \xDCberpr\xFCfen, ob das Fenster den Focus wiedererlangt hat
-		if (HasFocus()) return true;
-	}
-}
-
-// Die WindowProc aller Fenster der Klasse
-LRESULT CALLBACK BS_Win32Window::WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
-	switch(uMsg)
-	{
-	case WM_PAINT:
-		ValidateRect(hwnd, NULL);
-		break;
-		
-	case WM_DESTROY:
-		// Das Fenster wird zerst\xF6rt
-		PostQuitMessage(0);
-		break;
-
-	case WM_CLOSE:
-		{
-			BS_Window * WindowPtr = BS_Kernel::GetInstance()->GetWindow();
-			if (WindowPtr) {
-				WindowPtr->SetCloseWanted(true);
-			}
-			break;
-		}
-
-	case WM_KEYDOWN:
-		{
-			// Tastendr\xFCcke, die f\xFCr das Inputmodul interessant sind, werden diesem gemeldet.
-			BS_InputEngine * InputPtr = BS_Kernel::GetInstance()->GetInput();
-
-			if (InputPtr)
-			{
-				switch (wParam)
-				{
-				case VK_RETURN:
-					InputPtr->ReportCommand(BS_InputEngine::KEY_COMMAND_ENTER);
-					break;
-
-				case VK_LEFT:
-					InputPtr->ReportCommand(BS_InputEngine::KEY_COMMAND_LEFT);
-					break;
-
-				case VK_RIGHT:
-					InputPtr->ReportCommand(BS_InputEngine::KEY_COMMAND_RIGHT);
-					break;
-
-				case VK_HOME:
-					InputPtr->ReportCommand(BS_InputEngine::KEY_COMMAND_HOME);
-					break;
-
-				case VK_END:
-					InputPtr->ReportCommand(BS_InputEngine::KEY_COMMAND_END);
-					break;
-
-				case VK_BACK:
-					InputPtr->ReportCommand(BS_InputEngine::KEY_COMMAND_BACKSPACE);
-					break;
-
-				case VK_TAB:
-					InputPtr->ReportCommand(BS_InputEngine::KEY_COMMAND_TAB);
-					break;
-
-				case VK_INSERT:
-					InputPtr->ReportCommand(BS_InputEngine::KEY_COMMAND_INSERT);
-					break;
-
-				case VK_DELETE:
-					InputPtr->ReportCommand(BS_InputEngine::KEY_COMMAND_DELETE);
-					break;
-				}
-			}
-			break;
-		}
-
-	case WM_KEYUP:
-	case WM_SYSKEYUP:
-		// Alle Tastendr\xFCcke werden ignoriert, damit Windows per DefWindowProc() nicht darauf
-		// reagieren kann und damit unerwartete Seiteneffekte ausl\xF6st.
-		// Zum Beispiel w\xFCrden ALT und F10 Tastendr\xFCcke das "Men\xFC" aktivieren und somit den Message-Loop zum Stillstand bringen.
-		break;
-
-	case WM_SYSCOMMAND:
-		// Verhindern, dass der Bildschirmschoner aktiviert wird, w\xE4hrend das Spiel l\xE4uft
-		if (wParam != SC_SCREENSAVE) return DefWindowProc(hwnd,uMsg,wParam,lParam);
-		break;
-
-	case WM_CHAR:
-		{
-			unsigned char theChar = static_cast<unsigned char>(wParam & 0xff);
-
-			// Alle Zeichen, die keine Steuerzeichen sind, werden als Buchstaben dem Input-Service mitgeteilt.
-			if (theChar >= 32)
-			{
-				BS_InputEngine * InputPtr = BS_Kernel::GetInstance()->GetInput();
-				if (InputPtr) InputPtr->ReportCharacter(theChar);
-			}
-		}
-		break;
-
-	case WM_SETCURSOR:
-		{
-			// Der Systemcursor wird in der Client-Area des Fensters nicht angezeigt, jedoch in der nicht Client-Area, damit der Benutzer das Fenster wie gewohnt
-			// schlie\xDFen und verschieben kann.
-
-			// Koordinaten des Cursors in der Client-Area berechnen.
-			POINT pt;
-			GetCursorPos(&pt);
-			ScreenToClient(hwnd, &pt);
-
-			// Feststellen, ob sich der Cursor in der Client-Area befindet.
-			// Get client rect
-			RECT rc;
-			GetClientRect(hwnd, &rc);
-
-			// See if cursor is in client area
-			if(PtInRect(&rc, pt))
-				// In der Client-Area keinen Cursor anzeigen.
-				SetCursor(NULL);
-			else
-				// Ausserhalb der Client-Area den Cursor anzeigen.
-				SetCursor(LoadCursor(NULL, IDC_ARROW));
-
-			return TRUE;
-		}
-		break;
-
-	default:
-		// Um alle anderen Vorkommnisse k\xFCmmert sich Windows
-		return DefWindowProc(hwnd,uMsg,wParam,lParam);
-	}
-
-	return 0;
-}

Deleted: scummvm/trunk/engines/sword25/kernel/win32window.h
===================================================================
--- scummvm/trunk/engines/sword25/kernel/win32window.h	2010-10-12 22:27:32 UTC (rev 53215)
+++ scummvm/trunk/engines/sword25/kernel/win32window.h	2010-10-12 22:28:21 UTC (rev 53216)
@@ -1,92 +0,0 @@
-/* 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
- *
- */
-
-/*
-	BS_Win32Window
-	-------------
-	Implementation des BS_Window Interfaces f\xFCr Win32.
-	Zu den einzelnen Methoden bitte "window.h" konsultieren.
-
-	Autor: Malte Thiesen
-*/
-
-#ifndef SWORD25_WIN32WINDOW_H
-#define SWORD25_WIN32WINDOW_H
-
-// Includes
-#include "sword25/kernel/memlog_off.h"
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include "sword25/kernel/memlog_on.h"
-
-#include "sword25/kernel/common.h"
-#include "sword25/kernel/window.h"
-
-// Klassendefinition
-class BS_Win32Window : public BS_Window
-{
-public:
-	BS_Win32Window(int X, int Y, int Width, int Height, bool Visible);
-	virtual ~BS_Win32Window();
-
-	bool IsVisible();
-	void SetVisible(bool Visible);
-	int GetX();
-	void SetX(int X);
-	int GetY();
-	void SetY(int X);
-	int GetClientX();
-	int GetClientY();
-	int GetWidth();
-	void SetWidth(int Width);
-	int GetHeight();
-	void SetHeight(int Height);
-	std::string GetTitle();
-	void SetTitle(std::string Title);
-	bool HasFocus();
-	UINT GetWindowHandle();
-	bool WaitForFocus();
-	bool ProcessMessages();
-
-private:
-	static bool _ClassRegistered;
-	bool _WindowAlive;	
-	HWND _Window;
-	int	 _ClientXDelta;
-	int	 _ClientYDelta;
-
-	static LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
-};
-
-#endif
\ No newline at end of file

Modified: scummvm/trunk/engines/sword25/kernel/window.cpp
===================================================================
--- scummvm/trunk/engines/sword25/kernel/window.cpp	2010-10-12 22:27:32 UTC (rev 53215)
+++ scummvm/trunk/engines/sword25/kernel/window.cpp	2010-10-12 22:28:21 UTC (rev 53216)
@@ -35,13 +35,14 @@
 #include "sword25/kernel/window.h"
 
 // Alle Implementationen von BS_Window m\xFCssen hier eingetragen werden
-#include "sword25/kernel/win32window.h"
+#include "sword25/kernel/scummvmwindow.h"
 
+namespace Sword25 {
+
 // Erstellt ein Fenster des GUI des aktuellen Betriebssystems
-BS_Window* BS_Window::CreateBSWindow(int X, int Y, int Width, int Height, bool Visible)
-{
+BS_Window *BS_Window::CreateBSWindow(int X, int Y, int Width, int Height, bool Visible) {
 	// Fenster erstellen
-	BS_Window* pWindow = (BS_Window*) new BS_Win32Window(X, Y, Width, Height, Visible);
+	BS_Window *pWindow = (BS_Window*) new BS_ScummVMWindow(X, Y, Width, Height, Visible);
 
 	// Falls das Fenster erfolgreich initialisiert wurde, wird ein Pointer auf das Fensterobjekt
 	// zur\xFCckgegeben
@@ -55,14 +56,14 @@
 
 // Gibt True zur\xFCck wenn das Fenster WM_CLOSE empfangen hat - 
 // solange, bis RejectClose() aufgerufen wurde.
-bool BS_Window::CloseWanted()
-{
+bool BS_Window::CloseWanted() {
 	bool result = _CloseWanted;
 	_CloseWanted = false;
 	return result;
 }
 
-void BS_Window::SetCloseWanted(bool Wanted)
-{
+void BS_Window::SetCloseWanted(bool Wanted) {
 	_CloseWanted = Wanted;
 }
+
+} // End of namespace Sword25

Modified: scummvm/trunk/engines/sword25/kernel/window.h
===================================================================
--- scummvm/trunk/engines/sword25/kernel/window.h	2010-10-12 22:27:32 UTC (rev 53215)
+++ scummvm/trunk/engines/sword25/kernel/window.h	2010-10-12 22:28:21 UTC (rev 53216)
@@ -144,8 +144,9 @@
 	 * Returns the system handle that represents the window. Note that any use of the handle
 	 * will not be portable code.
 	 */
-	virtual unsigned int GetWindowHandle() = 0;
+	virtual uint GetWindowHandle() = 0;
 
+	virtual void SetWindowAlive(bool v) = 0;
 
 	/**
 	 * Specifies whether the window is wanted to be closed. This is used together with CloseWanted()

Modified: scummvm/trunk/engines/sword25/module.mk
===================================================================
--- scummvm/trunk/engines/sword25/module.mk	2010-10-12 22:27:32 UTC (rev 53215)
+++ scummvm/trunk/engines/sword25/module.mk	2010-10-12 22:28:21 UTC (rev 53216)
@@ -49,8 +49,7 @@
 	kernel/persistenceservice.o \
 	kernel/resmanager.o \
 	kernel/resource.o \
-	kernel/timer.o \
-	kernel/win32window.o \
+	kernel/scummvmwindow.o \
 	kernel/window.o \
 	math/geometry.o \
 	math/geometry_script.o \

Modified: scummvm/trunk/engines/sword25/sword25.cpp
===================================================================
--- scummvm/trunk/engines/sword25/sword25.cpp	2010-10-12 22:27:32 UTC (rev 53215)
+++ scummvm/trunk/engines/sword25/sword25.cpp	2010-10-12 22:28:21 UTC (rev 53216)
@@ -65,9 +65,10 @@
 Common::Error Sword25Engine::run() {
 	// Engine initialisation
 	Common::StringArray commandParameters;
-	if (!AppStart(commandParameters)) {
+	Common::Error errorCode = AppStart(commandParameters);
+	if (errorCode != Common::kNoError) {
 		AppEnd();
-		error("A fatal error occured during engine startup");
+		return errorCode;
 	}
 
 	// Run the game
@@ -79,41 +80,47 @@
 	return (RunSuccess && DeinitSuccess) ? Common::kNoError : Common::kUnknownError;
 }
 
-bool Sword25Engine::AppStart(const Common::StringArray &CommandParameters) {
+Common::Error Sword25Engine::AppStart(const Common::StringArray &CommandParameters) {
 	// All log messages will be sent to StdOut
 	BS_Log::RegisterLogListener(LogToStdout);
 
+	// Initialise the graphics mode to RGBA8888
+	Graphics::PixelFormat format = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
+	initGraphics(800, 600, true, &format);
+	if (format != g_system->getScreenFormat())
+		return Common::kUnsupportedColorMode;
+
 	// Kernel initialisation
 	if (!BS_Kernel::GetInstance()->GetInitSuccess()) {
 		BS_LOG_ERRORLN("Kernel initialization failed.");
-		return false;
+		return Common::kUnknownError;
 	}
 
 	// Package-Manager starten, damit die Packfiles geladen werden k\xF6nnen.
 	BS_PackageManager *PackageManagerPtr = static_cast<BS_PackageManager *>(BS_Kernel::GetInstance()->NewService("package", PACKAGE_MANAGER));
 	if (!PackageManagerPtr) {
 		BS_LOG_ERRORLN("Packagemanager initialization failed.");
-		return false;
+		return Common::kUnknownError;
 	}
 
 	// Packages laden oder das aktuelle Verzeichnis mounten, wenn das \xFCber Kommandozeile angefordert wurde.
 	if (find(CommandParameters.begin(), CommandParameters.end(), MOUNT_DIR_PARAMETER) != CommandParameters.end()) {
-		if (!PackageManagerPtr->LoadDirectoryAsPackage(".", "/")) return false;
+		if (!PackageManagerPtr->LoadDirectoryAsPackage(".", "/")) return Common::kUnknownError;
 	} else {
-		if (!LoadPackages()) return false;
+		if (!LoadPackages()) return Common::kUnknownError;
 	}
 
 	// Einen Pointer auf den Skript-Engine holen.
 	BS_ScriptEngine *ScriptPtr = static_cast<BS_ScriptEngine *>(BS_Kernel::GetInstance()->GetService("script"));
 	if (!ScriptPtr) {
 		BS_LOG_ERRORLN("Skript intialization failed.");
-		return false;
+		return Common::kUnknownError;
 	}
 
 	// Die Kommandozeilen-Parameter der Skriptumgebung zug\xE4nglich machen.
 	ScriptPtr->SetCommandLine(CommandParameters);
 
-	return true;
+	return Common::kNoError;
 }
 
 bool Sword25Engine::AppMain() {

Modified: scummvm/trunk/engines/sword25/sword25.h
===================================================================
--- scummvm/trunk/engines/sword25/sword25.h	2010-10-12 22:27:32 UTC (rev 53215)
+++ scummvm/trunk/engines/sword25/sword25.h	2010-10-12 22:28:21 UTC (rev 53216)
@@ -51,7 +51,7 @@
 
 class Sword25Engine : public Engine {
 private:
-	bool AppStart(const Common::StringArray &CommandParameters);
+	Common::Error AppStart(const Common::StringArray &CommandParameters);
 	bool AppMain();
 	bool AppEnd();
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list