Changeset 8876 in orxonox.OLD for branches/single_player_map
- Timestamp:
- Jun 28, 2006, 5:33:20 PM (19 years ago)
- Location:
- branches/single_player_map/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/single_player_map/src/defs/class_id.h
r8793 r8876 187 187 CL_BSP_ENTITY = 0x00000312, 188 188 CL_SKYDOME = 0x00000313, 189 CL_DOOR = 0x00000314, 189 190 190 191 // Playables … … 212 213 CL_TARGETING_TURRET = 0x000003a4, 213 214 CL_HYPERBLASTER = 0x000003a5, 215 CL_FPS_SNIPER_RIFLE = 0x000003a6, 216 CL_FPS_LASER_RIFLE = 0x000003a7, 214 217 215 218 // Projectiles -
branches/single_player_map/src/lib/collision_reaction/cr_physics_ground_walk.cc
r8864 r8876 29 29 30 30 #include "aabb.h" 31 32 #include "cr_defs.h" 31 33 32 34 using namespace std; … … 70 72 WorldEntity* entity = collision->getEntityB(); 71 73 74 // collision position maths 75 Vector collPos = collision->getEntityB()->getAbsCoor() + box->center - ce->getCollisionPosition(); 76 72 77 float CR_MAX_WALK_HEIGHT = 2.0f; 73 78 float CR_THRESHOLD = 0.2f; 74 79 75 if( box != NULL)80 if( box == NULL) 76 81 { 77 78 Vector collPos = collision->getEntityB()->getAbsCoor() + box->center - ce->getCollisionPosition(); 79 height = collPos.y - box->halfLength[1]; 80 81 PRINTF(0)("height: %f , model height: %f\n", height, box->halfLength[1]); 82 PRINTF(0)(" ground normal: %f, %f, %f\n", normal.x, normal.y, normal.z); 83 84 // object is beneath the plane (ground) 85 if( height < 0.0f ) 86 { 87 entity->shiftCoor(Vector(0, -height, 0)); 88 } 89 // object is already in the wall 90 else if( ce->isInWall()) 91 { 92 entity->setAbsCoor(entity->getLastAbsCoor()); 93 } 94 95 96 82 PRINTF(2)("this model has no aabb box so there is no correct collision reaction implemented. skipping\n"); 83 return; 97 84 } 85 86 87 switch( ce->getType()) 88 { 89 case COLLISION_TYPE_AXIS_Y: 90 91 height = collPos.y - box->halfLength[1]; 92 PRINTF(0)("height: %f , model height: %f\n", height, box->halfLength[1]); 93 PRINTF(0)(" ground normal: %f, %f, %f\n", normal.x, normal.y, normal.z); 94 95 // object is beneath the plane (ground) 96 if( height <= 0.0f ) 97 { 98 entity->shiftCoor(Vector(0, -height, 0)); 99 } 100 // object is already in the wall 101 else if( ce->isInWall()) 102 { 103 entity->setAbsCoor(entity->getLastAbsCoor()); 104 } 105 break; 106 107 108 case COLLISION_TYPE_AXIS_X: 109 case COLLISION_TYPE_AXIS_Z: 110 break; 111 112 } 113 114 115 98 116 99 117 … … 177 195 void CRPhysicsGroundWalk::update(WorldEntity* owner) 178 196 { 179 for( int i = 9; i > 0; i--) { 180 this->lastPositions[i] = this->lastPositions[i-1]; 181 // PRINTF(0)("lastPosition[%i]: %f, %f, %f\n", i, lastPositions[i].x, lastPositions[i].y, lastPositions[i].z); 182 } 183 this->lastPositions[0] = owner->getAbsCoor(); 197 184 198 } 185 199 -
branches/single_player_map/src/lib/collision_reaction/cr_physics_ground_walk.h
r8724 r8876 23 23 virtual void update(WorldEntity* entity); 24 24 25 25 26 private: 26 Vector lastPosition; //!< vector with the last valid position27 Vector afterLastPosition; //!< vector for the after last28 Quaternion lastDirection; //!< quat with the last valid direction29 30 Vector lastPositions[10]; //!< last 10 positions31 27 float downspeed; 32 28 }; -
branches/single_player_map/src/world_entities/door.cc
r8875 r8876 67 67 WorldEntity::loadParams(root); 68 68 69 // LoadParam(root, "", this, Door, set)70 // .describe("sets the animation of the md2 model")71 //.defaultValues(1);69 LoadParam(root, "", this, Door, setActionRadius) 70 .describe("sets the action radius of the door") 71 .defaultValues(1); 72 72 73 73 } 74 74 75 75 76 void Door::setAnim (int animationIndex, int animPlaybackMode)76 void Door::setAnimation(int animationIndex, int animPlaybackMode) 77 77 { 78 78 if( likely(this->getModel(0) != NULL)) … … 86 86 ((InteractiveModel*)this->getModel(0))->tick(time); 87 87 88 89 } 90 91 92 /** 93 * open the door 94 */ 95 void Door::open() 96 { 97 if( this->bLocked) 98 return; 99 100 // this->setAnimation(); 101 102 } 103 104 105 /** 106 * close the door 107 */ 108 void Door::close() 109 { 88 110 89 111 } -
branches/single_player_map/src/world_entities/door.h
r8875 r8876 18 18 virtual void loadParams(const TiXmlElement* root); 19 19 20 void setAnim(int animationIndex, int animPlaybackMode);21 20 void setActionRadius(float radius) { this->actionRadius = radius; } 22 21 … … 26 25 void close(); 27 26 27 void lock() { this->bLocked = true; } 28 void unlock() { this->bLocked = false; } 29 bool isLocked() const { return this->bLocked; } 30 31 28 32 private: 29 33 bool checkOpen(); 34 void setAnimation(int animationIndex, int animPlaybackMode); 35 30 36 31 37 private: 32 38 bool bOpen; //!< true if the door is open 39 bool bLocked; //!< true if this door is locked 33 40 float actionRadius; //!< action radius 41 34 42 35 43 };
Note: See TracChangeset
for help on using the changeset viewer.