Changeset 6404 in orxonox.OLD for branches/network/src/story_entities
- Timestamp:
- Jan 4, 2006, 1:49:20 AM (19 years ago)
- Location:
- branches/network/src/story_entities
- Files:
-
- 4 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/story_entities/campaign_data.cc
r6402 r6404 58 58 * @param root: The XML-element to load from 59 59 */ 60 void CampaignData::load Params(const TiXmlElement* root)60 void CampaignData::loadData(const TiXmlElement* root) 61 61 { 62 62 LoadParamXML(root, "WorldList", this, CampaignData, loadParamsWorldList) 63 63 .describe("A List of Worlds to be loaded in this Campaign"); 64 65 64 } 66 65 -
branches/network/src/story_entities/campaign_data.h
r6402 r6404 8 8 9 9 10 #include " base_object.h"10 #include "data_tank.h" 11 11 #include <list> 12 12 … … 14 14 15 15 //! A class that contains the data of the Campaign object 16 class CampaignData : public BaseObject16 class CampaignData : public DataTank 17 17 { 18 18 … … 21 21 virtual ~CampaignData(); 22 22 23 void load Params(const TiXmlElement* root);23 void loadData(const TiXmlElement* root); 24 24 25 25 void addStoryEntity(StoryEntity* se); -
branches/network/src/story_entities/game_world.cc
r6402 r6404 20 20 #include "game_world_data.h" 21 21 22 #include "shell_command.h"23 22 #include "resource_manager.h" 24 23 #include "state.h" 24 #include "class_list.h" 25 #include "substring.h" 26 27 #include "game_loader.h" 25 28 26 29 #include "p_node.h" … … 30 33 #include "environment.h" 31 34 #include "terrain.h" 32 33 35 #include "test_entity.h" 34 36 #include "terrain.h" 37 #include "md2Model.h" 38 #include "weapons/projectile.h" 39 #include "npcs/npc_test1.h" 40 #include "playable.h" 41 35 42 #include "light.h" 43 44 #include "factory.h" 45 #include "fast_factory.h" 36 46 #include "load_param.h" 37 #include "shell.h" 38 39 #include "fast_factory.h" 40 #include "animation_player.h" 47 #include "shell_command.h" 48 41 49 #include "particle_engine.h" 42 50 #include "graphics_engine.h" 51 #include "event_handler.h" 52 #include "sound_engine.h" 53 #include "cd_engine.h" 54 #include "network_manager.h" 43 55 #include "physics_engine.h" 44 56 #include "fields.h" 45 57 46 #include "md2Model.h"47 48 58 #include "glmenu_imagescreen.h" 49 #include "game_loader.h" 50 59 #include "shell.h" 60 61 #include "animation_player.h" 51 62 #include "animation3d.h" 52 63 53 #include "substring.h"54 55 #include "factory.h"56 57 #include "weapons/projectile.h"58 #include "event_handler.h"59 #include "sound_engine.h"60 64 #include "ogg_player.h" 61 62 #include "class_list.h"63 64 #include "cd_engine.h"65 #include "npcs/npc_test1.h"66 65 #include "shader.h" 67 66 68 #include "playable.h" 69 #include "network_manager.h" 70 #include "playable.h" 67 68 using namespace std; 71 69 72 70 … … 74 72 SHELL_COMMAND(togglePNodeVisibility, GameWorld, togglePNodeVisibility); 75 73 SHELL_COMMAND(toggleBVVisibility, GameWorld, toggleBVVisibility); 76 77 using namespace std;78 79 //! This creates a Factory to fabricate a GameWorld80 //CREATE_FACTORY(GameWorld, CL_GAME_WORLD);81 74 82 75 -
branches/network/src/story_entities/game_world_data.cc
r6402 r6404 92 92 */ 93 93 GameWorldData::~GameWorldData() 94 { 95 } 94 {} 96 95 97 96 … … 180 179 181 180 /** 182 * loads the GUI data181 * unloads the GUI data 183 182 */ 184 183 ErrorMessage GameWorldData::unloadGUI() … … 242 241 243 242 /** 244 * unloads the world entities from the xml file243 * unloads the world entities 245 244 */ 246 245 ErrorMessage GameWorldData::unloadWorldEntities() -
branches/network/src/story_entities/game_world_data.h
r6402 r6404 8 8 9 9 #include "sdlincl.h" 10 #include " base_object.h"10 #include "data_tank.h" 11 11 #include "error.h" 12 12 … … 29 29 * the game start/stop process is not contained here and can be found in the GameWorld class. 30 30 */ 31 class GameWorldData : public BaseObject31 class GameWorldData : public DataTank 32 32 { 33 33 … … 41 41 42 42 43 pr ivate:43 protected: 44 44 virtual ErrorMessage loadGUI(TiXmlElement* root); 45 45 virtual ErrorMessage loadWorldEntities(TiXmlElement* root); -
branches/network/src/story_entities/multi_player_world.cc
r6402 r6404 16 16 17 17 #include "multi_player_world.h" 18 #include "multi_player_world_data.h" 18 19 19 #include "state.h" 20 #include "class_list.h" 21 20 #include "factory.h" 22 21 #include "load_param.h" 23 #include "fast_factory.h"24 #include "factory.h"25 26 27 #include "shell_command.h"28 #include "resource_manager.h"29 #include "state.h"30 31 #include "game_loader.h"32 #include "glmenu_imagescreen.h"33 34 #include "p_node.h"35 #include "world_entity.h"36 #include "player.h"37 #include "camera.h"38 #include "environment.h"39 #include "terrain.h"40 41 42 22 43 23 44 24 using namespace std; 25 45 26 46 27 //! This creates a Factory to fabricate a MultiPlayerWorld … … 53 34 this->setClassID(CL_MULTI_PLAYER_WORLD, "MultiPlayerWorld"); 54 35 55 this->path = NULL; 56 36 this->multiPlayerWorldData = new MultiPlayerWorldData(); 57 37 this->loadParams(root); 58 38 } … … 68 48 { 69 49 PRINTF(3)("MultiPlayerWorld::~MultiPlayerWorld() - deleting current world\n"); 70 } 71 72 73 /** 74 * initializes the world. 75 * @param name the name of the world 76 * @param worldID the ID of this world 77 * 78 * set all stuff here that is world generic and does not use to much memory 79 * because the real init() function StoryEntity::init() will be called 80 * shortly before start of the game. 81 * since all worlds are initiated/referenced before they will be started. 82 * NO LEVEL LOADING HERE - NEVER! 83 */ 84 void MultiPlayerWorld::constuctorInit(const char* name, int worldID) 85 { 86 this->gameTime = 0.0f; 87 this->setSpeed(1.0); 88 this->shell = NULL; 89 90 this->showPNodes = false; 91 this->showBV = false; 50 if( this->multiPlayerWorldData) 51 delete this->multiPlayerWorldData; 92 52 } 93 53 … … 107 67 108 68 109 /**110 * loads the GameWorld by initializing all resources, and set their default values.111 */112 ErrorMessage MultiPlayerWorld::load()113 {114 115 ////////////////////////////116 // Loading Spawning Point //117 ////////////////////////////118 // element = root->FirstChildElement("SpawningPoints");119 // if( element == NULL)120 // {121 // PRINTF(1)("NetworkWorld is missing 'SpawningPoints'\n");122 // }123 // else124 // {125 // element = element->FirstChildElement();126 // // load Players/Objects/Whatever127 // PRINTF(4)("Loading Spawning Points\n");128 // while( element != NULL)129 // {130 // BaseObject* created = Factory::fabricate(element);131 // if( created != NULL )132 // {133 // // if(created->isA(CL_SPAWNING_POINT))134 // // this->spawn(dynamic_cast<WorldEntity*>(created));135 // printf("Created a Spawning Point %s: %s\n", created->getClassName(), created->getName());136 // }137 //138 //139 // element = element->NextSiblingElement();140 // glmis->step(); //! @todo temporary141 // }142 // PRINTF(4)("Done loading NetworkWorldEntities\n");143 // }144 //145 //146 // ////////////////////////147 // // find WorldEntities //148 // ////////////////////////149 // element = root->FirstChildElement("WorldEntities");150 // if( element == NULL)151 // {152 // PRINTF(1)("NetworkWorld is missing 'WorldEntities'\n");153 // }154 // else155 // {156 // element = element->FirstChildElement();157 // // load Players/Objects/Whatever158 // PRINTF(4)("Loading NetworkWorldEntities\n");159 // while( element != NULL)160 // {161 // if( NetworkManager::getInstance()->isGameServer())162 // {163 //164 // BaseObject* created = NetworkGameManager::getInstance()->createEntity(element);165 // if( created != NULL )166 // {167 // // if(created->isA(CL_WORLD_ENTITY))168 // // this->spawn(dynamic_cast<WorldEntity*>(created));169 // printf("Created a %s: %s\n", created->getClassName(), created->getName());170 // }171 // else172 // PRINTF(1)("NetworkWorld: could not create this entity\n");173 //174 // // if we load a 'Player' we use it as localPlayer175 //176 //177 // //todo do this more elegant178 // if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox"))179 // sky = dynamic_cast<WorldEntity*>(created);180 // if( element->Value() != NULL && !strcmp( element->Value(), "Terrain"))181 // {182 // terrain = dynamic_cast<Terrain*>(created);183 // CDEngine::getInstance()->setTerrain(terrain);184 //185 // }186 //187 // }188 // else if( /* !strcmp( element->Value(), "SkyBox") || */ /* !strcmp( element->Value(), "Terrain") || */ !strcmp( element->Value(), "SpaceShip"))189 // {190 // BaseObject* created = Factory::fabricate(element);191 // if( created != NULL )192 // {193 // // if(created->isA(CL_WORLD_ENTITY))194 // // this->spawn(dynamic_cast<WorldEntity*>(created));195 // printf("Created a %s: %s\n", created->getClassName(), created->getName());196 // }197 // else198 // PRINTF(1)("NetworkWorld: could not create this entity\n");199 //200 // // if we load a 'Player' we use it as localPlayer201 //202 //203 // //todo do this more elegant204 // if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox"))205 // sky = dynamic_cast<WorldEntity*>(created);206 // if( element->Value() != NULL && !strcmp( element->Value(), "Terrain"))207 // {208 // terrain = dynamic_cast<Terrain*>(created);209 // CDEngine::getInstance()->setTerrain(terrain);210 // }211 // }212 // element = element->NextSiblingElement();213 // glmis->step(); //! @todo temporary214 // PRINTF(4)("Done loading NetworkWorldEntities\n");215 // }216 }217 69 218 70 219 220 -
branches/network/src/story_entities/multi_player_world.h
r6366 r6404 11 11 12 12 class TiXmlElement; 13 class MultiPlayerWorldData; 13 14 14 15 … … 26 27 void loadParams(const TiXmlElement* root); 27 28 28 virtual ErrorMessage load();29 30 29 private: 31 void constuctorInit(const char* name, int worldID); 32 30 MultiPlayerWorldData* multiPlayerWorldData; //!< reference to the datatank 33 31 }; 34 32 -
branches/network/src/story_entities/single_player_world.cc
r6402 r6404 16 16 17 17 #include "single_player_world.h" 18 #include "single_player_world_data.h" 18 19 19 20 #include "state.h" … … 42 43 43 44 this->loadParams(root); 45 46 this->singlePlayerWorldData = new SinglePlayerWorldData(); 44 47 } 45 48 … … 68 71 } 69 72 70 71 72 73 // ErrorMessage SinglePlayerWorld::load()74 // {75 // static_cast<GameWorld*>(this)->load();76 //77 // /* the the single player specific stuff here */78 //79 // /* some static world entities */80 // for(int i = 0; i < 100; i++)81 // {82 // WorldEntity* tmp = new NPCTest1();83 // char npcChar[10];84 // sprintf (npcChar, "NPC_%d", i);85 // tmp->setName(npcChar);86 // tmp->setAbsCoor(((float)rand()/RAND_MAX) * 5000, 50/*+ (float)rand()/RAND_MAX*20*/, ((float)rand()/RAND_MAX -.5) *30);87 // this->spawn(tmp);88 // }89 // }90 -
branches/network/src/story_entities/single_player_world.h
r6374 r6404 11 11 12 12 class TiXmlElement; 13 class SinglePlayerWorldData; 13 14 14 15 … … 28 29 29 30 private: 30 31 SinglePlayerWorldData* singlePlayerWorldData; //!< reference to the data tank 31 32 }; 32 33
Note: See TracChangeset
for help on using the changeset viewer.