Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3020 for code/branches


Ignore:
Timestamp:
May 23, 2009, 7:04:10 PM (16 years ago)
Author:
landauf
Message:

some small adjustments in all the new gametype classes

Location:
code/branches/gametypes/src/orxonox
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gametypes/src/orxonox/OrxonoxPrereqs.h

    r2826 r3020  
    139139    class MovableEntity;
    140140    class Sublevel;
     141    class ForceField;
    141142
    142143    class Model;
     
    163164    class Pawn;
    164165    class SpaceShip;
     166    class TeamBaseMatchBase;
     167    class Destroyer;
    165168
    166169    class Item;
     
    173176    class EventTrigger;
    174177    class PlayerTrigger;
     178    class CheckPoint;
    175179
    176180    class WeaponSystem;
     
    202206    class Deathmatch;
    203207    class TeamDeathmatch;
     208    class Asteroids;
     209    class TeamBaseMatch;
     210    class UnderAttack;
    204211    class Pong;
    205212
     
    234241    class HUDSpeedBar;
    235242    class HUDHealthBar;
     243    class HUDTimer;
    236244    class InGameConsole;
    237245    class Notification;
  • code/branches/gametypes/src/orxonox/objects/gametypes/Asteroids.cc

    r3019 r3020  
    2121 *
    2222 *   Author:
    23  *      Aurelian
     23 *      Aurelian Jaggi
    2424 *   Co-authors:
    2525 *      ...
     
    5050    {
    5151        SUPER(Asteroids, tick, dt);
    52  
     52
    5353        if (firstCheckpointReached_ && !this->timerIsActive_)
    5454        {
  • code/branches/gametypes/src/orxonox/objects/gametypes/Asteroids.h

    r3019 r3020  
    2121 *
    2222 *   Author:
    23  *      Aurelian
     23 *      Aurelian Jaggi
    2424 *   Co-authors:
    2525 *      ...
     
    4646            virtual void start();
    4747            virtual void end();
    48            
     48
    4949            inline void firstCheckpointReached(bool reached)
    5050              { this->firstCheckpointReached_ = reached; }
  • code/branches/gametypes/src/orxonox/objects/gametypes/TeamBaseMatch.cc

    r3019 r3020  
    2020 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    2121 *
    22  *   Author: Val Mikos
     22 *   Author:
     23 *      Val Mikos
     24 *   Co-authors:
     25 *      ...
     26 *
    2327 */
    24  
    25  
    2628
    2729#include "TeamBaseMatch.h"
    2830
    29 
    30 #include "objects/worldentities/pawns/TeamBaseMatchBase.h"
     31#include "objects/worldentities/pawns/TeamBaseMatchBase.h"
    3132#include "core/CoreIncludes.h"
    32 #include "core/XMLPort.h"
    33 
    34  
     33
    3534namespace orxonox
    3635{
    3736    CreateUnloadableFactory(TeamBaseMatch);
    3837
    39 
    40     // Timer and Creator
    4138    TeamBaseMatch::TeamBaseMatch(BaseObject* creator) : TeamDeathmatch(creator)
    4239    {
     
    4946        this->pointsTeam2_ = 0;
    5047    }
    51      
    52    
    53     // set the Bases positions using XML
    54     void TeamBaseMatch::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    55     {
    56         SUPER(TeamBaseMatch, XMLPort, xmlelement, mode);
    57 
    58 //        XMLPortObject(TeamBaseMatch, WorldEntity, setNeutralshape, getNeturalshape, xmlelement, mode);
    59 //        XMLPortObject(TeamBaseMatch, WorldEntity, setTeam1shape, getTeam1shape, xmlelement, mode);
    60 //        XMLPortObject(TeamBaseMatch, WorldEntity, setTeam2shape, getTeam2shape, xmlelement, mode);
    61 
    62 //        XMLPortObject(TeamBaseMatch, TeamBaseMatchBase,  addBase, getBase, xmlelement, mode);
    63     }
    64    
    65 /*
    66     // pretty useless at the moment...should be implemented in the TeamBaseMatchBase class headerfile
    67     // State of the Base (controlled, uncontrolled)
    68     int TeamBaseMatch::baseState(Base)
    69     {
    70         if(Enum state_==uncontrolled) return 0;
    71         if(Enum state_==controlTeam1) return 1;
    72         if(Enum state_==controlTeam2) return 2;
    73     }
    74 */ 
    75 
    7648
    7749    // Change the control of the defeated base and respawn it with its initial health
     
    11789        {
    11890            std::map<PlayerInfo*, int>::const_iterator it1 = this->teamnumbers_.find(pawn1->getPlayer());
    119             int teamnrbase = -1;
    120             int teamnrplayer = getTeam(pawn1->getPlayer());
    121 
    122             switch(base->getState())
     91            int teamnrbase = -1;
     92            int teamnrplayer = getTeam(pawn1->getPlayer());
     93
     94            switch (base->getState())
    12395            {
    12496                case BaseState::controlTeam1:
     
    130102                case BaseState::uncontrolled:
    131103                default:
    132                     teamnrbase = -1;
    133             }
    134 
    135 
    136             if(teamnrbase == teamnrplayer){
    137                 return false;
    138             }
     104                    teamnrbase = -1;
     105            }
     106
     107            if (teamnrbase == teamnrplayer)
     108                return false;
    139109        }
    140110        return true;
     
    155125    void TeamBaseMatch::showPoints()
    156126    {
    157        
     127
    158128        COUT(0) << "Points standing:" << std::endl << "Team 1: "<< pointsTeam1_ << std::endl << "Team 2: " << pointsTeam2_ << std::endl;
    159129        if(pointsTeam1_ >=1700) COUT(0) << "Team 1 is near victory!" << std::endl;
     
    205175        {
    206176            this->pointsTeam2_ += points;
    207         }     
     177        }
    208178
    209179        this->endGame();
     
    227197        return 0;
    228198    }
    229    
     199
    230200}
    231201
    232  
     202
  • code/branches/gametypes/src/orxonox/objects/gametypes/TeamBaseMatch.h

    r3019 r3020  
    2121 *
    2222 *   Author:
    23  *      Fabian 'x3n' Landau
     23 *      Val Mikos
    2424 *   Co-authors:
    25  *      Val Mikos
     25 *      ...
    2626 *
    2727 */
     
    3232#include "OrxonoxPrereqs.h"
    3333
    34 #include <vector>
    3534#include <set>
    36 
    3735#include "TeamDeathmatch.h"
    3836#include "tools/Timer.h"
    3937
    40 
    41 
    4238namespace orxonox
    4339{
    44     class TeamBaseMatchBase;
    45 
    46 
    4740    class _OrxonoxExport TeamBaseMatch : public TeamDeathmatch
    4841    {
    4942        public:
    5043            TeamBaseMatch(BaseObject* creator);
    51            
    52             // if class closes, close everything           
    5344            virtual ~TeamBaseMatch() {}
    54            
    55            
    56             // set Base positions with XML
    57             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    58                        
     45
    5946            virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0);
     47            virtual bool allowPawnDamage(Pawn* victim, Pawn* originator);
    6048
    61             virtual bool allowPawnDamage(Pawn* victim, Pawn* originator);
    62 
    63 
    64 
    65             // give information about the state of a base
    66             // (this should be pretty useless atm)
    67 //            virtual int baseState(Base);
    68            
    69             virtual void playerScored(PlayerInfo* player);
     49            virtual void playerScored(PlayerInfo* player);
    7050            virtual void showPoints();
    7151            virtual void endGame();
    72            
     52
    7353            void addBase(TeamBaseMatchBase* base);
    7454            TeamBaseMatchBase* getBase(unsigned int index) const;
    7555
    7656            void addTeamPoints(int team, int points);
    77            
    78            
    79            
    80            
     57
    8158        protected:
    8259            void winPoints();
    8360
    84 
    85             bool pawnsAreInTheSameTeam(Pawn* pawn1, TeamBaseMatchBase* base);
     61            bool pawnsAreInTheSameTeam(Pawn* pawn1, TeamBaseMatchBase* base);
    8662            using TeamDeathmatch::pawnsAreInTheSameTeam;
    8763
     
    8965            Timer<TeamBaseMatch> scoreTimer_;
    9066            Timer<TeamBaseMatch> outputTimer_;
    91            
     67
    9268            //points for each team
    9369            int pointsTeam1_;
  • code/branches/gametypes/src/orxonox/objects/gametypes/UnderAttack.cc

    r3019 r3020  
    2121 *
    2222 *   Author:
    23  *      Fabian 'x3n' Landau
     23 *      Matthias Mock
    2424 *   Co-authors:
    2525 *      ...
     
    3232#include "core/CoreIncludes.h"
    3333#include "core/ConfigValueIncludes.h"
    34 #include "objects/Teamcolourable.h"
    35 #include "objects/worldentities/TeamSpawnPoint.h"
    3634#include "util/Convert.h"
     35#include "network/Host.h"
    3736
    38 #include "network/Host.h"
     37#include "objects/worldentities/pawns/Destroyer.h"
     38
    3939namespace orxonox
    4040{
     
    168168        }
    169169    }
    170 
    171170}
  • code/branches/gametypes/src/orxonox/objects/gametypes/UnderAttack.h

    r3019 r3020  
    2121 *
    2222 *   Author:
    23  *      Fabian 'x3n' Landau
     23 *      Matthias Mock
    2424 *   Co-authors:
    2525 *      ...
     
    3232#include "OrxonoxPrereqs.h"
    3333
    34 #include <vector>
    35 #include "objects/worldentities/pawns/Destroyer.h"
    3634#include "TeamDeathmatch.h"
    3735#include "objects/worldentities/pawns/Pawn.h"
  • code/branches/gametypes/src/orxonox/objects/worldentities/ForceField.cc

    r3019 r3020  
    5353    {
    5454      SUPER(ForceField, XMLPort, xmlelement, mode);
    55    
     55
    5656      //For correct xml import use: position, direction, velocity, scale
    5757
     
    6060      XMLPortParam(ForceField, "length"  , setLength  , getLength  , xmlelement, mode).defaultValues(2000);
    6161    }
    62  
     62
    6363    void ForceField::tick(float dt)
    6464    {
    65      
     65
    6666      for (ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)
    6767      {
    68        
    69         //calculate from 
     68
     69        //calculate from
    7070        Vector3 directionVec = this->getOrientation() * WorldEntity::FRONT;
    7171        directionVec.normalise();
     
    8181          it->applyCentralForce(((diameter_ / 2 - distFromCenterVec) / (diameter_ / 2)) * directionVec * velocity_);
    8282        }
    83        
     83
    8484      }
    8585  }
  • code/branches/gametypes/src/orxonox/objects/worldentities/pawns/Destroyer.cc

    r3019 r3020  
    2121 *
    2222 *   Author:
    23  *      Fabian 'x3n' Landau
     23 *      Matthias Mock
    2424 *   Co-authors:
    2525 *      ...
     
    3030#include "Destroyer.h"
    3131
    32 #include "BulletDynamics/Dynamics/btRigidBody.h"
    33 
    34 #include "util/Math.h"
    35 #include "util/Exception.h"
    3632#include "core/CoreIncludes.h"
    37 #include "core/ConfigValueIncludes.h"
    38 #include "core/Template.h"
    39 #include "core/XMLPort.h"
    40 #include "objects/items/Engine.h"
    4133#include "objects/gametypes/UnderAttack.h"
    4234
     
    5547        }
    5648    }
    57 
    5849}
  • code/branches/gametypes/src/orxonox/objects/worldentities/pawns/Destroyer.h

    r3019 r3020  
    2121 *
    2222 *   Author:
    23  *      Fabian 'x3n' Landau
     23 *      Matthias Mock
    2424 *   Co-authors:
    2525 *      ...
     
    3131
    3232#include "OrxonoxPrereqs.h"
    33 
    34 #include "LinearMath/btVector3.h"
    3533
    3634#include "SpaceShip.h"
  • code/branches/gametypes/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.cc

    r3019 r3020  
    2121 *
    2222 *   Author:
    23  *      Fabian 'x3n' Landau
     23 *      Val Mikos
    2424 *   Co-authors:
    25  *      Val Mikos
     25 *      ...
    2626 *
    2727 */
     
    7474        }
    7575
    76        
     76
    7777        std::set<WorldEntity*> attachments = this->getAttachedObjects();
    7878        for (std::set<WorldEntity*>::iterator it = attachments.begin(); it != attachments.end(); ++it)
  • code/branches/gametypes/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.h

    r3019 r3020  
    2121 *
    2222 *   Author:
    23  *      Fabian 'x3n' Landau
     23 *      Val Mikos
    2424 *   Co-authors:
    25  *      Val Mikos
     25 *      ...
    2626 *
    2727 */
    28 
    29 
    30 
    31 // setState und getState functions declare here
    32 // TeamBaseMatchBase class
    33 
    34 
    35 // save as TeamBaseMatchBase.h in objects/worldentities/pawns/TeamBaseMatchBase.h
    36 
    3728
    3829#ifndef _TeamBaseMatchBase_H__
     
    6152            TeamBaseMatchBase(BaseObject* creator);
    6253
    63             // if class closes, close everything 
     54            // if class closes, close everything
    6455            virtual ~TeamBaseMatchBase() {}
    65              
    66              
    67              
    68             // Set the state of a base to whatever the argument of the function is 
     56
     57
     58
     59            // Set the state of a base to whatever the argument of the function is
    6960            void setState(BaseState::Enum state)
    7061            {
    7162                this->state_ = state;
    7263                this->changeTeamColour();
    73             }
     64            }
    7465
    7566
    76             // Get the state of a base as a return value
    77             BaseState::Enum getState()
    78             {
    79                 return this->state_;
    80             }
     67            // Get the state of a base as a return value
     68            BaseState::Enum getState() const
     69            {
     70                return this->state_;
     71            }
    8172
    8273
  • code/branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.cc

    r3019 r3020  
    2121 *
    2222 *   Author:
    23  *      Aurelian
     23 *      Aurelian Jaggi
    2424 *   Co-authors:
    2525 *      ...
     
    2929#include "OrxonoxStableHeaders.h"
    3030#include "CheckPoint.h"
    31 #include "objects/gametypes/Asteroids.h"
    32 
    33 #include <OgreNode.h>
    3431
    3532#include "core/CoreIncludes.h"
    3633#include "core/XMLPort.h"
    3734
    38 #include "orxonox/objects/worldentities/ControllableEntity.h"
     35#include "objects/gametypes/Asteroids.h"
    3936#include "orxonox/objects/worldentities/pawns/Pawn.h"
    4037
     
    5956  {
    6057  }
    61  
     58
    6259  void CheckPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    6360  {
     
    6865    XMLPortParam(CheckPoint, "addtime", setAddTime, getAddTime, xmlelement, mode).defaultValues(30);
    6966  }
    70  
     67
    7168  void CheckPoint::triggered(bool bIsTriggered)
    7269  {
     
    7572    Asteroids* gametype = dynamic_cast<Asteroids*>(this->getGametype());
    7673    if (gametype)
    77     { 
     74    {
    7875        gametype->addTime(addTime_);
    7976
     
    8380            gametype->firstCheckpointReached(true);
    8481        }
    85      
     82
    8683        if (bIsTriggered && bIsDestination_)
    8784        {
  • code/branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.h

    r3019 r3020  
    2121 *
    2222 *   Author:
    23  *      Aurelian
     23 *      Aurelian Jaggi
    2424 *   Co-authors:
    2525 *      ...
     
    3030    @file
    3131    @brief
    32     Definition of the PlayerTrigger class.
    3332*/
    3433
     
    3837#include "DistanceTrigger.h"
    3938
    40 #include <set>
    41 
    42 #include "core/ClassTreeMask.h"
    43 #include "core/BaseObject.h"
    44 
    45 #include "orxonox/objects/worldentities/ControllableEntity.h"
    46 
    4739namespace orxonox
    4840{
    4941  class _OrxonoxExport CheckPoint : public DistanceTrigger
    50     {
     42  {
    5143    public:
    5244      CheckPoint(BaseObject* creator);
    5345      virtual ~CheckPoint();
    54        
     46
    5547      virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a CheckPoint object through XML.
    5648
    5749    private:
    58       virtual void triggered(bool bIsTriggered); 
     50      virtual void triggered(bool bIsTriggered);
    5951      virtual void notifyMaskUpdate();
    6052
     
    6355
    6456      inline bool getDestination()
    65         { return bIsDestination_; }     
    66    
     57        { return bIsDestination_; }
     58
    6759      inline void setFirst(bool isFirst)
    6860        { this->bIsFirst_ = isFirst; }
     
    7668      inline bool getAddTime()
    7769        { return this->addTime_; }
    78      
     70
    7971      bool bIsFirst_;
    8072      bool bIsDestination_;
  • code/branches/gametypes/src/orxonox/overlays/hud/HUDTimer.cc

    r3019 r3020  
    3030#include "HUDTimer.h"
    3131
    32 #include <OgreTextAreaOverlayElement.h>
    33 
    3432#include "core/CoreIncludes.h"
    3533#include "util/Convert.h"
    36 #include "objects/infos/GametypeInfo.h"
    37 #include "objects/infos/PlayerInfo.h"
    3834#include "objects/worldentities/ControllableEntity.h"
    39 #include "objects/worldentities/pawns/Spectator.h"
    4035#include "objects/gametypes/Gametype.h"
    4136
     
    6863
    6964  void HUDTimer::changedOwner()
    70   { 
     65  {
    7166    SUPER(HUDTimer, changedOwner);
    7267
  • code/branches/gametypes/src/orxonox/overlays/hud/HUDTimer.h

    r3019 r3020  
    4949      private:
    5050        ControllableEntity* owner_;
    51     };
     51  };
    5252}
    5353#endif /* _HUDTimer_H__ */
Note: See TracChangeset for help on using the changeset viewer.