Changeset 3646 in orxonox.OLD for orxonox/trunk/src
- Timestamp:
- Mar 23, 2005, 5:43:07 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/Makefile.am
r3618 r3646 35 35 track_node.cc \ 36 36 simple_animation.cc \ 37 garbage_collector.cc \ 37 38 story_entities/story_entity.cc \ 38 39 story_entities/campaign.cc \ … … 81 82 track_node.h \ 82 83 simple_animation.h \ 84 garbage_collector.h \ 83 85 story_entities/story_entity.h \ 84 86 story_entities/story_def.h \ -
orxonox/trunk/src/Makefile.in
r3618 r3646 56 56 command_node.$(OBJEXT) keynames.$(OBJEXT) camera.$(OBJEXT) \ 57 57 track_manager.$(OBJEXT) track_node.$(OBJEXT) \ 58 simple_animation.$(OBJEXT) story_entity.$(OBJEXT) \59 campaign.$(OBJEXT) world.$(OBJEXT) world_entity.$(OBJEXT) \60 player.$(OBJEXT) environment.$(OBJEXT) skysphere.$(OBJEXT) \61 terrain.$(OBJEXT) primitive.$(OBJEXT) weapon.$(OBJEXT) \62 projectile.$(OBJEXT) character_attributes.$(OBJEXT) \63 test_gun.$(OBJEXT) ai.$(OBJEXT) p_node.$(OBJEXT) \64 null_parent.$(OBJEXT) helper_parent.$(OBJEXT) \58 simple_animation.$(OBJEXT) garbage_collector.$(OBJEXT) \ 59 story_entity.$(OBJEXT) campaign.$(OBJEXT) world.$(OBJEXT) \ 60 world_entity.$(OBJEXT) player.$(OBJEXT) environment.$(OBJEXT) \ 61 skysphere.$(OBJEXT) terrain.$(OBJEXT) primitive.$(OBJEXT) \ 62 weapon.$(OBJEXT) projectile.$(OBJEXT) \ 63 character_attributes.$(OBJEXT) test_gun.$(OBJEXT) ai.$(OBJEXT) \ 64 p_node.$(OBJEXT) null_parent.$(OBJEXT) helper_parent.$(OBJEXT) \ 65 65 data_tank.$(OBJEXT) graphics_engine.$(OBJEXT) light.$(OBJEXT) \ 66 66 fontset.$(OBJEXT) array.$(OBJEXT) objModel.$(OBJEXT) \ … … 83 83 @AMDEP_TRUE@ ./$(DEPDIR)/environment.Po ./$(DEPDIR)/fontset.Po \ 84 84 @AMDEP_TRUE@ ./$(DEPDIR)/game_loader.Po \ 85 @AMDEP_TRUE@ ./$(DEPDIR)/garbage_collector.Po \ 85 86 @AMDEP_TRUE@ ./$(DEPDIR)/glmenu_imagescreen.Po \ 86 87 @AMDEP_TRUE@ ./$(DEPDIR)/graphics_engine.Po \ … … 238 239 track_node.cc \ 239 240 simple_animation.cc \ 241 garbage_collector.cc \ 240 242 story_entities/story_entity.cc \ 241 243 story_entities/campaign.cc \ … … 284 286 track_node.h \ 285 287 simple_animation.h \ 288 garbage_collector.h \ 286 289 story_entities/story_entity.h \ 287 290 story_entities/story_def.h \ … … 410 413 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fontset.Po@am__quote@ 411 414 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/game_loader.Po@am__quote@ 415 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/garbage_collector.Po@am__quote@ 412 416 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glmenu_imagescreen.Po@am__quote@ 413 417 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/graphics_engine.Po@am__quote@ -
orxonox/trunk/src/lib/coord/p_node.cc
r3644 r3646 354 354 { 355 355 pNode->remove(); 356 this->children->remove (pNode);356 //this->children->remove (pNode); 357 357 pNode->parent = NULL; 358 358 } -
orxonox/trunk/src/lib/lang/base_object.cc
r3607 r3646 30 30 { 31 31 this->className = NULL; 32 this->finalized = false; 32 33 } 33 34 … … 58 59 return true; 59 60 } 61 62 63 bool BaseObject::isFinalized() 64 { 65 return this->finalized; 66 } 67 68 69 void BaseObject::finalize() 70 { 71 this->finalized = true; 72 } -
orxonox/trunk/src/lib/lang/base_object.h
r3609 r3646 21 21 bool isA (char* className); 22 22 23 bool isFinalized(); 24 void finalize(); 25 23 26 private: 24 27 char* className; 25 28 bool finalized; 26 29 }; 27 30 -
orxonox/trunk/src/story_entities/world.cc
r3644 r3646 26 26 #include "track_node.h" 27 27 #include "world_entity.h" 28 #include "track_manager.h"29 28 #include "player.h" 30 29 #include "camera.h" … … 35 34 #include "light.h" 36 35 36 #include "track_manager.h" 37 #include "garbage_collector.h" 38 37 39 #include "command_node.h" 38 40 #include "glmenu_imagescreen.h" … … 182 184 WorldInterface* wi = WorldInterface::getInstance(); 183 185 wi->init(this); 186 this->garbageCollector = GarbageCollector::getInstance(); 184 187 } 185 188 … … 506 509 { 507 510 return this->entities; 511 } 512 513 514 /** 515 \brief this returns the current game time 516 \returns elapsed game time 517 */ 518 double World::getGameTime() 519 { 520 return this->gameTime; 508 521 } 509 522 … … 721 734 this->dt = currentFrame - this->lastFrame; 722 735 723 if( dt > 0)736 if( this->dt > 0) 724 737 { 725 738 float fps = 1000/dt; … … 733 746 PRINTF(2)("fps = 1000 - frame rate is adjusted\n"); 734 747 SDL_Delay(10); 735 dt = 10;748 this->dt = 10; 736 749 } 737 750 //this->timeSlice (dt); … … 739 752 /* function to let all entities tick (iterate through list) */ 740 753 WorldEntity* entity; 741 float seconds = dt / 1000.0; 754 float seconds = this->dt / 1000.0; 755 this->gameTime += seconds; 742 756 entity = entities->enumerate(); 743 757 while( entity != NULL) … … 749 763 750 764 /* update tick the rest */ 751 this->trackManager->tick(dt); 752 this->localCamera->tick(dt); 765 this->trackManager->tick(this->dt); 766 this->localCamera->tick(this->dt); 767 this->garbageCollector->tick(seconds); 753 768 } 754 769 this->lastFrame = currentFrame; … … 764 779 void World::update() 765 780 { 781 this->garbageCollector->update(); 766 782 this->nullParent->update (dt); 767 783 } -
orxonox/trunk/src/story_entities/world.h
r3644 r3646 23 23 class FontSet; 24 24 class Terrain; 25 class GarbageCollector; 25 26 26 27 //! The game world Interface … … 57 58 virtual ~World (); 58 59 60 double getGameTime(); 59 61 60 62 /* classes from story-entity */ … … 88 90 Uint32 lastFrame; //!< last time of frame 89 91 Uint32 dt; //!< time needed to calculate this frame 92 double gameTime; //!< this is where the game time is saved 90 93 bool bQuitOrxonox; //!< quit this application 91 94 bool bQuitCurrentGame; //!< quit only the current game and return to menu … … 108 111 tList<WorldEntity>* entities;//!< A template List of all entities. Every moving thing should be included here, and world automatically updates them. 109 112 WorldEntity* localPlayer; //!< The Player, you fly through the level. 113 114 GarbageCollector* garbageCollector; //!< reference to the garbage collector 110 115 111 116 /* function for main-loop */ -
orxonox/trunk/src/world_entities/projectile.cc
r3633 r3646 20 20 21 21 #include "world_entity.h" 22 #include "null_parent.h" 22 23 #include "objModel.h" 23 24 #include "primitive.h" … … 35 36 this->projectileModel = new Primitive(P_SPHERE); 36 37 this->flightDirection = NULL; 38 this->currentLifeTime = 0.0f; 39 this->ttl = 1.0f; 37 40 this->speed = 1.1f; 38 41 } … … 69 72 70 73 /** 74 \brief this sets the time to life of the projectile 75 \param ttl in second 76 77 after this life time, the projectile will garbage collect itself 78 */ 79 void Projectile::setTTL(float ttl) 80 { 81 this->ttl = ttl; 82 } 83 84 85 /** 71 86 \brief signal tick, time dependent things will be handled here 72 87 \param time since last tick … … 74 89 void Projectile::tick (float time) 75 90 { 76 *this->flightDirection = *this->flightDirection * speed; 77 this->shiftCoor(this->flightDirection); 91 this->currentLifeTime += time; 92 if( this->ttl < this->currentLifeTime) 93 { 94 *this->flightDirection = *this->flightDirection * speed; 95 this->shiftCoor(this->flightDirection); 96 return; 97 } 98 this->finalize(); 99 //NullParent* np = NullParent::getInstance(); 100 /* garbage colelction */ 101 // \fix: there is no gc in this class, its all been done by GarbageCollector 78 102 } 79 103 -
orxonox/trunk/src/world_entities/projectile.h
r3632 r3646 21 21 22 22 void setFlightDirection(Quaternion* flightDirection); 23 void setSpeed(float speed); 24 void setTTL(float ttl); 23 25 24 26 virtual void hit (WorldEntity* weapon, Vector* loc); … … 32 34 Primitive* projectileModel; //!< this serves temporary as a plasma bullet 33 35 float speed; //!< this is the speed of the projectile 36 float currentLifeTime; //!< this is the time, the projectile exists in this world (incremented by tick) 37 float ttl; //!< time to life, after this time, the projectile will garbage collect itself 34 38 Vector* flightDirection; //!< direction in which the shoot flights 39 35 40 }; 36 41 -
orxonox/trunk/src/world_entities/test_gun.cc
r3632 r3646 93 93 pj->setFlightDirection(q); 94 94 95 printf("TestGun::current speed is: %f", this->getSpeed()); 96 95 97 this->worldEntities->add(pj); 96 98 } -
orxonox/trunk/src/world_entities/weapon.cc
r3631 r3646 183 183 */ 184 184 void Weapon::fire() 185 { 186 187 } 185 {} 188 186 189 187 -
orxonox/trunk/src/world_entities/weapon.h
r3631 r3646 61 61 bool hasWeaponIdleTimeElapsed(void); 62 62 63 virtual void fire(void) ;63 virtual void fire(void) = 0; 64 64 virtual void hit (WorldEntity* weapon, Vector* loc); 65 65 virtual void destroy(void);
Note: See TracChangeset
for help on using the changeset viewer.