Changeset 9705 in orxonox.OLD for branches/new_class_id/src/util
- Timestamp:
- Aug 25, 2006, 9:44:53 PM (18 years ago)
- Location:
- branches/new_class_id/src/util
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/util/animation/animation.cc
r5777 r9705 20 20 #include "animation_player.h" 21 21 22 NewObjectListDefinition(Animation); 22 23 /** 23 24 * creates a new Animation … … 27 28 Animation::Animation() 28 29 { 29 this-> setClassID(CL_ANIMATION, "Animation");30 this->registerObject(this, Animation::_objectList); 30 31 31 32 // initialize a beginning KeyFrame, that will be deleted afterwards -
branches/new_class_id/src/util/animation/animation.h
r6222 r9705 73 73 class Animation : public BaseObject 74 74 { 75 public: 75 NewObjectListDeclaration(Animation); 76 public: 76 77 virtual ~Animation(); 77 78 … … 95 96 inline bool ifDelete() { return bDelete; }; 96 97 97 98 protected: 98 99 Animation(); 99 100 100 101 void handleInfinity(); 101 102 102 103 protected: 103 104 // variables 104 105 float localTime; //!< The Time passed since the beginning of the currentKeyFrame. … … 119 120 class aTest 120 121 { 121 122 public: 122 123 inline aTest() { last = 0.0;} 123 124 /** a little debug information to show the results of this class @param f new value */ 124 125 inline void littleDebug(float f) { diff = f - last; printf("f=%f, diff=%f\n", f,diff); last = f;} 125 126 private: 126 127 float diff; //!< difference from the last value 127 128 float last; //!< the last calculated value -
branches/new_class_id/src/util/animation/animation_player.cc
r9406 r9705 22 22 23 23 24 24 NewObjectListDefinition(AnimationPlayer); 25 25 /** 26 26 * standard constructor … … 28 28 AnimationPlayer::AnimationPlayer () 29 29 { 30 this-> setClassID(CL_ANIMATION_PLAYER, "AnimationPlayer");30 this->registerObject(this, AnimationPlayer::_objectList); 31 31 this->setName("AnimationPlayer"); 32 32 -
branches/new_class_id/src/util/animation/animation_player.h
r5777 r9705 28 28 eveything else will be done by the AnimationPlayer itself.\n 29 29 */ 30 class AnimationPlayer : public BaseObject { 30 class AnimationPlayer : public BaseObject 31 { 32 NewObjectListDeclaration(AnimationPlayer); 31 33 32 34 public: 33 35 /** @returns a Pointer to the only object of this Class */ 34 36 inline static AnimationPlayer* getInstance() { if (!singletonRef) singletonRef = new AnimationPlayer(); return singletonRef; }; … … 50 52 void debug(); 51 53 52 54 private: 53 55 /* singleton */ 54 56 AnimationPlayer(); -
branches/new_class_id/src/util/kill_target.cc
r9406 r9705 22 22 23 23 24 24 #include "class_id.h" 25 25 CREATE_FACTORY(KillTarget, CL_KILL_TARGET); 26 NewObjectListDefinitionID(KillTarget, CL_KILL_TARGET); 26 27 27 28 … … 32 33 KillTarget::KillTarget (const TiXmlElement* root) 33 34 : MissionGoal(root) { 34 this->setClassID(CL_KILL_TARGET, "KillTarget");35 this->registerObject(this, KillTarget::_objectList); 35 36 36 37 if( root != NULL) -
branches/new_class_id/src/util/kill_target.h
r7464 r9705 17 17 class KillTarget : public MissionGoal 18 18 { 19 NewObjectListDeclaration(KillTarget); 19 20 20 21 public: -
branches/new_class_id/src/util/mission_goal.cc
r9406 r9705 24 24 25 25 26 26 NewObjectListDefinition(MissionGoal); 27 27 /** 28 28 * standard constructor … … 31 31 MissionGoal::MissionGoal (const TiXmlElement* root) 32 32 { 33 this->setClassID(CL_MISSION_GOAL, "MissionGoal");33 this->registerObject(this, MissionGoal::_objectList); 34 34 35 35 this->missionState = MS_PASSIVE; -
branches/new_class_id/src/util/mission_goal.h
r7464 r9705 26 26 //! A class representing a mission goal 27 27 class MissionGoal : public BaseObject { 28 NewObjectListDeclaration(MissionGoal); 28 29 29 30 public: -
branches/new_class_id/src/util/multiplayer_team_deathmatch.cc
r9704 r9705 56 56 */ 57 57 MultiplayerTeamDeathmatch::MultiplayerTeamDeathmatch(const TiXmlElement* root) 58 : NetworkGameRules(root)58 : NetworkGameRules(root) 59 59 { 60 60 this->registerObject(this, MultiplayerTeamDeathmatch::_objectList); … … 111 111 112 112 LoadParam(root, "death-penalty-timeout", this, MultiplayerTeamDeathmatch, setDeathPenaltyTimeout) 113 113 .describe("sets the time in seconds a player has to wait for respawn"); 114 114 115 115 LoadParam(root, "max-kills", this, MultiplayerTeamDeathmatch, setMaxKills) 116 116 .describe("sets the maximal kills for winning condition"); 117 117 118 118 LoadParam(root, "num-teams", this, MultiplayerTeamDeathmatch, setNumTeams) 119 119 .describe("sets number of teams"); 120 120 121 121 } … … 189 189 } 190 190 191 // if( PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() ) )192 // {193 // PRINTF(0)("prefered team id: %i, noteam: %i\n", PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() )->getPreferedTeamId(), TEAM_NOTEAM);194 // }191 // if( PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() ) ) 192 // { 193 // PRINTF(0)("prefered team id: %i, noteam: %i\n", PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() )->getPreferedTeamId(), TEAM_NOTEAM); 194 // } 195 195 196 196 // check if the menu should be removed and the game state should be entered … … 270 270 if( unlikely( this->bLocalPlayerDead)) 271 271 { 272 273 272 } 274 273 } … … 305 304 { 306 305 if ( team == TEAM_NOTEAM || team == TEAM_SPECTATOR ) 307 return CL_SPECTATOR;306 return NewObjectListBase::retrieveIdentity("Spectator"); 308 307 309 308 if ( team == 0 || team == 1 ) 310 return CL_TURBINE_HOVER;309 return NewObjectListBase::retrieveIdentity("TurbineHover"); 311 310 312 311 assert( false ); … … 314 313 315 314 316 std::string MultiplayerTeamDeathmatch::getPlayableModelFileName( int userId, int team, ClassIDclassId )315 std::string MultiplayerTeamDeathmatch::getPlayableModelFileName( int userId, int team, const NewClassID& classId ) 317 316 { 318 317 if (classId == CL_TURBINE_HOVER) 319 return "models/ships/hoverglider_mainbody.obj";318 return "models/ships/hoverglider_mainbody.obj"; 320 319 if ( team == 0 ) 321 320 return "models/creatures/doom_guy.md2"; … … 326 325 } 327 326 328 std::string MultiplayerTeamDeathmatch::getPlayableModelTextureFileName( int userId, int team, ClassIDclassId )327 std::string MultiplayerTeamDeathmatch::getPlayableModelTextureFileName( int userId, int team, const NewClassID& classId ) 329 328 { 330 329 if ( classId == CL_FPS_PLAYER ) … … 339 338 } 340 339 341 float MultiplayerTeamDeathmatch::getPlayableScale( int userId, int team, ClassIDclassId )342 { 343 if ( classId == CL_FPS_PLAYER)340 float MultiplayerTeamDeathmatch::getPlayableScale( int userId, int team, const NewClassID& classId ) 341 { 342 if ( classId == NewObjectListBase::retrieveIdentity(CL_FPS_PLAYER)) 344 343 { 345 344 return 10.0f; … … 359 358 teamScore[i] = 0; 360 359 361 362 const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYER_STATS ); 363 364 if ( !list ) 365 return; 366 367 for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ ) 368 { 369 PlayerStats & stats = *dynamic_cast<PlayerStats*>(*it); 360 for (NewObjectList<PlayerStats>::const_iterator it = PlayerStats::objectList().begin(); 361 it != PlayerStats::objectList().end(); 362 ++it) 363 { 364 PlayerStats & stats = *(*it); 370 365 371 366 if ( stats.getTeamId() >= 0 ) … … 387 382 playersInTeam[i] = 0; 388 383 389 const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYER_STATS ); 390 391 if ( !list ) 392 return 0; 393 394 for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ ) 395 { 396 PlayerStats & stats = *dynamic_cast<PlayerStats*>(*it); 384 for (NewObjectList<PlayerStats>::const_iterator it = PlayerStats::objectList().begin(); 385 it != PlayerStats::objectList().end(); 386 ++it) 387 { 388 PlayerStats & stats = *(*it); 397 389 398 390 if ( stats.getTeamId() >= 0 ) … … 450 442 void MultiplayerTeamDeathmatch::handleTeamChanges( ) 451 443 { 452 const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYER_STATS ); 453 454 if ( !list ) 455 return; 456 457 //first server players with choices 458 for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ ) 459 { 460 PlayerStats & stats = *dynamic_cast<PlayerStats*>(*it); 444 for (NewObjectList<PlayerStats>::const_iterator it = PlayerStats::objectList().begin(); 445 it != PlayerStats::objectList().end(); 446 ++it) 447 { 448 PlayerStats & stats = *(*it); 461 449 462 450 if ( stats.getTeamId() != stats.getPreferedTeamId() ) … … 470 458 471 459 //now serve player who want join a random team 472 for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ ) 473 { 474 PlayerStats & stats = *dynamic_cast<PlayerStats*>(*it); 460 for (NewObjectList<PlayerStats>::const_iterator it = PlayerStats::objectList().begin(); 461 it != PlayerStats::objectList().end(); 462 ++it) 463 { 464 PlayerStats & stats = *(*it); 475 465 476 466 if ( stats.getTeamId() != stats.getPreferedTeamId() ) … … 501 491 502 492 503 ClassID playableClassId = getPlayableClassId( userId, stats.getPreferedTeamId() );493 NewClassID playableClassId = getPlayableClassId( userId, stats.getPreferedTeamId() ); 504 494 std::string playableModel = getPlayableModelFileName( userId, stats.getPreferedTeamId(), playableClassId ); 505 495 std::string playableTexture = getPlayableModelTextureFileName( userId, stats.getPreferedTeamId(), playableClassId ); … … 584 574 if ( event.bPressed ) 585 575 this->bShowTeamChange = true; 586 } else if ( event.type == SDLK_F1 ) 576 } 577 else if ( event.type == SDLK_F1 ) 587 578 { 588 579 if ( this->statsBox && !this->bLocalPlayerDead && event.bPressed ) … … 680 671 void MultiplayerTeamDeathmatch::hideStats( ) 681 672 { 682 683 684 685 686 673 if ( statsBox ) 674 { 675 delete statsBox; 676 statsBox = NULL; 677 } 687 678 } 688 679 … … 819 810 void MultiplayerTeamDeathmatch::respawnPlayable( Playable * playable, int teamId, float delay ) 820 811 { 821 const std::list<BaseObject*> * list = ClassList::getList( CL_SPAWNING_POINT );822 823 assert( list );824 812 825 813 std::vector<SpawningPoint*> spList; 826 814 827 for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ ) 828 { 829 SpawningPoint * sp = dynamic_cast<SpawningPoint*>(*it); 815 for (NewObjectList<SpawningPoint>::const_iterator it = SpawningPoint::objectList().begin(); 816 it != SpawningPoint::objectList().end(); 817 ++it) 818 { 819 SpawningPoint * sp = (*it); 830 820 831 821 if ( sp->getTeamId() == teamId ) … … 835 825 if ( spList.size() == 0 ) 836 826 { 837 for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ ) 838 { 839 SpawningPoint * sp = dynamic_cast<SpawningPoint*>(*it); 827 for (NewObjectList<SpawningPoint>::const_iterator it = SpawningPoint::objectList().begin(); 828 it != SpawningPoint::objectList().end(); 829 ++it) 830 { 831 SpawningPoint * sp = (*it); 840 832 841 833 if ( sp->getTeamId() < 0 ) -
branches/new_class_id/src/util/singleplayer_shootemup.cc
r9406 r9705 25 25 26 26 27 27 #include "class_id.h" 28 28 CREATE_FACTORY(SingleplayerShootemup, CL_SINGLEPLAYER_SHOOTEMUP); 29 30 29 NewObjectListDefinitionID(SingleplayerShootemup, CL_SINGLEPLAYER_SHOOTEMUP); 31 30 32 31 /** … … 36 35 : GameRules(root) 37 36 { 38 this-> setClassID(CL_SINGLEPLAYER_SHOOTEMUP, "SingleplayerShootemup");37 this->registerObject(this, SingleplayerShootemup::_objectList); 39 38 40 39 if( root != NULL) -
branches/new_class_id/src/util/singleplayer_shootemup.h
r7464 r9705 18 18 class SingleplayerShootemup : public GameRules 19 19 { 20 20 NewObjectListDeclaration(SingleplayerShootemup); 21 21 public: 22 22 SingleplayerShootemup(const TiXmlElement* root = NULL); -
branches/new_class_id/src/util/track/pilot_node.cc
r7868 r9705 24 24 25 25 26 NewObjectListDefinition(PilotNode); 26 27 /** 27 28 * standard constructor … … 29 30 PilotNode::PilotNode () 30 31 { 31 this->setClassID(CL_PILOT_PARENT, "PilotNode");32 this->registerObject(this, PilotNode::_objectList); 32 33 this->setName("PilotNode"); 33 34 -
branches/new_class_id/src/util/track/pilot_node.h
r5039 r9705 15 15 //! The PilotNode is a node that enables the is driven by the Mouse 16 16 class PilotNode : public WorldEntity, public EventListener { 17 NewObjectListDeclaration(PilotNode); 17 18 18 19 public:
Note: See TracChangeset
for help on using the changeset viewer.