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/kernel/kernel.h | 344 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 344 insertions(+) create mode 100755 engines/sword25/kernel/kernel.h (limited to 'engines/sword25/kernel/kernel.h') diff --git a/engines/sword25/kernel/kernel.h b/engines/sword25/kernel/kernel.h new file mode 100755 index 0000000000..539ce7a9fb --- /dev/null +++ b/engines/sword25/kernel/kernel.h @@ -0,0 +1,344 @@ +// ----------------------------------------------------------------------------- +// 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 +// ----------------------------------------------------------------------------- + +/* + BS_Kernel + --------- + Dies ist die Hauptklasse der Engine. + Diese Klasse erzeugt und verwaltet alle anderen Enginelemente, wie Soundengine, Graphikengine... + Es ist nicht notwendig alle Enginenelemente einzeln freizugeben, dieses wird von der Kernelklasse übernommen. + + Autor: Malte Thiesen +*/ + +#ifndef _BS_KERNEL_H +#define _BS_KERNEL_H + +// Includes +#include "memlog_off.h" +#include +#include +#include +#include "memlog_on.h" + +#include "common.h" +#include "bs_stdint.h" +#include "window.h" +#include "resmanager.h" + + +// Klassendefinition +class BS_Service; +class BS_GraphicEngine; +class BS_ScriptEngine; +class BS_SoundEngine; +class BS_InputEngine; +class BS_PackageManager; +class BS_MoviePlayer; + +/** + @brief Dies ist die Hauptklasse der Engine. + + Diese Klasse erzeugt und verwaltet alle anderen Engineelemente, wie Soundengine, Graphikengine...
+ Es ist nicht notwendig alle Enginenelemente einzeln freizugeben, dieses wird von der Kernelklasse übernommen. +*/ +class BS_Kernel +{ +public: + // Fenster Methoden + // ---------------- + /** + @brief Gibt einen Pointer auf das Fensterobjekt zurück. + @return Gibt einen Pointer auf das Fensterobjekt zurück. + */ + BS_Window* GetWindow() {return _pWindow; } + + // Service Methoden + // ---------------- + + /** + @brief Erzeugt einen neuen Service der angegebenen Superclass mit dem übergebenen Identifier. + @param SuperclassIdentifier der Name der Superclass des Services
+ z.B: "sfx", "gfx", "package" ... + @param ServiceIdentifier der Name des Services
+ Für die Superclass "sfx" könnten das z.B. "fmod" oder "directsound" sein. + @return Gibt einen Pointer auf den Service zurück, oder NULL wenn der Service nicht erstellt werden konnte. + @remark Alle Services müssen in service_ids.h eingetragen sein, sonst können sie hier nicht erstellt werden. + */ + BS_Service* NewService(const std::string & SuperclassIdentifier, const std::string & ServiceIdentifier); + /** + @brief Beendet den aktuellen Service einer Superclass. + @param SuperclassIdentfier der Name der Superclass dessen aktiver Service beendet werden soll
+ z.B: "sfx", "gfx", "package" ... + @return Gibt bei Erfolg true zurück und false wenn die Superclass nicht existiert oder wenn kein Service aktiv war. + */ + bool DisconnectService(const std::string & SuperclassIdentifier); + + /** + @brief Gibt einen Pointer auf das momentan aktive Serviceobjekt einer Superclass zurück. + @param SuperclassIdentfier der Name der Superclass
+ z.B: "sfx", "gfx", "package" ... + @return Gibt einen Pointer auf den Service zurück, oder NULL wenn kein Service aktiv war. + */ + BS_Service* GetService(const std::string& SuperclassIdentifier); + + /** + @brief Gibt den Namen des aktuell aktiven Serviceobjektes einer Superclass zurück. + @param SuperclassIdentfier der Name der Superclass
+ z.B: "sfx", "gfx", "package" ... + @return Gibt den Namen des Serviceobjektes zurück, oder einen leeren String, wenn ein Fehler aufgetreten ist. + */ + std::string GetActiveServiceIdentifier(const std::string& SuperclassIdentifier); + + /** + @brief Gibt die Anzahl der Registrierten Superclasses zurück. + @return Gibt die Anzahl der Registrierten Superclasses zurück. + */ + unsigned int GetSuperclassCount(); + + // Gibt den Identifier der mit Number bezeichneten Superclass zurück + /** + @brief Gibt den Identifier einer Superclass zurück. + @param Number die Nummer der Superclass, dessen Bezeichner man erfahren möchte
+ Hierbei ist zu beachten, dass die erste Superclass die Nummer 0 erhält. Number muss also eine Zahl zwischen + 0 und GetSuperclassCount() - 1 sein. + @return Gibt den Identifier der Superclass zurück. + @remark Die Anzahl der Superclasses kann man mit GetSuperclassCount() erfahren. + */ + std::string GetSuperclassIdentifier(unsigned int Number); + + // Gibt die Anzahl der für die mit SuperclassIdentifier bezeichneten Superclass vorhandenen + // Services zurück + /** + @brief Gibt die Anzahl an Services zurück, die in einer Superclass registriert sind. + @param SuperclassIdentifier der Name der Superclass
+ z.B: "sfx", "gfx", "package" ... + @return Gibt die Anzahl an Services zurück, die in der Superclass registriert sind. + */ + unsigned int GetServiceCount(const std::string & SuperclassIdentifier); + + /** + @brief Gibt den Identifier eines Services in einer Superclass zurück. + @param SuperclassIdentifier der Name der Superclass
+ z.B: "sfx", "gfx", "package" ... + @param Number die Nummer des Services, dessen Bezeichner man erfahren will.
+ Hierbei ist zu beachten, dass der erste Service die Nummer 0 erhält. Number muss also eine Zahl zwischen + 0 und GetServiceCount() - 1 sein. + @return Gibt den Identifier des Services zurück + @remark Die Anzahl der Services in einer Superclass kann man mit GetServiceCount() erfahren. + */ + std::string GetServiceIdentifier(const std::string & SuperclassIdentifier, unsigned int Number); + /** + @brief Gibt die vergangene Zeit seit dem Systemstart in Millisekunden zurück. + */ + unsigned int GetMilliTicks(); + /** + @brief Gibt die vergangene Zeit seit dem Systemstart in Microsekunden zurück. + @remark Diese Methode sollte nur verwendet werden, falls GetMilliTick() für den gewünschten Einsatz zu ungenau ist. + */ + uint64_t GetMicroTicks(); + /** + @brief Gibt an, ob die Konstruktion erfolgreich war. + @return Gibt true zurück, wenn die Konstruktion erfolgreich war. + */ + bool GetInitSuccess() { return _InitSuccess; } + /** + @brief Gibt einen Pointer auf den BS_ResourceManager zurück. + */ + BS_ResourceManager* GetResourceManager() { return _pResourceManager; } + /** + @brief Gibt zurück wie viel Speicher von diesem Prozess belegt ist. + */ + size_t GetUsedMemory(); + /** + @brief Gibt eine Zufallszahl zurück. + @param Min der minimale Wert, den die Zufallszahl haben darf + @param Max der maximale Wert, den die Zufallszahl haben darf + @return Gibt eine Zufallszahl zurück, die zwischen Min und Max liegt. + */ + int GetRandomNumber(int Min, int Max); + /** + @brief Gibt einen Pointer auf den aktiven Gfx-Service zurück oder NULL wenn kein Gfx-Service aktiv. + */ + BS_GraphicEngine * GetGfx(); + /** + @brief Gibt einen Pointer auf den aktiven Sfx-Service zurück oder NULL wenn kein Sfx-Service aktiv. + */ + BS_SoundEngine * GetSfx(); + /** + @brief Gibt einen Pointer auf den aktiven Input-Service zurück oder NULL wenn kein Input-Service aktiv. + */ + BS_InputEngine * GetInput(); + /** + @brief Gibt einen Pointer auf den aktiven Package-Service zurück oder NULL wenn kein Package-Service aktiv. + */ + BS_PackageManager * GetPackage(); + /** + @brief Gibt einen Pointer auf den aktiven Script-Service zurück oder NULL wenn kein Script-Service aktiv. + */ + BS_ScriptEngine * GetScript(); + /** + @brief Gibt einen Pointer auf den aktiven FMV-Service zurück oder NULL wenn kein FMV-Service aktiv. + */ + BS_MoviePlayer * GetFMV(); + + /** + @brief Stoppt den Prozess für eine gewisse Zeit. + @param Msecs Zeit in Millisekunden, die der Prozess gestoppt werden soll. + @remark Es wird nicht garantiert, dass der Prozess genau nach der angegebenen Zeit wieder aktiv wird. + */ + void Sleep(unsigned int Msecs) const; + + /** + @brief Gibt das einzige Exemplar des Kernels zurück (Singleton). + */ + + static BS_Kernel * GetInstance() + { + if (!_Instance) _Instance = new BS_Kernel(); + return _Instance; + } + + /** + @brief Zerstört das einzige Exemplar des Kernels. + @remark Diese Methode darf nur zum Beenden des System aufgerufen werden. Nachfolgende Aufrufe sämtlicher Kernelmethoden liefern + undefinierte Ergebnisse. + */ + + static void DeleteInstance() + { + if (_Instance) + { + delete(_Instance); + _Instance = 0; + } + } + + /** + @brief Löst eine Schutzverletzung aus. + @remark Diese Methode dient zum Testen des Crash-Handlings. + */ + void Crash() const + { + __asm + { + xor eax, eax + mov [eax], 0 + } + } + +private: + + // ----------------------------------------------------------------------------- + // Konstruktion / Destruktion + // Private da Singleton + // ----------------------------------------------------------------------------- + + BS_Kernel(); + virtual ~BS_Kernel(); + + // ----------------------------------------------------------------------------- + // Singleton-Exemplar + // ----------------------------------------------------------------------------- + static BS_Kernel * _Instance; + + // Service Daten + // ------------- + class Superclass + { + private: + BS_Kernel* _pKernel; + unsigned int _ServiceCount; + std::string _Identifier; + BS_Service* _ActiveService; + std::string _ActiveServiceName; + + public: + Superclass (BS_Kernel* pKernel, const std::string& Identifier); + ~Superclass(); + + unsigned int GetServiceCount() const { return _ServiceCount; } + std::string GetIdentifier() const { return _Identifier; } + BS_Service* GetActiveService() const { return _ActiveService; } + std::string GetActiveServiceName() const { return _ActiveServiceName; } + std::string GetServiceIdentifier(unsigned int Number); + BS_Service* NewService(const std::string& ServiceIdentifier); + bool DisconnectService(); + }; + + std::vector _SuperclassList; + std::stack _ServiceCreationOrder; + Superclass* GetSuperclassByIdentifier(const std::string& Identifier); + + bool _InitSuccess; // Gibt an, ob die Konstruktion erfolgreich war + bool _Running; // Gibt an, ob die Applikation im nächsten Durchlauf des Main-Loops noch weiterlaufen soll + + // Fenster Variablen + // ----------------- + BS_Window* _pWindow; + + /* + // CPU-Feature Variablen und Methoden + // ---------------------------------- + enum _CPU_FEATURES_BITMASKS + { + _MMX_BITMASK = (1 << 23), + _SSE_BITMASK = (1 << 25), + _SSE2_BITMASK = (1 << 26), + _3DNOW_BITMASK = (1 << 30), + _3DNOWEXT_BITMASK = (1 << 31) + }; + + bool _DetectCPU(); + + bool _MMXPresent; + bool _SSEPresent; + bool _SSE2Present; + bool _3DNowPresent; + bool _3DNowExtPresent; + CPU_TYPES _CPUType; + std::string _CPUVendorID; + */ + + // Resourcemanager + // --------------- + BS_ResourceManager* _pResourceManager; + + bool _RegisterScriptBindings(); +}; + +// Dies ist nur eine kleine Klasse, die die Daten eines Services verwaltet. +// Ist ein wenig unschön, ich weiss, aber mit std::string ließ sich dass nicht mit einer +// einfachen struct bewerkstelligen. +class BS_ServiceInfo +{ +public: + BS_ServiceInfo(const std::string& SuperclassIdentifier, const std::string& ServiceIdentifier, BS_Service* (*CreateMethod)(BS_Kernel*)) + { + this->SuperclassIdentifier = SuperclassIdentifier; + this->ServiceIdentifier = ServiceIdentifier; + this->CreateMethod = CreateMethod; + }; + + std::string SuperclassIdentifier; + std::string ServiceIdentifier; + BS_Service* (*CreateMethod)(BS_Kernel*); +}; + +#endif -- cgit v1.2.3 From 385e4944394699327b380d841602d196cb85ec8d Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 29 Jul 2010 19:53:24 +0000 Subject: SWORD25: removed ASM usage svn-id: r53174 --- engines/sword25/kernel/kernel.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'engines/sword25/kernel/kernel.h') diff --git a/engines/sword25/kernel/kernel.h b/engines/sword25/kernel/kernel.h index 539ce7a9fb..8fda511451 100755 --- a/engines/sword25/kernel/kernel.h +++ b/engines/sword25/kernel/kernel.h @@ -236,11 +236,7 @@ public: */ void Crash() const { - __asm - { - xor eax, eax - mov [eax], 0 - } + error(0); } private: -- cgit v1.2.3 From 7b964a2823406721ec1200938948c0cfcdb3f1b1 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 29 Jul 2010 19:55:03 +0000 Subject: SWORD25: Make couple file compilable svn-id: r53179 --- engines/sword25/kernel/kernel.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'engines/sword25/kernel/kernel.h') diff --git a/engines/sword25/kernel/kernel.h b/engines/sword25/kernel/kernel.h index 8fda511451..6fb77133f6 100755 --- a/engines/sword25/kernel/kernel.h +++ b/engines/sword25/kernel/kernel.h @@ -27,20 +27,23 @@ Autor: Malte Thiesen */ -#ifndef _BS_KERNEL_H -#define _BS_KERNEL_H +#ifndef SWORD25_KERNEL_H +#define SWORD25_KERNEL_H + +#include "common/util.h" +#include "engines/engine.h" // Includes -#include "memlog_off.h" +#include "sword25/kernel/memlog_off.h" #include #include #include -#include "memlog_on.h" +#include "sword25/kernel/memlog_on.h" -#include "common.h" -#include "bs_stdint.h" -#include "window.h" -#include "resmanager.h" +#include "sword25/kernel/common.h" +#include "sword25/kernel/bs_stdint.h" +#include "sword25/kernel/window.h" +#include "sword25/kernel/resmanager.h" // Klassendefinition -- 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/kernel/kernel.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engines/sword25/kernel/kernel.h') diff --git a/engines/sword25/kernel/kernel.h b/engines/sword25/kernel/kernel.h index 6fb77133f6..0e488eb38b 100755 --- a/engines/sword25/kernel/kernel.h +++ b/engines/sword25/kernel/kernel.h @@ -328,11 +328,11 @@ private: class BS_ServiceInfo { public: - BS_ServiceInfo(const std::string& SuperclassIdentifier, const std::string& ServiceIdentifier, BS_Service* (*CreateMethod)(BS_Kernel*)) + BS_ServiceInfo(const std::string& SuperclassIdentifier_, const std::string& ServiceIdentifier_, BS_Service* (*CreateMethod_)(BS_Kernel*)) { - this->SuperclassIdentifier = SuperclassIdentifier; - this->ServiceIdentifier = ServiceIdentifier; - this->CreateMethod = CreateMethod; + this->SuperclassIdentifier = SuperclassIdentifier_; + this->ServiceIdentifier = ServiceIdentifier_; + this->CreateMethod = CreateMethod_; }; std::string SuperclassIdentifier; -- cgit v1.2.3 From e78b19a650e27fe9a24d0e4c9c938294c7b08650 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 31 Jul 2010 06:23:38 +0000 Subject: SWORD25: Converted kernel/kernel.cpp to compile under ScummVM This commit creates a skeleton detection and engine class, as well as code necessary to call the kernel initiation. The kernel/kernel.cpp has been converted to compile under ScummVM, along with all dependant header files. svn-id: r53184 --- engines/sword25/kernel/kernel.h | 405 +++++++++++++++++++--------------------- 1 file changed, 197 insertions(+), 208 deletions(-) (limited to 'engines/sword25/kernel/kernel.h') diff --git a/engines/sword25/kernel/kernel.h b/engines/sword25/kernel/kernel.h index 0e488eb38b..787eda4200 100755 --- a/engines/sword25/kernel/kernel.h +++ b/engines/sword25/kernel/kernel.h @@ -1,52 +1,53 @@ -// ----------------------------------------------------------------------------- -// 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 -// ----------------------------------------------------------------------------- - -/* - BS_Kernel - --------- - Dies ist die Hauptklasse der Engine. - Diese Klasse erzeugt und verwaltet alle anderen Enginelemente, wie Soundengine, Graphikengine... - Es ist nicht notwendig alle Enginenelemente einzeln freizugeben, dieses wird von der Kernelklasse übernommen. - - Autor: Malte Thiesen -*/ +/* 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$ + * + * BS_Kernel + * --------- + * This is the main class of the engine. + * This class creates and manages all other Engine elements: the sound engine, graphics engine ... + * It is not necessary to release all the items individually, this is performed by the Kernel class. + * + * Autor: Malte Thiesen + */ #ifndef SWORD25_KERNEL_H #define SWORD25_KERNEL_H +// Includes +#include "common/scummsys.h" +#include "common/random.h" +#include "common/stack.h" #include "common/util.h" #include "engines/engine.h" -// Includes -#include "sword25/kernel/memlog_off.h" -#include -#include -#include -#include "sword25/kernel/memlog_on.h" - #include "sword25/kernel/common.h" #include "sword25/kernel/bs_stdint.h" #include "sword25/kernel/window.h" #include "sword25/kernel/resmanager.h" +namespace Sword25 { -// Klassendefinition +// Class definitions class BS_Service; class BS_GraphicEngine; class BS_ScriptEngine; @@ -56,244 +57,230 @@ class BS_PackageManager; class BS_MoviePlayer; /** - @brief Dies ist die Hauptklasse der Engine. - - Diese Klasse erzeugt und verwaltet alle anderen Engineelemente, wie Soundengine, Graphikengine...
- Es ist nicht notwendig alle Enginenelemente einzeln freizugeben, dieses wird von der Kernelklasse übernommen. + * This is the main engine class + * + * This class creates and manages all other engine components such as sound engine, graphics engine ... + * It is not necessary to release all the items individually, this is performed by the Kernel class. */ -class BS_Kernel -{ +class BS_Kernel { public: - // Fenster Methoden + // Window methods // ---------------- + /** - @brief Gibt einen Pointer auf das Fensterobjekt zurück. - @return Gibt einen Pointer auf das Fensterobjekt zurück. - */ - BS_Window* GetWindow() {return _pWindow; } + * Returns a pointer to the window object + */ + BS_Window *GetWindow() { return _pWindow; } - // Service Methoden - // ---------------- + // Service Methods + // --------------- /** - @brief Erzeugt einen neuen Service der angegebenen Superclass mit dem übergebenen Identifier. - @param SuperclassIdentifier der Name der Superclass des Services
- z.B: "sfx", "gfx", "package" ... - @param ServiceIdentifier der Name des Services
- Für die Superclass "sfx" könnten das z.B. "fmod" oder "directsound" sein. - @return Gibt einen Pointer auf den Service zurück, oder NULL wenn der Service nicht erstellt werden konnte. - @remark Alle Services müssen in service_ids.h eingetragen sein, sonst können sie hier nicht erstellt werden. - */ - BS_Service* NewService(const std::string & SuperclassIdentifier, const std::string & ServiceIdentifier); + * Creates a new service with the given identifier. Returns a pointer to the service, or null if the + * service could not be created + * Note: All services must be registered in service_ids.h, otherwise they cannot be created here + * @param SuperclassIdentifier The name of the superclass of the service + * z.B: "sfx", "gfx", "package" ... + * @param ServiceIdentifier The name of the service + * For the superclass "sfx" an example could be "Fmod" or "directsound" + */ + BS_Service *NewService(const Common::String &SuperclassIdentifier, const Common::String &ServiceIdentifier); + /** - @brief Beendet den aktuellen Service einer Superclass. - @param SuperclassIdentfier der Name der Superclass dessen aktiver Service beendet werden soll
- z.B: "sfx", "gfx", "package" ... - @return Gibt bei Erfolg true zurück und false wenn die Superclass nicht existiert oder wenn kein Service aktiv war. - */ - bool DisconnectService(const std::string & SuperclassIdentifier); + * Ends the current service of a superclass. Returns true on success, and false if the superclass + * does not exist or if not service was active + * @param SuperclassIdentfier The name of the superclass which is to be disconnected + * z.B: "sfx", "gfx", "package" ... + */ + bool DisconnectService(const Common::String &SuperclassIdentifier); /** - @brief Gibt einen Pointer auf das momentan aktive Serviceobjekt einer Superclass zurück. - @param SuperclassIdentfier der Name der Superclass
- z.B: "sfx", "gfx", "package" ... - @return Gibt einen Pointer auf den Service zurück, oder NULL wenn kein Service aktiv war. - */ - BS_Service* GetService(const std::string& SuperclassIdentifier); + * Returns a pointer to the currently active service object of a superclass + * @param SuperclassIdentfier The name of the superclass + * z.B: "sfx", "gfx", "package" ... + */ + BS_Service *GetService(const Common::String &SuperclassIdentifier); /** - @brief Gibt den Namen des aktuell aktiven Serviceobjektes einer Superclass zurück. - @param SuperclassIdentfier der Name der Superclass
- z.B: "sfx", "gfx", "package" ... - @return Gibt den Namen des Serviceobjektes zurück, oder einen leeren String, wenn ein Fehler aufgetreten ist. - */ - std::string GetActiveServiceIdentifier(const std::string& SuperclassIdentifier); + * Returns the name of the currentl active service object of a superclass. + * If an error occurs, then an empty string is returned + * @param SuperclassIdentfier The name of the superclass + * z.B: "sfx", "gfx", "package" ... + */ + Common::String GetActiveServiceIdentifier(const Common::String &SuperclassIdentifier); /** - @brief Gibt die Anzahl der Registrierten Superclasses zurück. - @return Gibt die Anzahl der Registrierten Superclasses zurück. - */ + * Returns the number of register superclasses + */ unsigned int GetSuperclassCount(); - // Gibt den Identifier der mit Number bezeichneten Superclass zurück /** - @brief Gibt den Identifier einer Superclass zurück. - @param Number die Nummer der Superclass, dessen Bezeichner man erfahren möchte
- Hierbei ist zu beachten, dass die erste Superclass die Nummer 0 erhält. Number muss also eine Zahl zwischen - 0 und GetSuperclassCount() - 1 sein. - @return Gibt den Identifier der Superclass zurück. - @remark Die Anzahl der Superclasses kann man mit GetSuperclassCount() erfahren. - */ - std::string GetSuperclassIdentifier(unsigned int Number); + * Returns the name of a superclass with the specified index. + * Note: The number of superclasses can be retrieved using GetSuperclassCount + * @param Number The number of the superclass to return the identifier for. + * It should be noted that the number should be between 0 und GetSuperclassCount() - 1. + */ + Common::String GetSuperclassIdentifier(unsigned int Number); - // Gibt die Anzahl der für die mit SuperclassIdentifier bezeichneten Superclass vorhandenen - // Services zurück /** - @brief Gibt die Anzahl an Services zurück, die in einer Superclass registriert sind. - @param SuperclassIdentifier der Name der Superclass
- z.B: "sfx", "gfx", "package" ... - @return Gibt die Anzahl an Services zurück, die in der Superclass registriert sind. - */ - unsigned int GetServiceCount(const std::string & SuperclassIdentifier); + * Returns the number of services registered with a given superclass + * @param SuperclassIdentifier The name of the superclass + * z.B: "sfx", "gfx", "package" ... + */ + unsigned int GetServiceCount(const Common::String & SuperclassIdentifier); /** - @brief Gibt den Identifier eines Services in einer Superclass zurück. - @param SuperclassIdentifier der Name der Superclass
- z.B: "sfx", "gfx", "package" ... - @param Number die Nummer des Services, dessen Bezeichner man erfahren will.
- Hierbei ist zu beachten, dass der erste Service die Nummer 0 erhält. Number muss also eine Zahl zwischen - 0 und GetServiceCount() - 1 sein. - @return Gibt den Identifier des Services zurück - @remark Die Anzahl der Services in einer Superclass kann man mit GetServiceCount() erfahren. - */ - std::string GetServiceIdentifier(const std::string & SuperclassIdentifier, unsigned int Number); + * Gets the identifier of a service with a given superclass. + * The number of services in a superclass can be learned with GetServiceCount(). + * @param SuperclassIdentifier The name of the superclass + * z.B: "sfx", "gfx", "package" ... + * @param Number die Nummer des Services, dessen Bezeichner man erfahren will.
+ * Hierbei ist zu beachten, dass der erste Service die Nummer 0 erhält. Number muss also eine Zahl zwischen + * 0 und GetServiceCount() - 1 sein. + */ + Common::String GetServiceIdentifier(const Common::String &SuperclassIdentifier, unsigned int Number); + /** - @brief Gibt die vergangene Zeit seit dem Systemstart in Millisekunden zurück. + * Returns the elapsed time since startup in milliseconds */ unsigned int GetMilliTicks(); + /** - @brief Gibt die vergangene Zeit seit dem Systemstart in Microsekunden zurück. - @remark Diese Methode sollte nur verwendet werden, falls GetMilliTick() für den gewünschten Einsatz zu ungenau ist. - */ - uint64_t GetMicroTicks(); + * Returns the elapsed time since the system start in microseconds. + * This method should be used only if GetMilliTick() for the desired application is inaccurate. + */ + uint64 GetMicroTicks(); + /** - @brief Gibt an, ob die Konstruktion erfolgreich war. - @return Gibt true zurück, wenn die Konstruktion erfolgreich war. + * Specifies whether the kernel was successfully initialised */ bool GetInitSuccess() { return _InitSuccess; } /** - @brief Gibt einen Pointer auf den BS_ResourceManager zurück. - */ - BS_ResourceManager* GetResourceManager() { return _pResourceManager; } + * Returns a pointer to the BS_ResourceManager + */ + BS_ResourceManager *GetResourceManager() { return _pResourceManager; } /** - @brief Gibt zurück wie viel Speicher von diesem Prozess belegt ist. - */ + * Returns how much memory is being used + */ size_t GetUsedMemory(); /** - @brief Gibt eine Zufallszahl zurück. - @param Min der minimale Wert, den die Zufallszahl haben darf - @param Max der maximale Wert, den die Zufallszahl haben darf - @return Gibt eine Zufallszahl zurück, die zwischen Min und Max liegt. - */ + * Returns a random number + * @param Min The minimum allowed value + * @param Max The maximum allowed value + */ int GetRandomNumber(int Min, int Max); /** - @brief Gibt einen Pointer auf den aktiven Gfx-Service zurück oder NULL wenn kein Gfx-Service aktiv. - */ - BS_GraphicEngine * GetGfx(); + * Returns a pointer to the active Gfx Service, or NULL if no Gfx service is active + */ + BS_GraphicEngine *GetGfx(); /** - @brief Gibt einen Pointer auf den aktiven Sfx-Service zurück oder NULL wenn kein Sfx-Service aktiv. - */ - BS_SoundEngine * GetSfx(); + * Returns a pointer to the active Sfx Service, or NULL if no Sfx service is active + */ + BS_SoundEngine *GetSfx(); /** - @brief Gibt einen Pointer auf den aktiven Input-Service zurück oder NULL wenn kein Input-Service aktiv. - */ - BS_InputEngine * GetInput(); + * Returns a pointer to the active input service, or NULL if no input service is active + */ + BS_InputEngine *GetInput(); /** - @brief Gibt einen Pointer auf den aktiven Package-Service zurück oder NULL wenn kein Package-Service aktiv. - */ - BS_PackageManager * GetPackage(); + * Returns a pointer to the active package manager, or NULL if no manager is active + */ + BS_PackageManager *GetPackage(); /** - @brief Gibt einen Pointer auf den aktiven Script-Service zurück oder NULL wenn kein Script-Service aktiv. - */ - BS_ScriptEngine * GetScript(); + * Returns a pointer to the script engine, or NULL if it is not active + */ + BS_ScriptEngine *GetScript(); /** - @brief Gibt einen Pointer auf den aktiven FMV-Service zurück oder NULL wenn kein FMV-Service aktiv. - */ - BS_MoviePlayer * GetFMV(); + * Returns a pointer to the movie player, or NULL if it is not active + */ + BS_MoviePlayer *GetFMV(); /** - @brief Stoppt den Prozess für eine gewisse Zeit. - @param Msecs Zeit in Millisekunden, die der Prozess gestoppt werden soll. - @remark Es wird nicht garantiert, dass der Prozess genau nach der angegebenen Zeit wieder aktiv wird. - */ + * Pauses for the specified amount of time + * @param Msecs The amount of time in milliseconds + */ void Sleep(unsigned int Msecs) const; /** - @brief Gibt das einzige Exemplar des Kernels zurück (Singleton). - */ - - static BS_Kernel * GetInstance() - { + * Returns the singleton instance for the kernel + */ + static BS_Kernel *GetInstance() { if (!_Instance) _Instance = new BS_Kernel(); return _Instance; } /** - @brief Zerstört das einzige Exemplar des Kernels. - @remark Diese Methode darf nur zum Beenden des System aufgerufen werden. Nachfolgende Aufrufe sämtlicher Kernelmethoden liefern - undefinierte Ergebnisse. - */ - - static void DeleteInstance() - { - if (_Instance) - { - delete(_Instance); - _Instance = 0; + * Destroys the kernel instance + * This method should only be called when the game is ended. No subsequent calls to any kernel + * methods should be done after calling this method. + */ + static void DeleteInstance() { + if (_Instance) { + delete _Instance; + _Instance = NULL; } } /** - @brief Löst eine Schutzverletzung aus. - @remark Diese Methode dient zum Testen des Crash-Handlings. - */ - void Crash() const - { - error(0); + * Raises an error. This method is used in crashing testing. + */ + void Crash() const { + error("BS_Kernel::Crash"); } private: - // ----------------------------------------------------------------------------- - // Konstruktion / Destruktion - // Private da Singleton + // Constructor / destructor + // Private singleton methods // ----------------------------------------------------------------------------- BS_Kernel(); virtual ~BS_Kernel(); // ----------------------------------------------------------------------------- - // Singleton-Exemplar + // Singleton instance // ----------------------------------------------------------------------------- - static BS_Kernel * _Instance; + static BS_Kernel *_Instance; - // Service Daten - // ------------- - class Superclass - { + // Superclass class + // ---------------- + class Superclass { private: - BS_Kernel* _pKernel; - unsigned int _ServiceCount; - std::string _Identifier; - BS_Service* _ActiveService; - std::string _ActiveServiceName; + BS_Kernel *_pKernel; + unsigned int _ServiceCount; + Common::String _Identifier; + BS_Service *_ActiveService; + Common::String _ActiveServiceName; public: - Superclass (BS_Kernel* pKernel, const std::string& Identifier); + Superclass (BS_Kernel *pKernel, const Common::String &Identifier); ~Superclass(); unsigned int GetServiceCount() const { return _ServiceCount; } - std::string GetIdentifier() const { return _Identifier; } - BS_Service* GetActiveService() const { return _ActiveService; } - std::string GetActiveServiceName() const { return _ActiveServiceName; } - std::string GetServiceIdentifier(unsigned int Number); - BS_Service* NewService(const std::string& ServiceIdentifier); + Common::String GetIdentifier() const { return _Identifier; } + BS_Service *GetActiveService() const { return _ActiveService; } + Common::String GetActiveServiceName() const { return _ActiveServiceName; } + Common::String GetServiceIdentifier(unsigned int Number); + BS_Service *NewService(const Common::String &ServiceIdentifier); bool DisconnectService(); }; - std::vector _SuperclassList; - std::stack _ServiceCreationOrder; - Superclass* GetSuperclassByIdentifier(const std::string& Identifier); + Common::Array _SuperclassList; + Common::Stack _ServiceCreationOrder; + Superclass *GetSuperclassByIdentifier(const Common::String &Identifier); - bool _InitSuccess; // Gibt an, ob die Konstruktion erfolgreich war - bool _Running; // Gibt an, ob die Applikation im nächsten Durchlauf des Main-Loops noch weiterlaufen soll + bool _InitSuccess; // Specifies whether the engine was set up correctly + bool _Running; // Specifies whether the application should keep running on the next main loop iteration - // Fenster Variablen - // ----------------- - BS_Window* _pWindow; + // Active window + // ------------- + BS_Window *_pWindow; + + // Random number generator + // ----------------------- + Common::RandomSource _rnd; /* - // CPU-Feature Variablen und Methoden + // Features variables and methods // ---------------------------------- enum _CPU_FEATURES_BITMASKS { @@ -312,32 +299,34 @@ private: bool _3DNowPresent; bool _3DNowExtPresent; CPU_TYPES _CPUType; - std::string _CPUVendorID; + Common::String _CPUVendorID; */ // Resourcemanager // --------------- - BS_ResourceManager* _pResourceManager; + BS_ResourceManager *_pResourceManager; bool _RegisterScriptBindings(); }; -// Dies ist nur eine kleine Klasse, die die Daten eines Services verwaltet. -// Ist ein wenig unschön, ich weiss, aber mit std::string ließ sich dass nicht mit einer -// einfachen struct bewerkstelligen. -class BS_ServiceInfo -{ +/** + * This is only a small class that manages the data of a service. It is a little ugly, I know, + * but with Common::String a simple struct could not be used. + */ +class BS_ServiceInfo { public: - BS_ServiceInfo(const std::string& SuperclassIdentifier_, const std::string& ServiceIdentifier_, BS_Service* (*CreateMethod_)(BS_Kernel*)) - { + BS_ServiceInfo(const Common::String &SuperclassIdentifier_, const Common::String& ServiceIdentifier_, + BS_Service* (*CreateMethod_)(BS_Kernel*)) { this->SuperclassIdentifier = SuperclassIdentifier_; this->ServiceIdentifier = ServiceIdentifier_; this->CreateMethod = CreateMethod_; }; - std::string SuperclassIdentifier; - std::string ServiceIdentifier; - BS_Service* (*CreateMethod)(BS_Kernel*); + Common::String SuperclassIdentifier; + Common::String ServiceIdentifier; + BS_Service* (*CreateMethod)(BS_Kernel *); }; +} + #endif -- 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/kernel/kernel.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) mode change 100755 => 100644 engines/sword25/kernel/kernel.h (limited to 'engines/sword25/kernel/kernel.h') diff --git a/engines/sword25/kernel/kernel.h b/engines/sword25/kernel/kernel.h old mode 100755 new mode 100644 index 787eda4200..692a4a215d --- a/engines/sword25/kernel/kernel.h +++ b/engines/sword25/kernel/kernel.h @@ -21,6 +21,18 @@ * $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_Kernel * --------- * This is the main class of the engine. -- cgit v1.2.3 From 53a9d2d0a1dab1119dc1cc12886321fa72743061 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 1 Aug 2010 08:31:50 +0000 Subject: SWORD25: Converted the math folder files svn-id: r53197 --- engines/sword25/kernel/kernel.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'engines/sword25/kernel/kernel.h') diff --git a/engines/sword25/kernel/kernel.h b/engines/sword25/kernel/kernel.h index 692a4a215d..d09cf68ab6 100644 --- a/engines/sword25/kernel/kernel.h +++ b/engines/sword25/kernel/kernel.h @@ -339,6 +339,18 @@ public: BS_Service* (*CreateMethod)(BS_Kernel *); }; +template +void ReverseArray(Common::Array Arr) { + if (Arr.size() < 2) + return; + + for (uint i = 0; i < (Arr.size() / 2 - 1); ++i) { + T temp = Arr[i]; + Arr[i] = Arr[Arr.size() - i - 1]; + Arr[Arr.size() - i - 1] = temp; + } } +} // End of namespace Sword25 + #endif -- 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/kernel/kernel.h | 144 ++++++++++++++++++++++------------------ 1 file changed, 79 insertions(+), 65 deletions(-) (limited to 'engines/sword25/kernel/kernel.h') diff --git a/engines/sword25/kernel/kernel.h b/engines/sword25/kernel/kernel.h index d09cf68ab6..b610c0caab 100644 --- a/engines/sword25/kernel/kernel.h +++ b/engines/sword25/kernel/kernel.h @@ -23,7 +23,7 @@ * */ -/* +/* * This code is based on Broken Sword 2.5 engine * * Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer @@ -71,7 +71,7 @@ class BS_MoviePlayer; /** * This is the main engine class * - * This class creates and manages all other engine components such as sound engine, graphics engine ... + * This class creates and manages all other engine components such as sound engine, graphics engine ... * It is not necessary to release all the items individually, this is performed by the Kernel class. */ class BS_Kernel { @@ -82,42 +82,44 @@ public: /** * Returns a pointer to the window object */ - BS_Window *GetWindow() { return _pWindow; } + BS_Window *GetWindow() { + return _pWindow; + } // Service Methods // --------------- /** - * Creates a new service with the given identifier. Returns a pointer to the service, or null if the + * Creates a new service with the given identifier. Returns a pointer to the service, or null if the * service could not be created - * Note: All services must be registered in service_ids.h, otherwise they cannot be created here - * @param SuperclassIdentifier The name of the superclass of the service - * z.B: "sfx", "gfx", "package" ... - * @param ServiceIdentifier The name of the service - * For the superclass "sfx" an example could be "Fmod" or "directsound" + * Note: All services must be registered in service_ids.h, otherwise they cannot be created here + * @param SuperclassIdentifier The name of the superclass of the service + * z.B: "sfx", "gfx", "package" ... + * @param ServiceIdentifier The name of the service + * For the superclass "sfx" an example could be "Fmod" or "directsound" */ BS_Service *NewService(const Common::String &SuperclassIdentifier, const Common::String &ServiceIdentifier); /** - * Ends the current service of a superclass. Returns true on success, and false if the superclass + * Ends the current service of a superclass. Returns true on success, and false if the superclass * does not exist or if not service was active - * @param SuperclassIdentfier The name of the superclass which is to be disconnected - * z.B: "sfx", "gfx", "package" ... + * @param SuperclassIdentfier The name of the superclass which is to be disconnected + * z.B: "sfx", "gfx", "package" ... */ bool DisconnectService(const Common::String &SuperclassIdentifier); /** * Returns a pointer to the currently active service object of a superclass - * @param SuperclassIdentfier The name of the superclass - * z.B: "sfx", "gfx", "package" ... + * @param SuperclassIdentfier The name of the superclass + * z.B: "sfx", "gfx", "package" ... */ BS_Service *GetService(const Common::String &SuperclassIdentifier); /** * Returns the name of the currentl active service object of a superclass. * If an error occurs, then an empty string is returned - * @param SuperclassIdentfier The name of the superclass - * z.B: "sfx", "gfx", "package" ... + * @param SuperclassIdentfier The name of the superclass + * z.B: "sfx", "gfx", "package" ... */ Common::String GetActiveServiceIdentifier(const Common::String &SuperclassIdentifier); @@ -129,26 +131,26 @@ public: /** * Returns the name of a superclass with the specified index. * Note: The number of superclasses can be retrieved using GetSuperclassCount - * @param Number The number of the superclass to return the identifier for. + * @param Number The number of the superclass to return the identifier for. * It should be noted that the number should be between 0 und GetSuperclassCount() - 1. */ Common::String GetSuperclassIdentifier(unsigned int Number); /** * Returns the number of services registered with a given superclass - * @param SuperclassIdentifier The name of the superclass - * z.B: "sfx", "gfx", "package" ... + * @param SuperclassIdentifier The name of the superclass + * z.B: "sfx", "gfx", "package" ... */ - unsigned int GetServiceCount(const Common::String & SuperclassIdentifier); + unsigned int GetServiceCount(const Common::String &SuperclassIdentifier); /** * Gets the identifier of a service with a given superclass. * The number of services in a superclass can be learned with GetServiceCount(). - * @param SuperclassIdentifier The name of the superclass - * z.B: "sfx", "gfx", "package" ... + * @param SuperclassIdentifier The name of the superclass + * z.B: "sfx", "gfx", "package" ... * @param Number die Nummer des Services, dessen Bezeichner man erfahren will.
- * Hierbei ist zu beachten, dass der erste Service die Nummer 0 erhält. Number muss also eine Zahl zwischen - * 0 und GetServiceCount() - 1 sein. + * Hierbei ist zu beachten, dass der erste Service die Nummer 0 erhält. Number muss also eine Zahl zwischen + * 0 und GetServiceCount() - 1 sein. */ Common::String GetServiceIdentifier(const Common::String &SuperclassIdentifier, unsigned int Number); @@ -166,19 +168,23 @@ public: /** * Specifies whether the kernel was successfully initialised */ - bool GetInitSuccess() { return _InitSuccess; } + bool GetInitSuccess() { + return _InitSuccess; + } /** * Returns a pointer to the BS_ResourceManager */ - BS_ResourceManager *GetResourceManager() { return _pResourceManager; } + BS_ResourceManager *GetResourceManager() { + return _pResourceManager; + } /** * Returns how much memory is being used */ size_t GetUsedMemory(); /** * Returns a random number - * @param Min The minimum allowed value - * @param Max The maximum allowed value + * @param Min The minimum allowed value + * @param Max The maximum allowed value */ int GetRandomNumber(int Min, int Max); /** @@ -208,14 +214,14 @@ public: /** * Pauses for the specified amount of time - * @param Msecs The amount of time in milliseconds + * @param Msecs The amount of time in milliseconds */ void Sleep(unsigned int Msecs) const; /** * Returns the singleton instance for the kernel */ - static BS_Kernel *GetInstance() { + static BS_Kernel *GetInstance() { if (!_Instance) _Instance = new BS_Kernel(); return _Instance; } @@ -238,13 +244,13 @@ public: void Crash() const { error("BS_Kernel::Crash"); } - + private: // ----------------------------------------------------------------------------- // Constructor / destructor // Private singleton methods // ----------------------------------------------------------------------------- - + BS_Kernel(); virtual ~BS_Kernel(); @@ -262,27 +268,35 @@ private: Common::String _Identifier; BS_Service *_ActiveService; Common::String _ActiveServiceName; - + public: - Superclass (BS_Kernel *pKernel, const Common::String &Identifier); + Superclass(BS_Kernel *pKernel, const Common::String &Identifier); ~Superclass(); - - unsigned int GetServiceCount() const { return _ServiceCount; } - Common::String GetIdentifier() const { return _Identifier; } - BS_Service *GetActiveService() const { return _ActiveService; } - Common::String GetActiveServiceName() const { return _ActiveServiceName; } + + unsigned int GetServiceCount() const { + return _ServiceCount; + } + Common::String GetIdentifier() const { + return _Identifier; + } + BS_Service *GetActiveService() const { + return _ActiveService; + } + Common::String GetActiveServiceName() const { + return _ActiveServiceName; + } Common::String GetServiceIdentifier(unsigned int Number); BS_Service *NewService(const Common::String &ServiceIdentifier); bool DisconnectService(); }; - - Common::Array _SuperclassList; - Common::Stack _ServiceCreationOrder; + + Common::Array _SuperclassList; + Common::Stack _ServiceCreationOrder; Superclass *GetSuperclassByIdentifier(const Common::String &Identifier); - + bool _InitSuccess; // Specifies whether the engine was set up correctly - bool _Running; // Specifies whether the application should keep running on the next main loop iteration - + bool _Running; // Specifies whether the application should keep running on the next main loop iteration + // Active window // ------------- BS_Window *_pWindow; @@ -296,22 +310,22 @@ private: // ---------------------------------- enum _CPU_FEATURES_BITMASKS { - _MMX_BITMASK = (1 << 23), - _SSE_BITMASK = (1 << 25), - _SSE2_BITMASK = (1 << 26), - _3DNOW_BITMASK = (1 << 30), - _3DNOWEXT_BITMASK = (1 << 31) + _MMX_BITMASK = (1 << 23), + _SSE_BITMASK = (1 << 25), + _SSE2_BITMASK = (1 << 26), + _3DNOW_BITMASK = (1 << 30), + _3DNOWEXT_BITMASK = (1 << 31) }; - bool _DetectCPU(); + bool _DetectCPU(); - bool _MMXPresent; - bool _SSEPresent; - bool _SSE2Present; - bool _3DNowPresent; - bool _3DNowExtPresent; - CPU_TYPES _CPUType; - Common::String _CPUVendorID; + bool _MMXPresent; + bool _SSEPresent; + bool _SSE2Present; + bool _3DNowPresent; + bool _3DNowExtPresent; + CPU_TYPES _CPUType; + Common::String _CPUVendorID; */ // Resourcemanager @@ -322,21 +336,21 @@ private: }; /** - * This is only a small class that manages the data of a service. It is a little ugly, I know, + * This is only a small class that manages the data of a service. It is a little ugly, I know, * but with Common::String a simple struct could not be used. */ class BS_ServiceInfo { public: - BS_ServiceInfo(const Common::String &SuperclassIdentifier_, const Common::String& ServiceIdentifier_, - BS_Service* (*CreateMethod_)(BS_Kernel*)) { + BS_ServiceInfo(const Common::String &SuperclassIdentifier_, const Common::String &ServiceIdentifier_, + BS_Service*(*CreateMethod_)(BS_Kernel *)) { this->SuperclassIdentifier = SuperclassIdentifier_; this->ServiceIdentifier = ServiceIdentifier_; this->CreateMethod = CreateMethod_; }; - - Common::String SuperclassIdentifier; - Common::String ServiceIdentifier; - BS_Service* (*CreateMethod)(BS_Kernel *); + + Common::String SuperclassIdentifier; + Common::String ServiceIdentifier; + BS_Service*(*CreateMethod)(BS_Kernel *); }; template -- 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/kernel/kernel.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engines/sword25/kernel/kernel.h') diff --git a/engines/sword25/kernel/kernel.h b/engines/sword25/kernel/kernel.h index b610c0caab..1ccf03b879 100644 --- a/engines/sword25/kernel/kernel.h +++ b/engines/sword25/kernel/kernel.h @@ -61,12 +61,12 @@ namespace Sword25 { // Class definitions class BS_Service; -class BS_GraphicEngine; +class GraphicEngine; class BS_ScriptEngine; class BS_SoundEngine; class BS_InputEngine; class BS_PackageManager; -class BS_MoviePlayer; +class MoviePlayer; /** * This is the main engine class @@ -190,7 +190,7 @@ public: /** * Returns a pointer to the active Gfx Service, or NULL if no Gfx service is active */ - BS_GraphicEngine *GetGfx(); + GraphicEngine *GetGfx(); /** * Returns a pointer to the active Sfx Service, or NULL if no Sfx service is active */ @@ -210,7 +210,7 @@ public: /** * Returns a pointer to the movie player, or NULL if it is not active */ - BS_MoviePlayer *GetFMV(); + MoviePlayer *GetFMV(); /** * Pauses for the specified amount of time -- cgit v1.2.3 From be44216e5c1d74879d7843215ce1cd3f488b4db8 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 18 Aug 2010 12:57:47 +0000 Subject: SWORD25: eliminated BS_ prefix in all but kernel/ svn-id: r53259 --- engines/sword25/kernel/kernel.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'engines/sword25/kernel/kernel.h') diff --git a/engines/sword25/kernel/kernel.h b/engines/sword25/kernel/kernel.h index 1ccf03b879..e7861db32b 100644 --- a/engines/sword25/kernel/kernel.h +++ b/engines/sword25/kernel/kernel.h @@ -62,10 +62,10 @@ namespace Sword25 { // Class definitions class BS_Service; class GraphicEngine; -class BS_ScriptEngine; -class BS_SoundEngine; -class BS_InputEngine; -class BS_PackageManager; +class ScriptEngine; +class SoundEngine; +class InputEngine; +class PackageManager; class MoviePlayer; /** @@ -194,19 +194,19 @@ public: /** * Returns a pointer to the active Sfx Service, or NULL if no Sfx service is active */ - BS_SoundEngine *GetSfx(); + SoundEngine *GetSfx(); /** * Returns a pointer to the active input service, or NULL if no input service is active */ - BS_InputEngine *GetInput(); + InputEngine *GetInput(); /** * Returns a pointer to the active package manager, or NULL if no manager is active */ - BS_PackageManager *GetPackage(); + PackageManager *GetPackage(); /** * Returns a pointer to the script engine, or NULL if it is not active */ - BS_ScriptEngine *GetScript(); + ScriptEngine *GetScript(); /** * Returns a pointer to the movie player, or NULL if it is not active */ -- 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/kernel/kernel.h | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'engines/sword25/kernel/kernel.h') diff --git a/engines/sword25/kernel/kernel.h b/engines/sword25/kernel/kernel.h index e7861db32b..76b092383d 100644 --- a/engines/sword25/kernel/kernel.h +++ b/engines/sword25/kernel/kernel.h @@ -60,7 +60,7 @@ namespace Sword25 { // Class definitions -class BS_Service; +class Service; class GraphicEngine; class ScriptEngine; class SoundEngine; @@ -74,7 +74,7 @@ class MoviePlayer; * This class creates and manages all other engine components such as sound engine, graphics engine ... * It is not necessary to release all the items individually, this is performed by the Kernel class. */ -class BS_Kernel { +class Kernel { public: // Window methods // ---------------- @@ -82,7 +82,7 @@ public: /** * Returns a pointer to the window object */ - BS_Window *GetWindow() { + Window *GetWindow() { return _pWindow; } @@ -98,7 +98,7 @@ public: * @param ServiceIdentifier The name of the service * For the superclass "sfx" an example could be "Fmod" or "directsound" */ - BS_Service *NewService(const Common::String &SuperclassIdentifier, const Common::String &ServiceIdentifier); + Service *NewService(const Common::String &SuperclassIdentifier, const Common::String &ServiceIdentifier); /** * Ends the current service of a superclass. Returns true on success, and false if the superclass @@ -113,7 +113,7 @@ public: * @param SuperclassIdentfier The name of the superclass * z.B: "sfx", "gfx", "package" ... */ - BS_Service *GetService(const Common::String &SuperclassIdentifier); + Service *GetService(const Common::String &SuperclassIdentifier); /** * Returns the name of the currentl active service object of a superclass. @@ -174,7 +174,7 @@ public: /** * Returns a pointer to the BS_ResourceManager */ - BS_ResourceManager *GetResourceManager() { + ResourceManager *GetResourceManager() { return _pResourceManager; } /** @@ -221,8 +221,8 @@ public: /** * Returns the singleton instance for the kernel */ - static BS_Kernel *GetInstance() { - if (!_Instance) _Instance = new BS_Kernel(); + static Kernel *GetInstance() { + if (!_Instance) _Instance = new Kernel(); return _Instance; } @@ -251,26 +251,26 @@ private: // Private singleton methods // ----------------------------------------------------------------------------- - BS_Kernel(); - virtual ~BS_Kernel(); + Kernel(); + virtual ~Kernel(); // ----------------------------------------------------------------------------- // Singleton instance // ----------------------------------------------------------------------------- - static BS_Kernel *_Instance; + static Kernel *_Instance; // Superclass class // ---------------- class Superclass { private: - BS_Kernel *_pKernel; + Kernel *_pKernel; unsigned int _ServiceCount; Common::String _Identifier; - BS_Service *_ActiveService; + Service *_ActiveService; Common::String _ActiveServiceName; public: - Superclass(BS_Kernel *pKernel, const Common::String &Identifier); + Superclass(Kernel *pKernel, const Common::String &Identifier); ~Superclass(); unsigned int GetServiceCount() const { @@ -279,14 +279,14 @@ private: Common::String GetIdentifier() const { return _Identifier; } - BS_Service *GetActiveService() const { + Service *GetActiveService() const { return _ActiveService; } Common::String GetActiveServiceName() const { return _ActiveServiceName; } Common::String GetServiceIdentifier(unsigned int Number); - BS_Service *NewService(const Common::String &ServiceIdentifier); + Service *NewService(const Common::String &ServiceIdentifier); bool DisconnectService(); }; @@ -299,7 +299,7 @@ private: // Active window // ------------- - BS_Window *_pWindow; + Window *_pWindow; // Random number generator // ----------------------- @@ -330,7 +330,7 @@ private: // Resourcemanager // --------------- - BS_ResourceManager *_pResourceManager; + ResourceManager *_pResourceManager; bool _RegisterScriptBindings(); }; @@ -342,7 +342,7 @@ private: class BS_ServiceInfo { public: BS_ServiceInfo(const Common::String &SuperclassIdentifier_, const Common::String &ServiceIdentifier_, - BS_Service*(*CreateMethod_)(BS_Kernel *)) { + Service*(*CreateMethod_)(Kernel *)) { this->SuperclassIdentifier = SuperclassIdentifier_; this->ServiceIdentifier = ServiceIdentifier_; this->CreateMethod = CreateMethod_; @@ -350,7 +350,7 @@ public: Common::String SuperclassIdentifier; Common::String ServiceIdentifier; - BS_Service*(*CreateMethod)(BS_Kernel *); + Service*(*CreateMethod)(Kernel *); }; template -- 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/kernel/kernel.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'engines/sword25/kernel/kernel.h') diff --git a/engines/sword25/kernel/kernel.h b/engines/sword25/kernel/kernel.h index 76b092383d..d4e9bfea86 100644 --- a/engines/sword25/kernel/kernel.h +++ b/engines/sword25/kernel/kernel.h @@ -126,7 +126,7 @@ public: /** * Returns the number of register superclasses */ - unsigned int GetSuperclassCount(); + uint GetSuperclassCount(); /** * Returns the name of a superclass with the specified index. @@ -134,14 +134,14 @@ public: * @param Number The number of the superclass to return the identifier for. * It should be noted that the number should be between 0 und GetSuperclassCount() - 1. */ - Common::String GetSuperclassIdentifier(unsigned int Number); + Common::String GetSuperclassIdentifier(uint Number); /** * Returns the number of services registered with a given superclass * @param SuperclassIdentifier The name of the superclass * z.B: "sfx", "gfx", "package" ... */ - unsigned int GetServiceCount(const Common::String &SuperclassIdentifier); + uint GetServiceCount(const Common::String &SuperclassIdentifier); /** * Gets the identifier of a service with a given superclass. @@ -152,12 +152,12 @@ public: * Hierbei ist zu beachten, dass der erste Service die Nummer 0 erhält. Number muss also eine Zahl zwischen * 0 und GetServiceCount() - 1 sein. */ - Common::String GetServiceIdentifier(const Common::String &SuperclassIdentifier, unsigned int Number); + Common::String GetServiceIdentifier(const Common::String &SuperclassIdentifier, uint Number); /** * Returns the elapsed time since startup in milliseconds */ - unsigned int GetMilliTicks(); + uint GetMilliTicks(); /** * Returns the elapsed time since the system start in microseconds. @@ -216,7 +216,7 @@ public: * Pauses for the specified amount of time * @param Msecs The amount of time in milliseconds */ - void Sleep(unsigned int Msecs) const; + void Sleep(uint Msecs) const; /** * Returns the singleton instance for the kernel @@ -264,7 +264,7 @@ private: class Superclass { private: Kernel *_pKernel; - unsigned int _ServiceCount; + uint _ServiceCount; Common::String _Identifier; Service *_ActiveService; Common::String _ActiveServiceName; @@ -273,7 +273,7 @@ private: Superclass(Kernel *pKernel, const Common::String &Identifier); ~Superclass(); - unsigned int GetServiceCount() const { + uint GetServiceCount() const { return _ServiceCount; } Common::String GetIdentifier() const { @@ -285,7 +285,7 @@ private: Common::String GetActiveServiceName() const { return _ActiveServiceName; } - Common::String GetServiceIdentifier(unsigned int Number); + Common::String GetServiceIdentifier(uint Number); Service *NewService(const Common::String &ServiceIdentifier); bool DisconnectService(); }; -- cgit v1.2.3 From 3e9610c6016e76f55672214896336c419eeff665 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 14 Sep 2010 09:28:48 +0000 Subject: SWORD25: Fix for path-finding svn-id: r53348 --- engines/sword25/kernel/kernel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/sword25/kernel/kernel.h') diff --git a/engines/sword25/kernel/kernel.h b/engines/sword25/kernel/kernel.h index d4e9bfea86..c939f1ce23 100644 --- a/engines/sword25/kernel/kernel.h +++ b/engines/sword25/kernel/kernel.h @@ -354,7 +354,7 @@ public: }; template -void ReverseArray(Common::Array Arr) { +void ReverseArray(Common::Array &Arr) { if (Arr.size() < 2) return; -- cgit v1.2.3 From 3fe27789709bbf5bf68a782a26fc11aaf8ca4e68 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 14 Sep 2010 09:53:58 +0000 Subject: SWORD25: Fix to array reversal, fixing path-finding svn-id: r53349 --- engines/sword25/kernel/kernel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/sword25/kernel/kernel.h') diff --git a/engines/sword25/kernel/kernel.h b/engines/sword25/kernel/kernel.h index c939f1ce23..55a64c783f 100644 --- a/engines/sword25/kernel/kernel.h +++ b/engines/sword25/kernel/kernel.h @@ -358,7 +358,7 @@ void ReverseArray(Common::Array &Arr) { if (Arr.size() < 2) return; - for (uint i = 0; i < (Arr.size() / 2 - 1); ++i) { + for (uint i = 0; i <= (Arr.size() / 2 - 1); ++i) { T temp = Arr[i]; Arr[i] = Arr[Arr.size() - i - 1]; Arr[Arr.size() - i - 1] = temp; -- cgit v1.2.3