[6139] | 1 | /* |
---|
| 2 | orxonox - the future of 3D-vertical-scrollers |
---|
| 3 | |
---|
| 4 | Copyright (C) 2004 orx |
---|
| 5 | |
---|
| 6 | This program is free software; you can redistribute it and/or modify |
---|
| 7 | it under the terms of the GNU General Public License as published by |
---|
| 8 | the Free Software Foundation; either version 2, or (at your option) |
---|
| 9 | any later version. |
---|
| 10 | |
---|
| 11 | ### File Specific: |
---|
| 12 | main-programmer: Patrick Boenzli |
---|
| 13 | */ |
---|
| 14 | |
---|
| 15 | #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD |
---|
| 16 | |
---|
[6358] | 17 | #include "multi_player_world.h" |
---|
[6139] | 18 | |
---|
| 19 | #include "state.h" |
---|
[6358] | 20 | #include "class_list.h" |
---|
[6139] | 21 | |
---|
| 22 | #include "load_param.h" |
---|
| 23 | #include "fast_factory.h" |
---|
| 24 | #include "factory.h" |
---|
| 25 | |
---|
| 26 | |
---|
| 27 | using namespace std; |
---|
| 28 | |
---|
[6358] | 29 | //! This creates a Factory to fabricate a MultiPlayerWorld |
---|
[6361] | 30 | CREATE_FACTORY(MultiPlayerWorld, CL_MULTI_PLAYER_WORLD); |
---|
[6139] | 31 | |
---|
[6361] | 32 | |
---|
[6358] | 33 | MultiPlayerWorld::MultiPlayerWorld(const TiXmlElement* root) |
---|
[6363] | 34 | : GameWorld(root) |
---|
[6139] | 35 | { |
---|
| 36 | this->constuctorInit("", -1); |
---|
| 37 | this->path = NULL; |
---|
| 38 | |
---|
| 39 | this->loadParams(root); |
---|
| 40 | } |
---|
| 41 | |
---|
[6361] | 42 | |
---|
[6139] | 43 | /** |
---|
[6358] | 44 | * remove the MultiPlayerWorld from memory |
---|
[6345] | 45 | * |
---|
| 46 | * delete everything explicitly, that isn't contained in the parenting tree! |
---|
| 47 | * things contained in the tree are deleted automaticaly |
---|
[6139] | 48 | */ |
---|
[6358] | 49 | MultiPlayerWorld::~MultiPlayerWorld () |
---|
[6139] | 50 | { |
---|
[6358] | 51 | PRINTF(3)("MultiPlayerWorld::~MultiPlayerWorld() - deleting current world\n"); |
---|
[6361] | 52 | } |
---|
[6139] | 53 | |
---|
| 54 | |
---|
| 55 | /** |
---|
| 56 | * initializes the world. |
---|
| 57 | * @param name the name of the world |
---|
| 58 | * @param worldID the ID of this world |
---|
| 59 | * |
---|
| 60 | * set all stuff here that is world generic and does not use to much memory |
---|
| 61 | * because the real init() function StoryEntity::init() will be called |
---|
| 62 | * shortly before start of the game. |
---|
| 63 | * since all worlds are initiated/referenced before they will be started. |
---|
| 64 | * NO LEVEL LOADING HERE - NEVER! |
---|
| 65 | */ |
---|
[6358] | 66 | void MultiPlayerWorld::constuctorInit(const char* name, int worldID) |
---|
[6139] | 67 | { |
---|
[6361] | 68 | this->setClassID(CL_MULTI_PLAYER_WORLD, "MultiPlayerWorld"); |
---|
| 69 | this->setName(name); |
---|
[6139] | 70 | |
---|
| 71 | this->gameTime = 0.0f; |
---|
| 72 | this->setSpeed(1.0); |
---|
| 73 | this->music = NULL; |
---|
| 74 | this->shell = NULL; |
---|
| 75 | this->localPlayer = NULL; |
---|
| 76 | this->localCamera = NULL; |
---|
| 77 | |
---|
| 78 | this->showPNodes = false; |
---|
| 79 | this->showBV = false; |
---|
| 80 | } |
---|
| 81 | |
---|
[6358] | 82 | |
---|
[6139] | 83 | /** |
---|
[6358] | 84 | * loads the parameters of a MultiPlayerWorld from an XML-element |
---|
[6139] | 85 | * @param root the XML-element to load from |
---|
| 86 | */ |
---|
[6358] | 87 | void MultiPlayerWorld::loadParams(const TiXmlElement* root) |
---|
[6139] | 88 | { |
---|
[6364] | 89 | static_cast<GameWorld*>(this)->loadParams(root); |
---|
[6139] | 90 | |
---|
[6358] | 91 | PRINTF(4)("Creating a MultiPlayerWorld\n"); |
---|
| 92 | } |
---|
[6139] | 93 | |
---|