- Timestamp:
- Aug 10, 2005, 11:58:29 AM (19 years ago)
- Location:
- orxonox/trunk/src/story_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/story_entities/world.cc
r4977 r4978 74 74 using namespace std; 75 75 76 76 //! This creates a Factory to fabricate a World 77 77 CREATE_FACTORY(World); 78 78 … … 90 90 This creates a new empty world! 91 91 */ 92 World::World (c har* name)92 World::World (const char* name) 93 93 { 94 94 this->path = NULL; … … 119 119 ParticleEngine::getInstance()->debug(); 120 120 121 // here everything that is alocated by the World is deleted 121 122 delete this->entities; 122 123 State::setWorldEntityList(NULL); 123 // delete NullParent::getInstance();124 125 124 126 125 delete LightManager::getInstance(); 127 126 delete TrackManager::getInstance(); 128 127 delete ParticleEngine::getInstance(); 129 128 delete AnimationPlayer::getInstance(); // this should be at the end of the unloading sequence. 129 delete PhysicsEngine::getInstance(); 130 131 // external engines initialized by the orxonox-class get deleted 130 132 TextEngine::getInstance()->flush(); 131 133 SoundEngine::getInstance()->flushAllBuffers(); 132 134 SoundEngine::getInstance()->flushAllSources(); 133 134 delete AnimationPlayer::getInstance(); // this should be at the end of the unloading sequence.135 delete PhysicsEngine::getInstance();136 //delete garbagecollecor137 //delete animator138 139 135 FastFactory::flushAll(); 136 137 // erease everything that is left. 140 138 delete NullParent::getInstance(); 141 EventHandler::getInstance()->debug(); 142 143 LoadClassDescription::printAll(); 144 145 139 140 141 // unload the resources !! 146 142 ResourceManager::getInstance()->unload(this->music); 147 143 ResourceManager::getInstance()->unloadAllByPriority(RP_LEVEL); … … 149 145 150 146 /** 151 * initializes the world. 152 153 set all stuff here that is world generic and does not use to much memory 154 because the real init() function StoryEntity::init() will be called 155 shortly before start of the game. 156 since all worlds are initiated/referenced before they will be started. 157 NO LEVEL LOADING HERE - NEVER! 158 */ 159 void World::constuctorInit(char* name, int worldID) 147 * initializes the world. 148 * @param name the name of the world 149 * @param worldID the ID of this world 150 * 151 * set all stuff here that is world generic and does not use to much memory 152 * because the real init() function StoryEntity::init() will be called 153 * shortly before start of the game. 154 * since all worlds are initiated/referenced before they will be started. 155 * NO LEVEL LOADING HERE - NEVER! 156 */ 157 void World::constuctorInit(const char* name, int worldID) 160 158 { 161 159 this->setClassID(CL_WORLD, "World"); 162 160 163 //this->worldName = name; 164 //this->worldName = new char[strlen(name)+1]; 165 //strcpy(this->worldName, name); 161 this->setName(name); 166 162 this->debugWorldNr = worldID; 167 163 … … 169 165 } 170 166 167 /** 168 * loads the parameters of a World from an XML-element 169 * @param root the XML-element to load from 170 */ 171 171 void World::loadParams(const TiXmlElement* root) 172 172 { 173 const char *string;174 char *name;175 int id;176 177 173 PRINTF(4)("Creating a World\n"); 178 174 … … 187 183 } 188 184 189 190 /** 191 * this is executed before load 192 193 since the load function sometimes needs data, that has been init before 194 the load and after the proceeding storyentity has finished 185 /** 186 * this is executed just before load 187 * 188 * since the load function sometimes needs data, that has been initialized 189 * before the load and after the proceeding storyentity has finished 195 190 */ 196 191 ErrorMessage World::preLoad() … … 199 194 this->cycle = 0; 200 195 201 202 196 /* init the world interface */ 203 197 204 198 LightManager::getInstance(); 205 this->nullParent = NullParent::getInstance (); 206 this->nullParent->setName ("NullParent"); 199 NullParent::getInstance (); 207 200 208 201 AnimationPlayer::getInstance(); // initializes the animationPlayer … … 210 203 211 204 this->localCamera = new Camera(); 212 this->localCamera->setName (" Camera");205 this->localCamera->setName ("World-Camera"); 213 206 214 207 State::setCamera(this->localCamera, this->localCamera->getTarget()); … … 268 261 temp = new char[strlen(string + 2)]; 269 262 strcpy( temp, string); 270 this-> worldName = temp;263 this->setName(temp); 271 264 } 272 265 else … … 274 267 temp = new char[strlen(string + 2)]; 275 268 strcpy( temp, string); 276 this->worldName = temp; 277 } 269 this->setName(temp); 270 } 271 278 272 //////////////// 279 273 // LOADSCREEN // … … 376 370 377 371 378 // lightMan->setAmbientColor(.1,.1,.1);379 // lightMan->addLight();380 // // lightMan->setAttenuation(1.0, .01, 0.0);381 // // lightMan->setDiffuseColor(1,1,1);382 // // lightMan->addLight(1);383 // // lightMan->setPosition(20, 10, -20);384 // // lightMan->setDiffuseColor(0,0,0);385 // //lightMan->debug();386 // lightMan->setPosition(-5.0, 50.0, -40.0);387 // lightMan->addLight();388 // lightMan->setPosition(100, 80, 60);389 390 372 // TrackManager::getInstance()->setBindSlave(env); 391 373 PNode* tn = TrackManager::getInstance()->getTrackNode(); … … 415 397 416 398 417 418 399 //////////// 419 400 // STATIC // … … 454 435 PhysicsEngine::getInstance()->debug(); 455 436 437 438 456 439 for(int i = 0; i < 100; i++) 457 440 { … … 474 457 475 458 /** 476 * loads thedebug world: only for experimental stuff459 * creates a debug world: only for experimental stuff 477 460 */ 478 461 void World::loadDebugWorld(int worldID) … … 637 620 } 638 621 639 640 641 622 /** 642 623 * initializes a new World shortly before start 643 644 645 624 * 625 * this is the function, that will be loaded shortly before the world is 626 * started 646 627 */ 647 628 ErrorMessage World::init() … … 899 880 { 900 881 GarbageCollector::getInstance()->update(); 901 this->nullParent->update (this->dtS);882 NullParent::getInstance()->update (this->dtS); 902 883 903 884 SoundEngine::getInstance()->update(); 904 music->update();885 //music->update(); 905 886 } 906 887 … … 998 979 Vector* relCoor, Quaternion* relDir) 999 980 { 1000 this->nullParent =NullParent::getInstance();981 NullParent::getInstance(); 1001 982 if( parentNode != NULL) 1002 983 { -
orxonox/trunk/src/story_entities/world.h
r4977 r4978 34 34 35 35 public: 36 World (c har* name);36 World (const char* name); 37 37 World (int worldID); 38 38 World (const TiXmlElement* root = NULL); … … 74 74 75 75 private: 76 void constuctorInit(c har* name, int worldID);76 void constuctorInit(const char* name, int worldID); 77 77 78 78 Uint32 lastFrame; //!< last time of frame … … 87 87 GLMenuImageScreen* glmis; //!< The Level-Loader Display 88 88 89 char* worldName; //!< The name of this World90 89 int debugWorldNr; //!< The Debug Nr. needed, if something goes wrong 91 90 char* path; //!< The file from which this world is loaded … … 95 94 96 95 // IMPORTANT WORLD-ENTITIES 97 PNode* nullParent; //!< The zero-point, that everything has as its parent.98 96 Camera* localCamera; //!< The current Camera 99 97 WorldEntity* sky; //!< The Environmental Heaven of orxonox @todo insert this to environment insted
Note: See TracChangeset
for help on using the changeset viewer.