Changeset 8957 in orxonox.OLD for branches/single_player_map/src/world_entities/npcs
- Timestamp:
- Jun 30, 2006, 2:35:42 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
r8955 r8957 171 171 172 172 173 void GenericNPC::nextStep() 174 { 175 if (!this->behaviourList.empty()) 176 this->behaviourList.pop_front(); 177 else 178 return; 179 173 174 void GenericNPC::initNPC() 175 { 180 176 if (!this->behaviourList.empty()) 181 177 { … … 200 196 case Shoot: 201 197 if( this->getAnimation() != STAND) 198 this->setAnimation(STAND, MD2_ANIM_LOOP); 199 break; 200 201 default: 202 if( this->getAnimation() != STAND) 203 this->setAnimation(STAND, MD2_ANIM_LOOP); 204 break; 205 206 } 207 } 208 } 209 210 211 void GenericNPC::nextStep() 212 { 213 if (!this->behaviourList.empty()) 214 this->behaviourList.pop_front(); 215 else 216 return; 217 218 if (!this->behaviourList.empty()) 219 { 220 switch(this->behaviourList.front().type) 221 { 222 case Walk: 223 if( this->getAnimation() != RUN) 224 this->setAnimation(RUN, MD2_ANIM_LOOP); 225 break; 226 case Run: 227 if( this->getAnimation() != RUN) 228 this->setAnimation(RUN, MD2_ANIM_LOOP); 229 break; 230 case Crouch: 231 if( this->getAnimation() != CROUCH_WALK) 232 this->setAnimation(CROUCH_WALK, MD2_ANIM_LOOP); 233 break; 234 case LookAt: 235 if( this->getAnimation() != STAND) 236 this->setAnimation(STAND, MD2_ANIM_LOOP); 237 break; 238 case Shoot: 239 if( this->getAnimation() != STAND) 202 240 this->setAnimation(STAND, MD2_ANIM_LOOP); 203 241 break; … … 215 253 } 216 254 } 255 256 217 257 218 258 … … 228 268 { 229 269 this->behaviourList.push_back(anim); 270 this->initNPC(); 230 271 } 231 272 else … … 247 288 anim.type = Run; 248 289 249 this->behaviourList.push_back(anim); 290 if( this->behaviourList.empty()) 291 { 292 this->behaviourList.push_back(anim); 293 this->initNPC(); 294 } 295 else 296 this->behaviourList.push_back(anim); 250 297 } 251 298 … … 262 309 anim.type = Crouch; 263 310 264 this->behaviourList.push_back(anim); 311 if( this->behaviourList.empty()) 312 { 313 this->behaviourList.push_back(anim); 314 this->initNPC(); 315 } 316 else 317 this->behaviourList.push_back(anim); 265 318 } 266 319 void GenericNPC::crouchTo(float x, float y, float z) … … 277 330 anim.type = TurnTo; 278 331 279 this->behaviourList.push_back(anim); 332 if( this->behaviourList.empty()) 333 { 334 this->behaviourList.push_back(anim); 335 this->initNPC(); 336 } 337 else 338 this->behaviourList.push_back(anim); 280 339 } 281 340 … … 292 351 anim.type = LookAt; 293 352 294 this->behaviourList.push_back(anim); 353 if( this->behaviourList.empty()) 354 { 355 this->behaviourList.push_back(anim); 356 this->initNPC(); 357 } 358 else 359 this->behaviourList.push_back(anim); 295 360 } 296 361 … … 340 405 case Walk: 341 406 { 342 // if( this->getAnimation() != RUN)343 // this->setAnimation(RUN, MD2_ANIM_LOOP);344 407 345 408 Vector dest = currentAnimation.v - this->getAbsCoor(); -
branches/single_player_map/src/world_entities/npcs/generic_npc.h
r8951 r8957 83 83 bool isAnimationFinished(); 84 84 85 void initNPC(); 86 85 87 86 88 private:
Note: See TracChangeset
for help on using the changeset viewer.