Changeset 9889 in orxonox.OLD for branches/coll_rect/src/world_entities
- Timestamp:
- Oct 13, 2006, 3:57:44 PM (18 years ago)
- Location:
- branches/coll_rect/src/world_entities
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/coll_rect/src/world_entities/creatures/fps_player.cc
r9869 r9889 167 167 168 168 //subscribe to collision reaction 169 this->subscribeReaction(C REngine::CR_PHYSICS_FULL_WALK, BspEntity::staticClassID());169 this->subscribeReaction(CoRe::CREngine::CR_PHYSICS_FULL_WALK, BspEntity::staticClassID()); 170 170 171 171 this->initWeapon = false; -
branches/coll_rect/src/world_entities/npcs/generic_npc.cc
r9869 r9889 96 96 97 97 // collision reaction registration 98 this->subscribeReaction(C REngine::CR_PHYSICS_GROUND_WALK, BspEntity::staticClassID());98 this->subscribeReaction(CoRe::CREngine::CR_PHYSICS_GROUND_WALK, BspEntity::staticClassID()); 99 99 } 100 100 -
branches/coll_rect/src/world_entities/weapons/aiming_system.cc
r9869 r9889 61 61 62 62 // registering default reactions: 63 this->unsubscribeReaction(C REngine::CR_OBJECT_DAMAGE);64 this->subscribeReaction(C REngine::CR_OBJECT_DAMAGE, WorldEntity::staticClassID());63 this->unsubscribeReaction(CoRe::CREngine::CR_OBJECT_DAMAGE); 64 this->subscribeReaction(CoRe::CREngine::CR_OBJECT_DAMAGE, WorldEntity::staticClassID()); 65 65 66 66 this->range = 1000.0f; -
branches/coll_rect/src/world_entities/world_entity.cc
r9869 r9889 78 78 79 79 // reset all collision handles to NULL == unsubscribed state 80 for(int i = 0; i < C REngine::CR_NUMBER; ++i)80 for(int i = 0; i < CoRe::CREngine::CR_NUMBER; ++i) 81 81 this->collisionHandles[i] = NULL; 82 82 this->bReactive = false; … … 84 84 85 85 // registering default reactions: 86 this->subscribeReaction(C REngine::CR_OBJECT_DAMAGE, /* WorldEntity::staticClassID(), */ Projectile::staticClassID());86 this->subscribeReaction(CoRe::CREngine::CR_OBJECT_DAMAGE, /* WorldEntity::staticClassID(), */ Projectile::staticClassID()); 87 87 88 88 this->toList(OM_NULL); … … 302 302 * @param target1 a filter target (classID) 303 303 */ 304 void WorldEntity::subscribeReaction(C REngine::CRType type, const ClassID& target1)304 void WorldEntity::subscribeReaction(CoRe::CREngine::CRType type, const ClassID& target1) 305 305 { 306 306 this->subscribeReaction(type); … … 316 316 * @param target1 a filter target (classID) 317 317 */ 318 void WorldEntity::subscribeReaction(C REngine::CRType type, const ClassID& target1, const ClassID& target2)318 void WorldEntity::subscribeReaction(CoRe::CREngine::CRType type, const ClassID& target1, const ClassID& target2) 319 319 { 320 320 this->subscribeReaction(type); … … 331 331 * @param target1 a filter target (classID) 332 332 */ 333 void WorldEntity::subscribeReaction(C REngine::CRType type, const ClassID& target1, const ClassID& target2, const ClassID& target3)333 void WorldEntity::subscribeReaction(CoRe::CREngine::CRType type, const ClassID& target1, const ClassID& target2, const ClassID& target3) 334 334 { 335 335 this->subscribeReaction(type); … … 342 342 343 343 344 /**345 * subscribes this world entity to a collision reaction346 * @param type the type of reaction to subscribe to347 * @param target1 a filter target (classID)348 */349 void WorldEntity::subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2, const ClassID& target3, const ClassID& target4)350 {351 this->subscribeReaction(type);352 353 // add the target filter354 this->collisionHandles[type]->addTarget(target1);355 this->collisionHandles[type]->addTarget(target2);356 this->collisionHandles[type]->addTarget(target3);357 this->collisionHandles[type]->addTarget(target4);358 }359 360 344 361 345 /** … … 365 349 * @param ... the targets as classIDs 366 350 */ 367 void WorldEntity::subscribeReaction(C REngine::CRType type)351 void WorldEntity::subscribeReaction(CoRe::CREngine::CRType type) 368 352 { 369 353 if( this->collisionHandles[type] != NULL) … … 373 357 } 374 358 375 this->collisionHandles[type] = C REngine::getInstance()->subscribeReaction(this, type);359 this->collisionHandles[type] = CoRe::CREngine::getInstance()->subscribeReaction(this, type); 376 360 377 361 // now there is at least one collision reaction subscribed … … 384 368 * @param type the reaction to unsubscribe 385 369 */ 386 void WorldEntity::unsubscribeReaction(C REngine::CRType type)370 void WorldEntity::unsubscribeReaction(CoRe::CREngine::CRType type) 387 371 { 388 372 if( this->collisionHandles[type] == NULL) 389 373 return; 390 374 391 C REngine::getInstance()->unsubscribeReaction(this->collisionHandles[type]);375 CoRe::CREngine::getInstance()->unsubscribeReaction(this->collisionHandles[type]); 392 376 this->collisionHandles[type] = NULL; 393 377 394 378 // check if there is still any handler registered 395 for(int i = 0; i < C REngine::CR_NUMBER; ++i)379 for(int i = 0; i < CoRe::CREngine::CR_NUMBER; ++i) 396 380 { 397 381 if( this->collisionHandles[i] != NULL) … … 410 394 void WorldEntity::unsubscribeReaction() 411 395 { 412 for( int i = 0; i < C REngine::CR_NUMBER; i++)413 this->unsubscribeReaction((C REngine::CRType)i);396 for( int i = 0; i < CoRe::CREngine::CR_NUMBER; i++) 397 this->unsubscribeReaction((CoRe::CREngine::CRType)i); 414 398 415 399 // there are no reactions subscribed from now on … … 433 417 434 418 // get a collision event 435 Co llisionEvent* c =CREngine::getInstance()->popCollisionEventObject();419 CoRe::CollisionEvent* c = CoRe::CREngine::getInstance()->popCollisionEventObject(); 436 420 assert(c != NULL); // if this should fail: we got not enough precached CollisionEvents: alter value in cr_defs.h 437 421 c->collide(COLLISION_TYPE_OBB, entityA, entityB, bvA, bvB); 438 422 439 for( int i = 0; i < C REngine::CR_NUMBER; ++i)423 for( int i = 0; i < CoRe::CREngine::CR_NUMBER; ++i) 440 424 if( this->collisionHandles[i] != NULL) 441 425 this->collisionHandles[i]->registerCollisionEvent(c); … … 457 441 458 442 // get a collision event 459 Co llisionEvent* c =CREngine::getInstance()->popCollisionEventObject();443 CoRe::CollisionEvent* c = CoRe::CREngine::getInstance()->popCollisionEventObject(); 460 444 assert(c != NULL); // if this should fail: we got not enough precached CollisionEvents: alter value in cr_defs.h 461 445 c->collide(type, entity, groundEntity, normal, position, bInWall); 462 446 463 for( int i = 0; i < C REngine::CR_NUMBER; ++i)447 for( int i = 0; i < CoRe::CREngine::CR_NUMBER; ++i) 464 448 if( this->collisionHandles[i] != NULL) 465 449 this->collisionHandles[i]->registerCollisionEvent(c); -
branches/coll_rect/src/world_entities/world_entity.h
r9888 r9889 82 82 83 83 /* --- Collision Reaction Block --- */ 84 void subscribeReaction(CREngine::CRType type); 85 void subscribeReaction(CREngine::CRType type, const ClassID& target1); 86 void subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2); 87 void subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2, const ClassID& target3); 88 void subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2, const ClassID& target3, const ClassID& target4); 89 90 void unsubscribeReaction(CREngine::CRType type); 84 void subscribeReaction(CoRe::CREngine::CRType type); 85 void subscribeReaction(CoRe::CREngine::CRType type, const ClassID& target1); 86 void subscribeReaction(CoRe::CREngine::CRType type, const ClassID& target1, const ClassID& target2); 87 void subscribeReaction(CoRe::CREngine::CRType type, const ClassID& target1, const ClassID& target2, const ClassID& target3); 88 89 void unsubscribeReaction(CoRe::CREngine::CRType type); 91 90 void unsubscribeReaction(); 92 91 … … 96 95 inline bool isReactive() const { return this->bReactive; } 97 96 98 Co llisionHandle* getCollisionHandle(CREngine::CRType type) const { return this->collisionHandles[type]; }97 CoRe::CollisionHandle* getCollisionHandle(CoRe::CREngine::CRType type) const { return this->collisionHandles[type]; } 99 98 100 99 /** @returns true if this entity is standing on ground (BSP model) */ … … 212 211 int healthMax_handle; 213 212 214 Co llisionHandle* collisionHandles[CREngine::CR_NUMBER]; //!< the list of the collision reactions213 CoRe::CollisionHandle* collisionHandles[CoRe::CREngine::CR_NUMBER]; //!< the list of the collision reactions 215 214 bool bReactive; //!< true if there is at least one collision reaction subscibed 215 216 216 217 217 PhysicsInterface physicsInterface; //!< the physics object of the WorldEntity
Note: See TracChangeset
for help on using the changeset viewer.