Mercurial > sumwars
changeset 2:c600266fa944 branch_net
=nicht mehr benoetigte Dateien entfernt
author | wuha |
---|---|
date | Fri, 19 Sep 2008 13:26:58 +0000 |
parents | 5a125ff6877f |
children | b330c4597cbf |
files | src/core/constants.h src/core/goblin.cpp src/core/goblin.h src/core/objectfactory.cpp src/core/objectloader.cpp src/gui/Makefile.objs src/gui/application.cpp src/gui/application.h src/gui/client.cpp src/gui/client.h src/gui/clientmplayer.cpp src/gui/clientmplayer.h src/gui/clientwobject.cpp src/gui/clientwobject.h src/gui/main_gui.cpp src/gui/mainwindow.cpp src/gui/mainwindow.h src/gui/numberedwindow.cpp src/gui/numberedwindow.h |
diffstat | 19 files changed, 617 insertions(+), 1464 deletions(-) [+] |
line wrap: on
line diff
--- a/src/core/constants.h Fri Sep 19 11:03:22 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* - Ein kleines Rollenspiel - Copyright (C) 2007 Hans Wulf, Michael Kempf, Daniel Erler - - 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. -*/ -/** - * \file constants.h - * \defgroup Constants \ Konstanten - * \brief Stellt globale Konstanten zur Verfügung - * \author Hans Wulf, Michael Kempf, Daniel Erler - * \version 1.0 - * \date 2007/05/28 - * \note Beinhaltet etliche Defines und einige Enums, wie ActionType oder Mode ... - */ - -#ifndef CONSTANTS_H -#define CONSTANTS_H - -//Konstantendefinitionen - //allgemeine Konstanten ohne Kategorie - /** - * \def EPSILON - * \brief Konstante fuer Maschinengenauigkeit - */ - #define EPSILON 0.00001 - - - - - - - //Konstanten mit Bezug zur Stadt - /** - * \def TOWN_RADIUS - * \brief Konstante die angibt, in welchem Abstand um das Stadtzentrum das Gebiet als Stadt gilt - */ - #define TOWN_RADIUS 6 - - - /** - * \enum Mode - * \brief Beschreibt den Modus, in dem sich ein Spieler befindet - */ - enum Mode {MODE_AGRESSIVE, MODE_DEFENSIVE}; - - /** - * \enum ItemLocationType - * \brief Beschreibt den Standort eines Items im Handelsfenster - */ - enum ItemLocationType {PLAYER_INVENTORY, PLAYER_OFFER, TRADER_INVENTORY, TRADER_OFFER}; - - /** - * \enum NotebookTab - * \brief Beschreibt die Registerkarte der GUI - */ - enum NotebookTab {TAB_FIELD=0, TAB_CHARACTER, TAB_INVENTORY, TAB_TRADE}; - -#endif //CONSTANTS_H
--- a/src/core/goblin.cpp Fri Sep 19 11:03:22 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* - Ein kleines Rollenspiel - Copyright (C) 2007 Hans Wulf, Daniel Erler - - 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. -*/ - -#include "goblin.h" - -Goblin::Goblin(World* world, int id) : Monster( world, id) -{ - bool tmp = init(); - -} - - - -Goblin::~Goblin() -{ - // allokierten Speicher freigeben -} - -//Methods -bool Goblin::init () -{ - getTypeInfo()->m_subtype = TypeInfo::SUBTYPE_GOBLIN; - getTypeInfo()->m_category = TypeInfo::GOBLIN; - getTypeInfo()->m_fraction = TypeInfo::FRAC_MONSTER; - - CreatureBaseAttr* bas = getBaseAttr(); - CreatureDynAttr* dyn = getDynAttr(); - - float p0[4] ={0.1,0.2,0.2,0.2}; - m_drop_slots[0].init(p0, 0,20, 0.3, 500); - m_drop_slots[1].init(p0,0, 10, 0.3, 1000); - - dyn->m_experience=0; - dyn->m_health = 150; - - bas->m_max_experience = 100000; - bas->m_level =1; - bas->m_max_health = 150; - bas->m_armor = 10; - bas->m_block=0; - bas->m_attack = 10; - bas->m_strength = 15; - bas->m_dexterity = 10; - bas->m_magic_power = 5; - bas->m_willpower = 10; - bas->m_resistances[0] =0; - bas->m_resistances[1] =0; - bas->m_resistances[2] =0; - bas->m_resistances[3] =0; - bas->m_resistances_cap[0] =50; - bas->m_resistances_cap[1] =50; - bas->m_resistances_cap[2] =50; - bas->m_resistances_cap[3] =50; - bas->m_walk_speed = 2000; - bas->m_attack_speed=1500; - bas->m_step_length = 0.5; - m_base_action = Action::ATTACK; - - - int i; - for (i=1;i<6;i++) - bas->m_abilities[i]=0; - - // Debugging - //bas->m_abilities[0] = 0xf1f; - bas->m_abilities[0] = 0xf2f; - //bas->m_abilities[1]=0x10; - //bas->m_abilities[2] = 0x2; - bas->m_abilities[3] = 0x2; - //bas->m_abilities[3] = 0x14; - - bas->m_attack_range =1; - - bas->m_special_flags=0; - - calcBaseAttrMod(); - - return true; -} -
--- a/src/core/goblin.h Fri Sep 19 11:03:22 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -/* - Ein kleines Rollenspiel - Copyright (C) 2007 Hans Wulf - - 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. -*/ - -/** - * \file goblin.h - * \defgroup Goblin \ Goblin - * \ingroup Monster - * \brief Stellt das Objekt Goblin zur Verfügung - * \author Hans Wulf - * \version 1.0 - * \date 2007/06/05 - * \note Beinhaltet die Klasse Goblin und spezifiziert sein Verhalten - */ -#ifndef GOBLIN_H -#define GOBLIN_H -#include <string> -#include "monster.h" -#include "world.h" - -/** - * \class Goblin - * \brief Der Goblin ist ein schnelles und gefährliches Monster. - */ -class Goblin : public Monster { -//Public stuff -public: - //Fields - //Constructors - /** - * \fn Goblin(World* world, int id) - * \brief Konstruktor - * \param world Welt - * \param id Objekt-ID - * - * Legt ein neues Goblin Objekt an. - */ - Goblin(World* world, int id); - - /** - * \fn ~Goblin() - * \brief Destruktor - * - * Gibt den Allokierten Speicher wieder frei - */ - ~Goblin(); - //Accessor Methods - //Operations - /** - * \fn virtual bool init () - * \brief Initialisiert den Goblin. - * \return bool, der angibt ob die initialisierung erfolgreich war - */ - virtual bool init (); - - - /** - * \fn virtual bool destroy () - * \brief Zerstoert das Objekt. Die Funktion ist virtuell und wird durch die abgeleiteten Klassen überschrieben. - * \return bool, der angibt ob die Zerstoerung erfolgreich war - */ - virtual bool destroy() - { - Monster::destroy(); - } - - /** - * \fn virtual void updateCommand() - * \brief aktualisiert das aktuelle Kommando - */ - virtual void updateCommand() - { - Monster::updateCommand(); - } - //bool update(float time); -//Private stuff -private: - //Fields - //Constructors - //Accessor Methods - //Operations - -}; -#endif //GOBLIN_H
--- a/src/core/objectfactory.cpp Fri Sep 19 11:03:22 2008 +0000 +++ b/src/core/objectfactory.cpp Fri Sep 19 13:26:58 2008 +0000 @@ -6,7 +6,6 @@ #include "priest.h" #include "fixedobject.h" #include "monster.h" -#include "goblin.h" #define USE_OBJECTLOADER
--- a/src/core/objectloader.cpp Fri Sep 19 11:03:22 2008 +0000 +++ b/src/core/objectloader.cpp Fri Sep 19 13:26:58 2008 +0000 @@ -6,7 +6,6 @@ #include "priest.h" #include "fixedobject.h" #include "monster.h" -#include "goblin.h" int ObjectLoader::generateObjects(TiXmlElement* pElement, string element)
--- a/src/gui/Makefile.objs Fri Sep 19 11:03:22 2008 +0000 +++ b/src/gui/Makefile.objs Fri Sep 19 13:26:58 2008 +0000 @@ -1,4 +1,4 @@ main_gui.o mainwindow.o scene.o -client.o +application.o
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/gui/application.cpp Fri Sep 19 13:26:58 2008 +0000 @@ -0,0 +1,418 @@ +#include "application.h" + +Application::Application() +{ + // Anwendung initialisieren + bool ret = init(); + + if (ret == false) + { + // ERRORMSG("Initialisation failed, stop"); + m_shutdown = true; + } + +} + +bool Application::init() +{ + bool ret = true; + + // Ogre Root erzeugen + // pluginfile: plugins.cfg + // configfile: keines + #ifdef WIN32 + m_ogre_root = new Ogre::Root("plugins_win.cfg", "ogre.cfg"); + #else + m_ogre_root = new Ogre::Root("plugins.cfg", "ogre.cfg"); + #endif + + if (m_ogre_root ==0) + return false; + + // Ogre configurieren + ret = configureOgre(); + if (ret==false) + { + ERRORMSG("Configuring Ogre failed"); + return false; + } + + // Ogre initialisieren + ret = initOgre(); + if (ret==false) + { + ERRORMSG("Initialisation of Ogre failed"); + return false; + } + + // Ressourcen festlegen + ret = setupResources(); + if (ret==false) + { + ERRORMSG("Setting up Resources failed"); + return false; + } + + //Gettext initialisieren + ret = initGettext(); + if (ret==false) + { + ERRORMSG("Initialisation of Gettext failed"); + return false; + } + + + //CEGUI initialisieren + ret = initCEGUI(); + if (ret==false) + { + ERRORMSG("Initialisation of CEGUI failed"); + return false; + } + + // Document anlegen + ret = createDocument(); + if (ret==false) + { + ERRORMSG("cant create document"); + return false; + } + // View anlegen + ret = createView(); + if (ret==false) + { + ERRORMSG("cant create view"); + return false; + } + + DEBUG("application initialized"); + // debugging + //MyFrameListener* mfl = new MyFrameListener(m_main_window,m_document); + //m_ogre_root->addFrameListener(mfl); + + return true; +} + + +Application::~Application() +{ + // dynamisch angelegte Objekte in umgekehrter Reihenfolge freigeben + + printf("deleting application\n"); + delete m_main_window; + delete m_document; + delete m_ogre_cegui_renderer; + delete m_ogre_root; +} + +void Application::run() +{ + printf("started\n"); + Ogre::Timer timer; + unsigned long ltime; + float time=0,ftime; + float uptime =0; + //m_ogre_root->startRendering(); + float timesum=0; + int count=0; + Ogre::Timer timer2; + + while (m_document->getState() != Document::SHUTDOWN) + { + + ltime =timer.getMicroseconds (); + ftime = ltime / ( 1000000.0); + timer.reset(); + + DEBUG5("overall frame time was %f",ftime*1000); + + timer2.reset(); + + update(); + + ltime =timer2.getMicroseconds (); + time = ltime / ( 1000000.0); + + DEBUG5("update time was %f",time*1000); + + + timer2.reset(); + // run the message pump + Ogre::WindowEventUtilities::messagePump(); + ltime =timer2.getMicroseconds (); + time = ltime / ( 1000000.0); + DEBUG5("message pump time was %f",time*1000); + + timer2.reset(); + + // Document aktualisieren + m_document->update(ftime*1000); + + ltime =timer2.getMicroseconds (); + time = ltime / ( 1000000.0); + DEBUG5("document update time was %f",time*1000); + + /* + count ++; + timesum += time; + if (count ==100) + { + count =0; + timesum *=10; + DEBUG5("frame time is %f",timesum); + timesum =0; + } + */ + + try + { + timer2.reset(); + + // View aktualisieren + DEBUG5("main window update"); + m_main_window->update(); + + ltime =timer2.getMicroseconds (); + time = ltime / ( 1000000.0); + DEBUG5("view update time was %f",time*1000); + } + catch (CEGUI::Exception e) + { + ERRORMSG("Error message: %s",e.getMessage().c_str()); + } + + + //DEBUG("frame time in s %f",time); + m_cegui_system->injectTimePulse(ftime); + + + // rendern + timer2.reset(); + + m_ogre_root->renderOneFrame(); + + ltime =timer2.getMicroseconds (); + time = ltime / ( 1000000.0); + DEBUG5("ogre frame time was %f",time*1000); + + } + + + +} + +bool Application::initOgre() +{ + DEBUG("init ogre"); + // Fenster anlegen, Ogre initialisieren + m_window = m_ogre_root->initialise(true); + + // Szenemanager anlegen + m_scene_manager = m_ogre_root->createSceneManager(Ogre::ST_GENERIC,"DefaultSceneManager"); + + return true; + +} + +bool Application::configureOgre() +{ + DEBUG("configure ogre"); + // Logging nur fuer Fehlermeldungen verwenden + Ogre::LogManager::getSingleton().setLogDetail(Ogre::LL_LOW ); + // Rendering System waehlen + // Liste aller verfuegbaren Systeme ausgeben lassen und das erste davon nehmen + Ogre::RenderSystemList *renderSystems = NULL; + Ogre::RenderSystemList::iterator r_it; + renderSystems = m_ogre_root->getAvailableRenderers(); + if (renderSystems->empty()) + { + ERRORMSG("no rendering system available"); + return false; + } + r_it = renderSystems->begin(); + m_ogre_root->setRenderSystem(*r_it); + + // config Dialog anzeigen + // TODO: Einstellungen direkt setzen oder aus einem File einlesen + bool result = true; + //result = m_ogre_root->showConfigDialog(); + m_ogre_root->restoreConfig(); + if (result == false) + { + // DEBUG("User pressed Cancel on config Dialog"); + return false; + } + + + return true; +} + +bool Application::setupResources() +{ + DEBUG("initalizing resources"); + Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../resources/models", "FileSystem", "General"); + Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../resources/materials/scripts", "FileSystem", "General"); + Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../resources/materials/textures", "FileSystem", "General"); + Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../resources/particle", "FileSystem", "General"); + + // CEGUI Resourcen laden + Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../resources/gui/configs", "FileSystem", "GUI"); + Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../resources/gui/fonts", "FileSystem", "GUI"); + + Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../resources/gui/imagesets", "FileSystem", "GUI"); + Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../resources/gui/layouts", "FileSystem", "GUI"); + Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../resources/gui/looknfeel", "FileSystem", "GUI"); + Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../resources/gui/schemes", "FileSystem", "GUI"); + + Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../resources/gui/schemes", "FileSystem", "GUI"); + + Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../save", "FileSystem", "Savegame"); + + +#if defined(WIN32) + Ogre::ResourceGroupManager::getSingleton().addResourceLocation("c:\\windows\\fonts", "FileSystem", "GUI"); +#endif + + // Gruppen initialisieren + Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("General"); + Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("Savegame"); + Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("GUI"); + + // Debugging: Meshes direkt anlegen + + Ogre::Plane plane(Ogre::Vector3::UNIT_Y, 0); + + Ogre::MeshManager::getSingleton().createPlane("Tile", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane,100,100,1,1,true,1,1,1,Ogre::Vector3::UNIT_X); + + + Ogre::MeshManager::getSingleton().createPlane("Item", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane,25,25,1,1,true,1,1,1,Ogre::Vector3::UNIT_X); + + + + return true; +} + +bool Application::initGettext() +{ + DEBUG("initializing internationalisation"); + #ifndef WIN32 + bool result = false; + char * language; + language = getenv("LANG"); + + if ((language[0] == 'd' && language[1] == 'e') || + (language[0] == 'e' && language[1] == 'n')) + { + result = setlocale (LC_MESSAGES, ""); + //result = setlocale (LC_MESSAGES, "de_DE"); + } + else + { + result = setlocale (LC_MESSAGES, "en"); + + if (!result) + result = setlocale (LC_MESSAGES, "en_GB"); + if (!result) + result = setlocale (LC_MESSAGES, "en_US"); + if (!result) + result = setlocale (LC_MESSAGES, "en_NZ"); + } + + bindtextdomain ("sumwars","../shared/translation/"); + textdomain ("sumwars"); + return result; + #endif + return true; +} + +bool Application::initCEGUI() +{ + DEBUG("init CEGUI\n"); + m_ogre_cegui_renderer = new CEGUI::OgreCEGUIRenderer( + m_window, // Fenster in das CEGUi rendert + Ogre::RENDER_QUEUE_OVERLAY, // Render Queue von CEGUI + false, // CEGUI in der Render Queue zuerst bearbeitet + 3000, // max quads for the UI + m_scene_manager // verwendeter Szenemanager + ); + + // Groesse festlegen + m_ogre_cegui_renderer->setDisplaySize(CEGUI::Size((int) m_window->getWidth(),(int) m_window->getHeight())); + + // Basisklasse von CEGUI erzeugen + m_cegui_system = new CEGUI::System(m_ogre_cegui_renderer); + + + // Log level + CEGUI::Logger::getSingleton().setLoggingLevel(CEGUI::Informative); + + // Scheme laden + CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"TaharezLook.scheme", (CEGUI::utf8*)"GUI"); + + // Imagesets laden + //CEGUI::Imageset* imgset = CEGUI::ImagesetManager::getSingleton().createImageset("test.imageset"); + CEGUI::Imageset* imgset = CEGUI::ImagesetManager::getSingleton().createImageset("skills.imageset"); + + // Mauscursor setzen (evtl eher in View auslagern ? ) + m_cegui_system->setDefaultMouseCursor((CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow"); + + // Font setzen + CEGUI::FontManager::getSingleton().createFont("DejaVuSerif-8.font", (CEGUI::utf8*)"GUI"); + m_cegui_system->setDefaultFont((CEGUI::utf8*)"DejaVuSerif-8"); + + // default ToolTip erzeugen + CEGUI::System::getSingleton().setDefaultTooltip( (CEGUI::utf8*)"TaharezLook/Tooltip" ); + CEGUI::Tooltip* ttip = CEGUI::System::getSingleton().getDefaultTooltip(); + ttip->setDisplayTime(0); + + // eigene Factorys einfuegen + /* + CEGUI::WindowFactoryManager& win_fact_man = CEGUI::WindowFactoryManager::getSingleton(); + NumberedWindowFactory* num_win_fac = new NumberedWindowFactory(); + win_fact_man.addFactory(num_win_fac); + win_fact_man.addFalagardWindowMapping("Taharez/NumberedStaticText","NumberedWindow","TaharezLook/StaticText",win_fact_man.getMappedRendererForType ("TaharezLook/StaticText")); + */ + return true; +} + +bool Application::createDocument() +{ + DEBUG("create document\n"); + m_document = new Document(); + + m_document->installShortkey(OIS::KC_ESCAPE,Document::CLOSE_ALL); + m_document->installShortkey(OIS::KC_I,Document::SHOW_INVENTORY); + m_document->installShortkey(OIS::KC_C,Document::SHOW_CHARINFO); + m_document->installShortkey(OIS::KC_T,Document::SHOW_SKILLTREE); + m_document->installShortkey(OIS::KC_P,Document::SHOW_PARTYMENU); + m_document->installShortkey(OIS::KC_M,Document::SHOW_CHATBOX); + m_document->installShortkey(OIS::KC_W,Document::SWAP_EQUIP); + m_document->installShortkey(OIS::KC_1,Document::USE_POTION); + m_document->installShortkey(OIS::KC_2,(Document::ShortkeyDestination) (Document::USE_POTION+1)); + m_document->installShortkey(OIS::KC_3,(Document::ShortkeyDestination) (Document::USE_POTION+2)); + m_document->installShortkey(OIS::KC_4,(Document::ShortkeyDestination) (Document::USE_POTION+3)); + m_document->installShortkey(OIS::KC_5,(Document::ShortkeyDestination) (Document::USE_POTION+4)); + m_document->installShortkey(OIS::KC_6,(Document::ShortkeyDestination) (Document::USE_POTION+5)); + m_document->installShortkey(OIS::KC_7,(Document::ShortkeyDestination) (Document::USE_POTION+6)); + m_document->installShortkey(OIS::KC_8,(Document::ShortkeyDestination) (Document::USE_POTION+7)); + m_document->installShortkey(OIS::KC_9,(Document::ShortkeyDestination) (Document::USE_POTION+8)); + m_document->installShortkey(OIS::KC_0,(Document::ShortkeyDestination) (Document::USE_POTION+9)); + + return true; +} + +bool Application::createView() +{ + DEBUG("create view\n"); + m_main_window = new MainWindow(m_ogre_root, m_cegui_system,m_window,m_document); + + DEBUG("done"); + return true; +} + +void Application::update() +{ + +} + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/gui/application.h Fri Sep 19 13:26:58 2008 +0000 @@ -0,0 +1,197 @@ + +#ifndef APPLICATION_H +#define APPLICATION_H + + + +#include "Ogre.h" +#include <OgreTimer.h> + +// needed to be able to create the CEGUI renderer interface +#include "OgreCEGUIRenderer.h" + + +// CEGUI includes +#include "CEGUISystem.h" +#include "CEGUIInputEvent.h" +#include "CEGUIWindow.h" +#include "CEGUIWindowManager.h" +#include "CEGUISchemeManager.h" +#include "CEGUIFontManager.h" +#include "elements/CEGUIFrameWindow.h" + +#include <stdio.h> + +#include "mainwindow.h" + + + +/** + * \class Application + * \brief Basisklasse der Anwendung + */ + +class Application +{ + + public: + /** + * \fn Application() + * \brief Konstruktor + */ + Application(); + + /** + * \fn ~Application() + * \brief Destruktor + */ + ~Application(); + + /** + * \fn run() + * \brief Startet die Applikation + */ + void run(); + + // nur zum debuggen + Document* getDocument() + { + return m_document; + } + + private: + // Funktionen + /** + * \fn init() + * \brief Initialisiert die Anwendung + */ + bool init(); + + /** + * \fn initOgre() + * \brief Initialisiert die Ogre Rendering Engine + */ + bool initOgre(); + + /** + * \fn configureOgre() + * \brief Konfiguriert die Ogre Rendering Engine + */ + bool configureOgre(); + + /** + * \fn setupResources() + * \brief Stellt die Ressourcen fuer Ogre und CEGUI ein + */ + bool setupResources(); + + /** + * \fn initGettext() + * \brief Initialisiert Gettext + */ + bool initGettext(); + + /** + * \fn initCEGUI() + * \brief Initialisiert CEGUI + */ + bool initCEGUI(); + + /** + * \fn bool createView() + * \brief Erzeugt die Ansichten + */ + bool createView(); + + /** + * \fn bool createDocument() + * \brief Erzeugt das Document + */ + bool createDocument(); + + /** + * \fn virtual void update() + * \brief Aktualisierungen + */ + virtual void update(); + + // Member + /** + * \var Ogre::Root *m_ogre_root + * \brief Basisobjekt der Ogre Engine + */ + Ogre::Root *m_ogre_root; + + /** + * \var CEGUI::System* m_cegui_system + * \brief Basisobjekt von CEGUI + */ + CEGUI::System* m_cegui_system; + + /** + * \var CEGUI::OgreCEGUIRenderer* m_ogre_cegui_renderer + * \brief Objekt zum Rendern von CEGUI mittels Ogre + */ + CEGUI::OgreCEGUIRenderer* m_ogre_cegui_renderer; + + /** + * \var Ogre::RenderWindow *window + * \brief Fenster der Applikation + */ + Ogre::RenderWindow *m_window; + + /** + * \var Ogre::SceneManager *m_scene_manager + * \brief Objekt fuer das Management der Szene + */ + Ogre::SceneManager *m_scene_manager; + + // Kamera + // temporaer, wird spaeter View zugeordnet + Ogre::Camera *m_camera; + + /** + * \var bool m_shutdown + * \brief true, wenn die Anwendung beendet werden soll + */ + bool m_shutdown; + + // zum testen + + //CEGUI::Window* pLayout; // pseudo view + + protected: + /** + * \var Document* m_document + * \brief Dokument, enthaelt alle Daten fuer die Darstellung + */ + Document* m_document; + + /** + * \var MainWindow* m_main_window + * \brief Hauptfenster der Applikation + */ + MainWindow* m_main_window; +}; + + + + + + + + + + + + + + + + + + + + +#endif +
--- a/src/gui/client.cpp Fri Sep 19 11:03:22 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,418 +0,0 @@ -#include "client.h" - -Application::Application() -{ - // Anwendung initialisieren - bool ret = init(); - - if (ret == false) - { - // ERRORMSG("Initialisation failed, stop"); - m_shutdown = true; - } - -} - -bool Application::init() -{ - bool ret = true; - - // Ogre Root erzeugen - // pluginfile: plugins.cfg - // configfile: keines - #ifdef WIN32 - m_ogre_root = new Ogre::Root("plugins_win.cfg", "ogre.cfg"); - #else - m_ogre_root = new Ogre::Root("plugins.cfg", "ogre.cfg"); - #endif - - if (m_ogre_root ==0) - return false; - - // Ogre configurieren - ret = configureOgre(); - if (ret==false) - { - ERRORMSG("Configuring Ogre failed"); - return false; - } - - // Ogre initialisieren - ret = initOgre(); - if (ret==false) - { - ERRORMSG("Initialisation of Ogre failed"); - return false; - } - - // Ressourcen festlegen - ret = setupResources(); - if (ret==false) - { - ERRORMSG("Setting up Resources failed"); - return false; - } - - //Gettext initialisieren - ret = initGettext(); - if (ret==false) - { - ERRORMSG("Initialisation of Gettext failed"); - return false; - } - - - //CEGUI initialisieren - ret = initCEGUI(); - if (ret==false) - { - ERRORMSG("Initialisation of CEGUI failed"); - return false; - } - - // Document anlegen - ret = createDocument(); - if (ret==false) - { - ERRORMSG("cant create document"); - return false; - } - // View anlegen - ret = createView(); - if (ret==false) - { - ERRORMSG("cant create view"); - return false; - } - - DEBUG("application initialized"); - // debugging - //MyFrameListener* mfl = new MyFrameListener(m_main_window,m_document); - //m_ogre_root->addFrameListener(mfl); - - return true; -} - - -Application::~Application() -{ - // dynamisch angelegte Objekte in umgekehrter Reihenfolge freigeben - - printf("deleting application\n"); - delete m_main_window; - delete m_document; - delete m_ogre_cegui_renderer; - delete m_ogre_root; -} - -void Application::run() -{ - printf("started\n"); - Ogre::Timer timer; - unsigned long ltime; - float time=0,ftime; - float uptime =0; - //m_ogre_root->startRendering(); - float timesum=0; - int count=0; - Ogre::Timer timer2; - - while (m_document->getState() != Document::SHUTDOWN) - { - - ltime =timer.getMicroseconds (); - ftime = ltime / ( 1000000.0); - timer.reset(); - - DEBUG5("overall frame time was %f",ftime*1000); - - timer2.reset(); - - update(); - - ltime =timer2.getMicroseconds (); - time = ltime / ( 1000000.0); - - DEBUG5("update time was %f",time*1000); - - - timer2.reset(); - // run the message pump - Ogre::WindowEventUtilities::messagePump(); - ltime =timer2.getMicroseconds (); - time = ltime / ( 1000000.0); - DEBUG5("message pump time was %f",time*1000); - - timer2.reset(); - - // Document aktualisieren - m_document->update(ftime*1000); - - ltime =timer2.getMicroseconds (); - time = ltime / ( 1000000.0); - DEBUG5("document update time was %f",time*1000); - - /* - count ++; - timesum += time; - if (count ==100) - { - count =0; - timesum *=10; - DEBUG5("frame time is %f",timesum); - timesum =0; - } - */ - - try - { - timer2.reset(); - - // View aktualisieren - DEBUG5("main window update"); - m_main_window->update(); - - ltime =timer2.getMicroseconds (); - time = ltime / ( 1000000.0); - DEBUG5("view update time was %f",time*1000); - } - catch (CEGUI::Exception e) - { - ERRORMSG("Error message: %s",e.getMessage().c_str()); - } - - - //DEBUG("frame time in s %f",time); - m_cegui_system->injectTimePulse(ftime); - - - // rendern - timer2.reset(); - - m_ogre_root->renderOneFrame(); - - ltime =timer2.getMicroseconds (); - time = ltime / ( 1000000.0); - DEBUG5("ogre frame time was %f",time*1000); - - } - - - -} - -bool Application::initOgre() -{ - DEBUG("init ogre"); - // Fenster anlegen, Ogre initialisieren - m_window = m_ogre_root->initialise(true); - - // Szenemanager anlegen - m_scene_manager = m_ogre_root->createSceneManager(Ogre::ST_GENERIC,"DefaultSceneManager"); - - return true; - -} - -bool Application::configureOgre() -{ - DEBUG("configure ogre"); - // Logging nur fuer Fehlermeldungen verwenden - Ogre::LogManager::getSingleton().setLogDetail(Ogre::LL_LOW ); - // Rendering System waehlen - // Liste aller verfuegbaren Systeme ausgeben lassen und das erste davon nehmen - Ogre::RenderSystemList *renderSystems = NULL; - Ogre::RenderSystemList::iterator r_it; - renderSystems = m_ogre_root->getAvailableRenderers(); - if (renderSystems->empty()) - { - ERRORMSG("no rendering system available"); - return false; - } - r_it = renderSystems->begin(); - m_ogre_root->setRenderSystem(*r_it); - - // config Dialog anzeigen - // TODO: Einstellungen direkt setzen oder aus einem File einlesen - bool result = true; - //result = m_ogre_root->showConfigDialog(); - m_ogre_root->restoreConfig(); - if (result == false) - { - // DEBUG("User pressed Cancel on config Dialog"); - return false; - } - - - return true; -} - -bool Application::setupResources() -{ - DEBUG("initalizing resources"); - Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../resources/models", "FileSystem", "General"); - Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../resources/materials/scripts", "FileSystem", "General"); - Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../resources/materials/textures", "FileSystem", "General"); - Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../resources/particle", "FileSystem", "General"); - - // CEGUI Resourcen laden - Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../resources/gui/configs", "FileSystem", "GUI"); - Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../resources/gui/fonts", "FileSystem", "GUI"); - - Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../resources/gui/imagesets", "FileSystem", "GUI"); - Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../resources/gui/layouts", "FileSystem", "GUI"); - Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../resources/gui/looknfeel", "FileSystem", "GUI"); - Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../resources/gui/schemes", "FileSystem", "GUI"); - - Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../resources/gui/schemes", "FileSystem", "GUI"); - - Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../save", "FileSystem", "Savegame"); - - -#if defined(WIN32) - Ogre::ResourceGroupManager::getSingleton().addResourceLocation("c:\\windows\\fonts", "FileSystem", "GUI"); -#endif - - // Gruppen initialisieren - Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("General"); - Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("Savegame"); - Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("GUI"); - - // Debugging: Meshes direkt anlegen - - Ogre::Plane plane(Ogre::Vector3::UNIT_Y, 0); - - Ogre::MeshManager::getSingleton().createPlane("Tile", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane,100,100,1,1,true,1,1,1,Ogre::Vector3::UNIT_X); - - - Ogre::MeshManager::getSingleton().createPlane("Item", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane,25,25,1,1,true,1,1,1,Ogre::Vector3::UNIT_X); - - - - return true; -} - -bool Application::initGettext() -{ - DEBUG("initializing internationalisation"); - #ifndef WIN32 - bool result = false; - char * language; - language = getenv("LANG"); - - if ((language[0] == 'd' && language[1] == 'e') || - (language[0] == 'e' && language[1] == 'n')) - { - result = setlocale (LC_MESSAGES, ""); - //result = setlocale (LC_MESSAGES, "de_DE"); - } - else - { - result = setlocale (LC_MESSAGES, "en"); - - if (!result) - result = setlocale (LC_MESSAGES, "en_GB"); - if (!result) - result = setlocale (LC_MESSAGES, "en_US"); - if (!result) - result = setlocale (LC_MESSAGES, "en_NZ"); - } - - bindtextdomain ("sumwars","../shared/translation/"); - textdomain ("sumwars"); - return result; - #endif - return true; -} - -bool Application::initCEGUI() -{ - DEBUG("init CEGUI\n"); - m_ogre_cegui_renderer = new CEGUI::OgreCEGUIRenderer( - m_window, // Fenster in das CEGUi rendert - Ogre::RENDER_QUEUE_OVERLAY, // Render Queue von CEGUI - false, // CEGUI in der Render Queue zuerst bearbeitet - 3000, // max quads for the UI - m_scene_manager // verwendeter Szenemanager - ); - - // Groesse festlegen - m_ogre_cegui_renderer->setDisplaySize(CEGUI::Size((int) m_window->getWidth(),(int) m_window->getHeight())); - - // Basisklasse von CEGUI erzeugen - m_cegui_system = new CEGUI::System(m_ogre_cegui_renderer); - - - // Log level - CEGUI::Logger::getSingleton().setLoggingLevel(CEGUI::Informative); - - // Scheme laden - CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"TaharezLook.scheme", (CEGUI::utf8*)"GUI"); - - // Imagesets laden - //CEGUI::Imageset* imgset = CEGUI::ImagesetManager::getSingleton().createImageset("test.imageset"); - CEGUI::Imageset* imgset = CEGUI::ImagesetManager::getSingleton().createImageset("skills.imageset"); - - // Mauscursor setzen (evtl eher in View auslagern ? ) - m_cegui_system->setDefaultMouseCursor((CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow"); - - // Font setzen - CEGUI::FontManager::getSingleton().createFont("DejaVuSerif-8.font", (CEGUI::utf8*)"GUI"); - m_cegui_system->setDefaultFont((CEGUI::utf8*)"DejaVuSerif-8"); - - // default ToolTip erzeugen - CEGUI::System::getSingleton().setDefaultTooltip( (CEGUI::utf8*)"TaharezLook/Tooltip" ); - CEGUI::Tooltip* ttip = CEGUI::System::getSingleton().getDefaultTooltip(); - ttip->setDisplayTime(0); - - // eigene Factorys einfuegen - /* - CEGUI::WindowFactoryManager& win_fact_man = CEGUI::WindowFactoryManager::getSingleton(); - NumberedWindowFactory* num_win_fac = new NumberedWindowFactory(); - win_fact_man.addFactory(num_win_fac); - win_fact_man.addFalagardWindowMapping("Taharez/NumberedStaticText","NumberedWindow","TaharezLook/StaticText",win_fact_man.getMappedRendererForType ("TaharezLook/StaticText")); - */ - return true; -} - -bool Application::createDocument() -{ - DEBUG("create document\n"); - m_document = new Document(); - - m_document->installShortkey(OIS::KC_ESCAPE,Document::CLOSE_ALL); - m_document->installShortkey(OIS::KC_I,Document::SHOW_INVENTORY); - m_document->installShortkey(OIS::KC_C,Document::SHOW_CHARINFO); - m_document->installShortkey(OIS::KC_T,Document::SHOW_SKILLTREE); - m_document->installShortkey(OIS::KC_P,Document::SHOW_PARTYMENU); - m_document->installShortkey(OIS::KC_M,Document::SHOW_CHATBOX); - m_document->installShortkey(OIS::KC_W,Document::SWAP_EQUIP); - m_document->installShortkey(OIS::KC_1,Document::USE_POTION); - m_document->installShortkey(OIS::KC_2,(Document::ShortkeyDestination) (Document::USE_POTION+1)); - m_document->installShortkey(OIS::KC_3,(Document::ShortkeyDestination) (Document::USE_POTION+2)); - m_document->installShortkey(OIS::KC_4,(Document::ShortkeyDestination) (Document::USE_POTION+3)); - m_document->installShortkey(OIS::KC_5,(Document::ShortkeyDestination) (Document::USE_POTION+4)); - m_document->installShortkey(OIS::KC_6,(Document::ShortkeyDestination) (Document::USE_POTION+5)); - m_document->installShortkey(OIS::KC_7,(Document::ShortkeyDestination) (Document::USE_POTION+6)); - m_document->installShortkey(OIS::KC_8,(Document::ShortkeyDestination) (Document::USE_POTION+7)); - m_document->installShortkey(OIS::KC_9,(Document::ShortkeyDestination) (Document::USE_POTION+8)); - m_document->installShortkey(OIS::KC_0,(Document::ShortkeyDestination) (Document::USE_POTION+9)); - - return true; -} - -bool Application::createView() -{ - DEBUG("create view\n"); - m_main_window = new MainWindow(m_ogre_root, m_cegui_system,m_window,m_document); - - DEBUG("done"); - return true; -} - -void Application::update() -{ - -} - -
--- a/src/gui/client.h Fri Sep 19 11:03:22 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,197 +0,0 @@ - -#ifndef APPLICATION_H -#define APPLICATION_H - - - -#include "Ogre.h" -#include <OgreTimer.h> - -// needed to be able to create the CEGUI renderer interface -#include "OgreCEGUIRenderer.h" - - -// CEGUI includes -#include "CEGUISystem.h" -#include "CEGUIInputEvent.h" -#include "CEGUIWindow.h" -#include "CEGUIWindowManager.h" -#include "CEGUISchemeManager.h" -#include "CEGUIFontManager.h" -#include "elements/CEGUIFrameWindow.h" - -#include <stdio.h> - -#include "mainwindow.h" - - - -/** - * \class Application - * \brief Basisklasse der Anwendung - */ - -class Application -{ - - public: - /** - * \fn Application() - * \brief Konstruktor - */ - Application(); - - /** - * \fn ~Application() - * \brief Destruktor - */ - ~Application(); - - /** - * \fn run() - * \brief Startet die Applikation - */ - void run(); - - // nur zum debuggen - Document* getDocument() - { - return m_document; - } - - private: - // Funktionen - /** - * \fn init() - * \brief Initialisiert die Anwendung - */ - bool init(); - - /** - * \fn initOgre() - * \brief Initialisiert die Ogre Rendering Engine - */ - bool initOgre(); - - /** - * \fn configureOgre() - * \brief Konfiguriert die Ogre Rendering Engine - */ - bool configureOgre(); - - /** - * \fn setupResources() - * \brief Stellt die Ressourcen fuer Ogre und CEGUI ein - */ - bool setupResources(); - - /** - * \fn initGettext() - * \brief Initialisiert Gettext - */ - bool initGettext(); - - /** - * \fn initCEGUI() - * \brief Initialisiert CEGUI - */ - bool initCEGUI(); - - /** - * \fn bool createView() - * \brief Erzeugt die Ansichten - */ - bool createView(); - - /** - * \fn bool createDocument() - * \brief Erzeugt das Document - */ - bool createDocument(); - - /** - * \fn virtual void update() - * \brief Aktualisierungen - */ - virtual void update(); - - // Member - /** - * \var Ogre::Root *m_ogre_root - * \brief Basisobjekt der Ogre Engine - */ - Ogre::Root *m_ogre_root; - - /** - * \var CEGUI::System* m_cegui_system - * \brief Basisobjekt von CEGUI - */ - CEGUI::System* m_cegui_system; - - /** - * \var CEGUI::OgreCEGUIRenderer* m_ogre_cegui_renderer - * \brief Objekt zum Rendern von CEGUI mittels Ogre - */ - CEGUI::OgreCEGUIRenderer* m_ogre_cegui_renderer; - - /** - * \var Ogre::RenderWindow *window - * \brief Fenster der Applikation - */ - Ogre::RenderWindow *m_window; - - /** - * \var Ogre::SceneManager *m_scene_manager - * \brief Objekt fuer das Management der Szene - */ - Ogre::SceneManager *m_scene_manager; - - // Kamera - // temporaer, wird spaeter View zugeordnet - Ogre::Camera *m_camera; - - /** - * \var bool m_shutdown - * \brief true, wenn die Anwendung beendet werden soll - */ - bool m_shutdown; - - // zum testen - - //CEGUI::Window* pLayout; // pseudo view - - protected: - /** - * \var Document* m_document - * \brief Dokument, enthaelt alle Daten fuer die Darstellung - */ - Document* m_document; - - /** - * \var MainWindow* m_main_window - * \brief Hauptfenster der Applikation - */ - MainWindow* m_main_window; -}; - - - - - - - - - - - - - - - - - - - - -#endif -
--- a/src/gui/clientmplayer.cpp Fri Sep 19 11:03:22 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +0,0 @@ -#include "clientmplayer.h" - -ClientMPlayer::ClientMPlayer(int id) : ClientWObject(id) -{ - m_equipement=new Equipement(5,14,30); -} - -ClientMPlayer::~ClientMPlayer() -{ - DEBUG5("delete m_equipement %p",m_equipement); - delete m_equipement; - DEBUG5("done"); -} - -void ClientMPlayer::fromString(CharConv* cv) -{ - ClientWObject::fromString(cv); - cv->fromBuffer<char>(m_level); - cv->fromBuffer<float>(m_max_health); - cv->fromBuffer<float>(m_health); - cv->fromBuffer<short>(m_strength); - cv->fromBuffer<short>(m_dexterity); - cv->fromBuffer<short>(m_magic_power); - cv->fromBuffer<short>(m_willpower); - cv->fromBuffer<short>(m_attribute_points); - - int i; - for (i=0;i<4;i++) - cv->fromBuffer<short>(m_resistances[i]); - for (i=0;i<4;i++) - cv->fromBuffer<short>(m_resistances_cap[i]); - - - cv->fromBuffer<float>(m_max_experience); - cv->fromBuffer<float>(m_experience); - cv->fromBuffer<short>(m_armor); - cv->fromBuffer<short>(m_block); - cv->fromBuffer<short>(m_attack); - cv->fromBuffer<short>(m_attack_speed); - cv->fromBuffer<float>(m_attack_range); - cv->fromBuffer<float>(m_power); - - m_base_damage.fromString(cv); - m_left_damage.fromString(cv); - m_right_damage.fromString(cv); - - /* - for (i=0;i<4;i++) - { - printf("%s %f - %f\n",Damage::getDamageTypeName((Damage::DamageType) i).c_str(),m_left_damage.m_min_damage[i],m_left_damage.m_max_damage[i]); - printf("%s %f - %f\n",Damage::getDamageTypeName((Damage::DamageType) i).c_str(),m_right_damage.m_min_damage[i],m_right_damage.m_max_damage[i]); - } - */ - - m_base_damage.normalize(); - m_left_damage.normalize(); - m_right_damage.normalize(); - - - - for (i=0;i<6;i++) - cv->fromBuffer<int>(m_abilities[i]); - cv->fromBuffer<float>(m_timer1_perc); - cv->fromBuffer<float>(m_timer2_perc); - - -} - -bool ClientMPlayer::checkAbility(Action::ActionType at) -{ - if (at<0 || at >=192) - return false; - - int nr = at / 32; - int mask = 1 << (at % 32); - - if ((m_abilities[nr] & mask) !=0) - { - return true; - } - return false; -} - -bool ClientMPlayer::checkAbilityLearnable(Action::ActionType at) -{ - if (checkAbility(at)) - { - // Faehigkeit ist schon erlernt - return false; - } - - Action::ActionInfo* aci = Action::getActionInfo(at); - - if (aci->m_req_level > m_level) - { - // Levelvorraussetzung nicht erfuellt - return false; - } - - - for (int i=0;i<3;i++) - { - if (!checkAbility(aci->m_req_ability[i])) - { - // Faehigkeiten Vorraussetzung nicht erfuellt - return false; - } - } - return true; -} - -
--- a/src/gui/clientmplayer.h Fri Sep 19 11:03:22 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,203 +0,0 @@ -#ifndef CLIENTMPLAYER_H -#define CLIENTMPLAYER_H - -#include "clientwobject.h" -#include "../shared/itemlist.h" -#include <string> -#include "../shared/damage.h" - -/** - * \class class ClientMPlayer - * \brief Klasse fuer die Spielerfigur auf Serverseite - */ -class ClientMPlayer : public ClientWObject -{ - public: - /** - * \fn ClientMPlayer(int id) - * \brief Konstruktor - * \param id ID des Objektes - */ - ClientMPlayer(int id); - - /** - * \fn ~ClientMPlayer() - * \brief Destruktor - */ - virtual ~ClientMPlayer(); - - /** - * \fn void fromString(CharConv* cv) - * \brief Erzeugt das Objekt aus einem String - * \param buf Objekt als String - * \return Zeiger hinter den gelesenen Datenbereich - */ - virtual void fromString(CharConv* cv); - - /** - * \fn bool checkAbility(Action::ActionType at) - * \brief Testet ob eine Faehigkeit erlernt ist - */ - bool checkAbility(Action::ActionType at); - - /** - * \fn bool checkAbilityLearnable(Action::ActionType at) - * \brief Testet ob eine Faehigkeit erlernbar ist - */ - bool checkAbilityLearnable(Action::ActionType at); - - /** - * \var char m_level - * \brief Level des Spielers - */ - char m_level; - - /** - * \var m_health - * \brief aktuelle Lebenspunkte des Spielers - */ - float m_health; - - /** - * \var m_max_health - * \brief Maximale Lebenspunkte des Spielers - */ - float m_max_health; - - /** - * \var short m_strength - * \brief Staerke des Spielers - */ - short m_strength; - - /** - * \var short m_dexterity - * \brief Geschick des Spielers - */ - short m_dexterity; - - /** - * \var short m_magic_power - * \brief Magie des Spielers - */ - short m_magic_power; - - /** - * \var short m_willpower - * \brief Willenskraft des Spielers - */ - short m_willpower; - - /** - * \var short m_attribute_points - * \brief Anzahl noch zu verteilender Attributspunkte - */ - short m_attribute_points; - - /** - * \var m_attack_speed - * \brief gibt die Geschwindigkeit an, mit der der Spieler angreifen kann, 1000 entspricht einem Schlag pro Sekunde - */ - short m_attack_speed; - - /** - * \var m_attack_range - * \brief Gibt die Reichweite der Waffe an. - */ - float m_attack_range; - - /** - * \var m_power - * \brief Gibt die Durchschlagskraft an. - */ - float m_power; - - /** - * \var Damage m_base_damage - * \brief Schaden der mit der Basisattacke ausgeteilt wird - */ - Damage m_base_damage; - - /** - * \var Damage m_left_damage - * \brief Schaden der mit der auf Linksklick ausgeloesten Faehigkeit ausgeteilt wird - */ - Damage m_left_damage; - - /** - * \var Damage m_right_damage - * \brief Schaden der mit der auf Rechtsklick ausgeloesten Faehigkeit ausgeteilt wird - */ - Damage m_right_damage; - - /** - * \var m_resistances[4] - * \brief Resistenzen des Spielers gegen die vier Schadensarten in Prozent - */ - short m_resistances[4]; - - /** - * \var m_resistances_cap[4] - * \brief Obergrenzen fuer die Resistenzen des Spielers gegen die vier Schadensarten in Prozent - */ - short m_resistances_cap[4]; - - /** - * \var m_experience - * \brief aktueller Erfahrungswert - */ - float m_experience; - - /** - * \var m_max_experience - * \brief maximaler Erfahrungswert vor Erreichen des naechsten Level - */ - float m_max_experience; - - /** \var m_armor; - * \brief Ruestungswert, beeinflusst den Schaden von Angriffen - */ - short m_armor; - - /** - * \var m_block; - * \brief Blockwert, beeinflusst die Chance Angriffe abzuwehren - */ - short m_block; - - - /** - * \var m_attack; - * \brief Attackewert, beeinflusst die Chance zu treffen - */ - short m_attack; - - /** - * \var m_abilities[6] - * \brief Bitmaske die angibt, welche Fähigkeiten der Spieler benutzen kann. - */ - int m_abilities[6]; - - /** - * \var float m_timer1_perc - * \brief Prozentsatz der Zeit von Timer1 die noch ablaufen muss - */ - float m_timer1_perc; - - /** - * \var float m_timer2_perc - * \brief Prozentsatz der Zeit von Timer2 die noch ablaufen muss - */ - float m_timer2_perc; - - /** - * \var Equipement* m_equipement - * \brief Ausruestung des Spielers - */ - Equipement* m_equipement; - -}; - - -#endif // CLIENTMPLAYER_H -
--- a/src/gui/clientwobject.cpp Fri Sep 19 11:03:22 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -#include "clientwobject.h" - -ClientWObject::ClientWObject(int id) : WorldObject(id) -{ - m_health_perc =1; - -} - -void ClientWObject::fromString(CharConv* cv) -{ - - WorldObject::fromString(cv); - - if (getTypeInfo()->m_type != TypeInfo:: TYPE_FIXED_OBJECT) - { - char tmp; - cv->fromBuffer<char>(tmp); - getTypeInfo()->m_category = (WorldObject::TypeInfo::Category) tmp; - cv->fromBuffer<char>(tmp); - getTypeInfo()->m_fraction = (WorldObject::TypeInfo::Fraction) tmp; - m_action.fromString(cv); - cv->fromBuffer<float>(m_health_perc); - cv->fromBuffer<char>(m_status_mods); - cv->fromBuffer<char>(m_effects); - if (getTypeInfo()->m_type == TypeInfo:: TYPE_PLAYER) - { - char name[32]; - cv->fromBuffer(name,32); - name[31]=0; - m_name.assign(name); - } - else - { - // TODO: Name anhand Typ/ Subtyp setzen - m_name = WorldObject::getName(); - } - } - else - { - m_health_perc=1; - m_status_mods =0; - m_action.m_type = Action::NOACTION; - } - //DEBUG("bytes read: %i",bp-buf); - -} -
--- a/src/gui/clientwobject.h Fri Sep 19 11:03:22 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ -#ifndef CLIENTWOBJECT_H -#define CLIENTWOBJECT_H - -#include "../shared/worldobject.h" -#include "../shared/action.h" - -/** - * \class ClientWObject - * \brief Klasse fuer ein Objekt der Spielwelt auf Clientseite - */ -class ClientWObject : public WorldObject -{ - public: - - - /** \fn ClientWObject(int id) - * \brief Konstruktor - * \param id ID des Objektes - */ - ClientWObject(int id); - - /** - * \fn virtual ~ClientWObject() - * \brief Destruktor - */ - virtual ~ClientWObject() - { - } - - /** - * \fn Action* getAction() - * \brief Gibt Zeiger auf die aktuelle Aktion zurueck - * \return Aktion - */ - Action* getAction() - { - return &m_action; - } - - /** - * \fn float getHealthPerc() - * \brief Gibt Prozentsatz der Lebenspunkte von den Maximallebenspunkten aus - * \return Prozentsatz Lebenspunkte - */ - float getHealthPerc() - { - return m_health_perc; - } - - /** - * \fn char getStatusMods() - * \brief Gibt die Statusveraenderungen aus - * \return Statusveraenderungen - */ - char getStatusMods() - { - return m_status_mods; - } - - /** - * \fn string getName() - * - * \brief Gibt den Name des Objektes aus - * \return Name - */ - string getName() - { - return m_name; - } - - - /** - * \fn void fromString(CharConv* cv) - * \brief Erzeugt das Objekt aus einem String - * \param buf Objekt als String - * \return Zeiger hinter den gelesenen Datenbereich - */ - virtual void fromString(CharConv* cv); - - /** - * \var Action m_action - * \brief Aktion die das Objekt gerade ausfuehrt - */ - Action m_action; - - /** - * \var float m_health_perc - * \brief Prozentsatz der Lebenpunkte von den maximalen Lebenspunkten - */ - float m_health_perc; - - /** - * \var char m_status_mods - * \brief Statusveraenderungen - */ - char m_status_mods; - - /** - * \var char m_effects - * \brief visuelle Effekte in Bitkodierung - */ - char m_effects; - - /** - * \var std::string m_name - * \brief Name des Objektes - */ - std::string m_name; -}; - -#endif // CLIENTWOBJECT_H
--- a/src/gui/main_gui.cpp Fri Sep 19 11:03:22 2008 +0000 +++ b/src/gui/main_gui.cpp Fri Sep 19 13:26:58 2008 +0000 @@ -1,6 +1,6 @@ #include <stdio.h> -#include "client.h" +#include "application.h" #if defined(WIN32) #include "windows.h"
--- a/src/gui/mainwindow.cpp Fri Sep 19 11:03:22 2008 +0000 +++ b/src/gui/mainwindow.cpp Fri Sep 19 13:26:58 2008 +0000 @@ -998,7 +998,6 @@ // Bestandteile des Charakterfensters hinzufuegen CEGUI::PushButton* btn; CEGUI::Window* label; - NumberedWindow* numlabel; int i,j;
--- a/src/gui/mainwindow.h Fri Sep 19 11:03:22 2008 +0000 +++ b/src/gui/mainwindow.h Fri Sep 19 13:26:58 2008 +0000 @@ -10,7 +10,6 @@ // CEGUI includes #include "CEGUI.h" -#include "numberedwindow.h" // OIS
--- a/src/gui/numberedwindow.cpp Fri Sep 19 11:03:22 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ - -#include "numberedwindow.h" - -NumberedWindow::NumberedWindow (const CEGUI::String &type, const CEGUI::String &name) - : CEGUI::Window(type,name) -{ - setNumber(0); -} - -CEGUI::Window * NumberedWindowFactory::createWindow (const CEGUI::String &name) -{ - return new NumberedWindow(getTypeName(),name); -} - -void NumberedWindowFactory::destroyWindow (CEGUI::Window *window) -{ - delete window; -} - -
--- a/src/gui/numberedwindow.h Fri Sep 19 11:03:22 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -#ifndef NUMBERED_WINDOW_H -#define NUMBERED_WINDOW_H - -// CEGUI includes -#include "CEGUI.h" - -/** - * \class NumberedWindow - * \brief Fenster mit einer bestimmten Nummer, die bei einem Mausklick mit ausgegeben wird - */ -class NumberedWindow : public CEGUI::Window -{ - public: - - /** - * \fn NumberedWindow (const CEGUI::String &type, const CEGUI::String &name) - * \brief Konstruktor - * \param type Typ des Fensters - * \param Name des Fensters - */ - NumberedWindow (const CEGUI::String &type, const CEGUI::String &name); - - /** - * \fn ~NumberedWindow() - * \brief Destruktor - */ - ~NumberedWindow() {} - - /** - * \fn void setNumber(int i) - * \brief setzt die Nummer des Fensters - */ - void setNumber(int i) - { - m_number =i; - } - - /** - * \fn int getNumber() - * \brief Gibt die Nummer des Fenster aus - */ - int getNumber() - { - return m_number; - } - - - private: - int m_number; -}; - -/** - * \class NumberedWindowFactory - * \brief Factory, die Objekte von Typ NumberedWindow erzeugt - */ -class NumberedWindowFactory : public CEGUI::WindowFactory -{ - public: - /** - * \fn NumberedWindowFactory() - * \brief Konstruktor - */ - NumberedWindowFactory() - : CEGUI::WindowFactory("NumberedWindow") - { - } - - /** - * \fn virtual CEGUI::Window * createWindow (const CEGUI::String &name) - * \brief erzeugt ein Fenster vom Typ NumberedWindow - * \return Zeiger auf das erzeugte Fenster - */ - virtual CEGUI::Window * createWindow (const CEGUI::String &name); - - /** - * \fn virtual void destroyWindow (CEGUI::Window *window) - * \brief Zerstoert das uebergebene Objekt - * \param window zu zerstoerendes Objekt - */ - virtual void destroyWindow (CEGUI::Window *window); -}; - -#endif -