Changeset 9042 in orxonox.OLD for branches/single_player_map/src/world_entities
- Timestamp:
- Jul 3, 2006, 3:44:31 PM (18 years ago)
- Location:
- branches/single_player_map/src/world_entities/npcs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/single_player_map/src/world_entities/npcs/generic_npc.cc
r9040 r9042 87 87 time = 30.0f; 88 88 89 this->behaviourList = new std::list<GenericNPC::Anim>; 90 89 91 // collision reaction registration 90 92 this->subscribeReaction(CREngine::CR_PHYSICS_GROUND_WALK, CL_BSP_ENTITY); … … 186 188 void GenericNPC::initNPC() 187 189 { 188 if (!this->behaviourList .empty())189 { 190 GenericNPC::Anim currentAnimation = this->behaviourList .front();191 192 switch(this->behaviourList .front().type)190 if (!this->behaviourList->empty()) 191 { 192 GenericNPC::Anim currentAnimation = this->behaviourList->front(); 193 194 switch(this->behaviourList->front().type) 193 195 { 194 196 case Walk: … … 211 213 212 214 Vector dir = (currentAnimation.v - this->getAbsCoor()).getNormalized(); 215 dir.y = 0.0f; 216 dir.getNormalized(); 213 217 this->setAbsDir(Quaternion(dir, Vector(0.0, 1.0, 0.0)) * Quaternion(-M_PI_2, Vector(0.0, 1.0, 0.0))); 214 218 … … 222 226 223 227 Vector dir = (currentAnimation.v - this->getAbsCoor()).getNormalized(); 228 dir.y = 0.0f; 229 dir.getNormalized(); 224 230 this->setAbsDir(Quaternion(dir, Vector(0.0, 1.0, 0.0)) * Quaternion(-M_PI_2, Vector(0.0, 1.0, 0.0))); 225 231 … … 248 254 void GenericNPC::nextStep() 249 255 { 250 if (!this->behaviourList .empty())251 this->behaviourList .pop_front();256 if (!this->behaviourList->empty()) 257 this->behaviourList->pop_front(); 252 258 else 253 259 return; 254 260 255 261 256 if (!this->behaviourList .empty())257 { 258 GenericNPC::Anim currentAnimation = this->behaviourList .front();262 if (!this->behaviourList->empty()) 263 { 264 GenericNPC::Anim currentAnimation = this->behaviourList->front(); 259 265 260 266 switch( currentAnimation.type) … … 331 337 anim.speed = 30.0f; 332 338 333 if( this->behaviourList .empty())334 { 335 this->behaviourList .push_back(anim);339 if( this->behaviourList->empty()) 340 { 341 this->behaviourList->push_back(anim); 336 342 this->initNPC(); 337 343 } 338 344 else 339 this->behaviourList .push_back(anim);345 this->behaviourList->push_back(anim); 340 346 } 341 347 … … 355 361 anim.speed = 60.0f; 356 362 357 if( this->behaviourList .empty())358 { 359 this->behaviourList .push_back(anim);363 if( this->behaviourList->empty()) 364 { 365 this->behaviourList->push_back(anim); 360 366 this->initNPC(); 361 367 } 362 368 else 363 this->behaviourList .push_back(anim);369 this->behaviourList->push_back(anim); 364 370 } 365 371 … … 376 382 anim.type = Crouch; 377 383 378 if( this->behaviourList .empty())379 { 380 this->behaviourList .push_back(anim);384 if( this->behaviourList->empty()) 385 { 386 this->behaviourList->push_back(anim); 381 387 this->initNPC(); 382 388 } 383 389 else 384 this->behaviourList .push_back(anim);390 this->behaviourList->push_back(anim); 385 391 } 386 392 void GenericNPC::crouchTo(float x, float y, float z) … … 397 403 anim.type = TurnTo; 398 404 399 if( this->behaviourList .empty())400 { 401 this->behaviourList .push_back(anim);405 if( this->behaviourList->empty()) 406 { 407 this->behaviourList->push_back(anim); 402 408 this->initNPC(); 403 409 } 404 410 else 405 this->behaviourList .push_back(anim);411 this->behaviourList->push_back(anim); 406 412 } 407 413 … … 418 424 anim.type = LookAt; 419 425 420 if( this->behaviourList .empty())421 { 422 this->behaviourList .push_back(anim);426 if( this->behaviourList->empty()) 427 { 428 this->behaviourList->push_back(anim); 423 429 this->initNPC(); 424 430 } 425 431 else 426 this->behaviourList .push_back(anim);432 this->behaviourList->push_back(anim); 427 433 } 428 434 … … 465 471 466 472 467 if (!this->behaviourList .empty())468 { 469 GenericNPC::Anim currentAnimation = this->behaviourList .front();473 if (!this->behaviourList->empty()) 474 { 475 GenericNPC::Anim currentAnimation = this->behaviourList->front(); 470 476 471 477 switch( currentAnimation.type) -
branches/single_player_map/src/world_entities/npcs/generic_npc.h
r9036 r9042 12 12 13 13 #include "sound_source.h" 14 15 #include <stack> 16 14 17 15 18 namespace OrxSound{ class SoundSource; } … … 35 38 36 39 37 bool finalGoalReached() { return this->behaviourList .empty(); };40 bool finalGoalReached() { return this->behaviourList->empty(); }; 38 41 39 42 /* npc controlling functions to be Queued */ … … 122 125 float soundVolume; 123 126 124 std::list<GenericNPC::Anim> behaviourList; 127 std::list<GenericNPC::Anim>* behaviourList; 128 std::stack<std::list<GenericNPC::Anim>* > animationStack; 125 129 Vector destCoor; 126 130 Quaternion destDir;
Note: See TracChangeset
for help on using the changeset viewer.