- Timestamp:
- Jun 30, 2006, 12:20:28 AM (18 years ago)
- Location:
- branches/single_player_map/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/single_player_map/src/lib/collision_reaction/cr_physics_ground_walk.cc
r8930 r8931 156 156 } 157 157 } 158 PRINTF(0)("collision distan zes: x: %f, y: %f, z: %f\n", front, height, side);158 PRINTF(0)("collision distances: x: %f, y: %f, z: %f\n", front, height, side); 159 159 160 160 -
branches/single_player_map/src/world_entities/npcs/repair_station.cc
r8927 r8931 36 36 37 37 //! list of all different animations a std md2model supports 38 sAnim RepairStation::animationList[2] = 38 // sAnim RepairStation::animationList[2] = 39 // { 40 // // begin, end, fps, interruptable 41 // { 0, 10, 30, 0 }, //!< OPEN 42 // { 10, 20, 30, 0 } //!< CLOSE 43 // }; 44 45 46 sAnim RepairStation::animationList[8] = 39 47 { 40 48 // begin, end, fps, interruptable 41 { 0, 10, 30, 0 }, //!< OPEN 42 { 10, 20, 30, 0 } //!< CLOSE 49 { 0, 12, 30, 0 }, //!< CYCLE01 50 { 12, 24, 30, 0 }, //!< CYCLE02 51 { 24, 40, 30, 0 }, //!< CYCLE03 52 { 40, 55, 30, 0 }, //!< CYCLE04 53 { 55, 68, 30, 0 }, //!< CYCLE05 54 { 68, 81, 30, 0 }, //!< CYCLE06 55 { 81, 89, 30, 0 }, //!< CYCLE07 56 { 89, 99, 30, 0 } //!< CYCLE08 43 57 }; 44 58 … … 133 147 134 148 135 /**136 * open the door137 */138 void RepairStation::open()139 {140 if( this->bLocked)141 return;142 143 this->setAnimation(DOOR_OPEN, MD2_ANIM_ONCE);144 this->bOpen = true;145 }146 149 147 150 148 /**149 * close the door150 */151 void RepairStation::close()152 {153 this->setAnimation(DOOR_CLOSE, MD2_ANIM_ONCE);154 this->bOpen = false;155 }156 157 158 159 /**160 * checks if the door is open161 */162 bool RepairStation::checkOpen()163 {164 165 std::list<BaseObject*>::const_iterator it;166 const std::list<BaseObject*>* list = ClassList::getList(CL_PLAYABLE);167 WorldEntity* entity;168 float distance;169 170 if( list == NULL)171 return false;172 173 // for all players174 for( it = list->begin(); it != list->end(); it++)175 {176 entity = dynamic_cast<WorldEntity*>(*it);177 178 distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len());179 if( distance < this->actionRadius)180 return true;181 }182 183 184 list = ClassList::getList(CL_GENERIC_NPC);185 if( list == NULL)186 return false;187 for( it = list->begin(); it != list->end(); it++)188 {189 entity = dynamic_cast<WorldEntity*>(*it);190 191 distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len());192 if( distance < this->actionRadius)193 return true;194 }195 196 return false;197 }198 199 200 -
branches/single_player_map/src/world_entities/npcs/repair_station.h
r8927 r8931 12 12 typedef enum RepairStationAnimType 13 13 { 14 STATION_OPEN = 0, 15 STATION_CLOSE, 14 REPAIR_CYCLE01 = 0, 15 REPAIR_CYCLE02, 16 REPAIR_CYCLE03, 17 REPAIR_CYCLE04, 18 REPAIR_CYCLE05, 19 REPAIR_CYCLE06, 20 REPAIR_CYCLE07, 21 REPAIR_CYCLE08, 16 22 17 23 DOOR_MAX_ANIMATIONS … … 31 37 void setScale(float scale) { this->scale = scale; } 32 38 33 void open();34 void close();35 36 void lock() { this->bLocked = true; }37 void unlock() { this->bLocked = false; }38 bool isLocked() const { return this->bLocked; }39 40 41 39 virtual void tick (float time); 42 40 43 41 44 42 private: 45 bool checkOpen();46 43 void setAnimation(int animNum, int playbackMode = 0); 47 44 48 45 49 46 private: 50 bool bOpen; //!< true if the door is open51 bool bLocked; //!< true if this door is locked52 float actionRadius; //!< action radius53 47 float scale; //!< the scale of the model 54 48 55 static sAnim animationList[ 2]; //!< list of the animations49 static sAnim animationList[8]; //!< list of the animations 56 50 57 51
Note: See TracChangeset
for help on using the changeset viewer.