Changeset 4597 in orxonox.OLD for orxonox/trunk/src/story_entities
- Timestamp:
- Jun 11, 2005, 12:55:48 AM (19 years ago)
- Location:
- orxonox/trunk/src/story_entities
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/story_entities/campaign.cc
r4324 r4597 1 1 2 2 3 /* 3 /* 4 4 orxonox - the future of 3D-vertical-scrollers 5 5 … … 13 13 ### File Specific: 14 14 main-programmer: Patrick Boenzli 15 co-programmer: 15 co-programmer: 16 16 */ 17 17 … … 32 32 33 33 34 Campaign::Campaign () 35 { 34 Campaign::Campaign () 35 { 36 this->setClassID(CL_CAMPAIGN, "Campaign"); 36 37 this->entities = new tList<StoryEntity>(); 37 38 this->isInit = false; 38 39 } 39 40 40 Campaign::Campaign ( TiXmlElement* root) 41 { 41 Campaign::Campaign ( TiXmlElement* root) 42 { 43 //! \todo loading with load_param.... 44 this->setClassID(CL_CAMPAIGN, "Campaign"); 42 45 TiXmlElement* element; 43 46 const char* string; 44 47 int id; 45 48 46 49 PRINTF(3)("Loading Campaign...\n"); 47 50 48 51 assert( root != NULL); 49 52 GameLoader* loader = GameLoader::getInstance(); 50 53 51 54 this->entities = new tList<StoryEntity>(); 52 55 this->isInit = false; 53 56 54 57 // grab all the necessary parameters 55 58 string = grabParameter( root, "identifier"); … … 60 63 } 61 64 else this->setStoryID( id); 62 65 63 66 // find WorldList 64 67 element = root->FirstChildElement( "WorldList"); … … 69 72 else 70 73 element = element->FirstChildElement(); 71 74 72 75 // load Worlds/Subcampaigns/Whatever 73 76 StoryEntity* lastCreated = NULL; … … 77 80 StoryEntity* created = (StoryEntity*) loader->fabricate( element); 78 81 /* 79 if( lastCreated != NULL) 80 82 if( lastCreated != NULL) 83 created->setNextStoryID( lastCreated->getStoryID()); 81 84 else 82 85 created->setNextStoryID( WORLD_ID_GAMEEND); 83 86 */ 84 87 if( created != NULL) 85 86 this->addEntity( created); 87 88 88 { 89 this->addEntity( created); 90 lastCreated = created; 91 } 89 92 element = element->NextSiblingElement(); 90 93 } 91 //if( lastCreated != NULL) 94 //if( lastCreated != NULL) 92 95 //lastCreated->setStoryID( WORLD_ID_GAMEEND); 93 96 } … … 111 114 { 112 115 ErrorMessage errorCode; 113 if( !this->isInit) return errorCode; 116 if( !this->isInit) return errorCode; 114 117 if( storyID == WORLD_ID_GAMEEND) return errorCode; 115 118 this->running = true; … … 126 129 se->start(); 127 130 se->destroy(); 128 131 129 132 delete se; 130 133 … … 133 136 se = this->getStoryEntity(nextWorldID); 134 137 this->currentEntity = se; 135 if( ( nextWorldID == WORLD_ID_GAMEEND) ||( se == NULL) ) 136 137 138 139 140 141 142 138 if( ( nextWorldID == WORLD_ID_GAMEEND) ||( se == NULL) ) 139 { 140 PRINTF(0)("Quitting campaing story loop\n"); 141 if(se != NULL) 142 delete se; 143 return errorCode; 144 } 145 143 146 } 144 147 } … … 162 165 { 163 166 this->running = false; 164 if(this->currentEntity != NULL) 167 if(this->currentEntity != NULL) 165 168 { 166 169 this->currentEntity->stop(); … … 182 185 183 186 184 /** 187 /** 185 188 \brief adds an game stroy entity to the campaign 186 189 … … 206 209 { 207 210 this->removeEntity(this->getStoryEntity(storyID)); 208 211 209 212 } 210 213 … … 251 254 tList<StoryEntity>* l; 252 255 StoryEntity* entity = NULL; 253 l = this->entities->getNext(); 254 while( l != NULL) 255 { 256 l = this->entities->getNext(); 257 while( l != NULL) 258 { 256 259 entity = l->getObject(); 257 260 l = l->getNext(); … … 260 263 //printf("Campaing::getStoryEntity() - now looping, found entity nr=%i\n", id); 261 264 if(id == storyID) 262 263 264 265 265 { 266 //printf("Campaing::getStoryEntity() - yea, this is what we where looking for: %id\n"); 267 return entity; 268 } 266 269 267 270 } … … 271 274 tIterator<StoryEntity>* iterator = this->entities->getIterator(); 272 275 StoryEntity* entity = iterator->nextElement(); 273 while( entity != NULL) 274 { 276 while( entity != NULL) 277 { 275 278 int id = entity->getStoryID(); 276 279 //printf("Campaing::getStoryEntity() - now looping, found entity nr=%i\n", id); 277 280 if(id == storyID) 278 279 280 281 281 { 282 //printf("Campaing::getStoryEntity() - yea, this is what we where looking for: %id\n"); 283 return entity; 284 } 282 285 entity = iterator->nextElement(); 283 286 } -
orxonox/trunk/src/story_entities/campaign.h
r4261 r4597 32 32 void removeEntity(int storyID); 33 33 void removeEntity(StoryEntity* se); 34 34 35 35 void nextLevel(); 36 36 void previousLevel(); -
orxonox/trunk/src/story_entities/story_def.h
r3472 r4597 20 20 #define WORLD_ID_GAMEEND 999 21 21 22 #define MAX_STORY_ENTITIES 99 //! >maximal StoryEntities in a Campaign22 #define MAX_STORY_ENTITIES 99 //!< maximal StoryEntities in a Campaign 23 23 24 24 #endif /* _STORY_DEF_H */ -
orxonox/trunk/src/story_entities/story_entity.cc
r4592 r4597 26 26 StoryEntity::StoryEntity () 27 27 { 28 this->setClassID(CL_STORY_ENTITY );28 this->setClassID(CL_STORY_ENTITY, "StoryEntity"); 29 29 } 30 30 StoryEntity::~StoryEntity () {} -
orxonox/trunk/src/story_entities/story_entity.h
r4261 r4597 1 /*! 1 /*! 2 2 \file story_entity.h 3 3 \brief holds the base class of everything that is playable - that is part of the story 4 */ 4 */ 5 5 6 6 -
orxonox/trunk/src/story_entities/world.cc
r4596 r4597 769 769 //GLMenuImageScreen* 770 770 this->glmis = new GLMenuImageScreen(); 771 this->glmis->init();772 771 this->glmis->setMaximum(8); 773 // this->glmis->draw();774 772 775 773 PRINTF(3)("World::displayLoadScreen - end\n");
Note: See TracChangeset
for help on using the changeset viewer.