Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2824 for code/branches


Ignore:
Timestamp:
Mar 23, 2009, 11:26:46 AM (16 years ago)
Author:
landauf
Message:

Added "Pong" minigame

Location:
code/branches/miniprojects/src/orxonox
Files:
8 added
10 edited

Legend:

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

    r2710 r2824  
    104104    class RadarListener;
    105105
     106    class Teamcolourable;
     107
    106108    class CameraManager;
    107109    class LevelManager;
     
    149151    class ParticleSpawner;
    150152
     153    class PongCenterpoint;
     154    class PongBall;
     155    class PongBat;
     156
    151157    class Camera;
    152158    class CameraPosition;
    153159    class SpawnPoint;
     160    class TeamSpawnPoint;
    154161
    155162    class Spectator;
     
    193200
    194201    class Gametype;
     202    class Deathmatch;
     203    class TeamDeathmatch;
     204    class Pong;
    195205
    196206    class Scores;
  • code/branches/miniprojects/src/orxonox/objects/gametypes/CMakeLists.txt

    r2821 r2824  
    33  Deathmatch.cc
    44  TeamDeathmatch.cc
     5  Pong.cc
    56)
  • code/branches/miniprojects/src/orxonox/objects/gametypes/Deathmatch.cc

    r2820 r2824  
    4949        Gametype::start();
    5050
    51         COUT(0) << "game started" << std::endl;
     51        std::string message = "The match has started!";
     52        COUT(0) << message << std::endl;
     53        Host::Broadcast(message);
    5254    }
    5355
     
    5658        Gametype::end();
    5759
    58         COUT(0) << "game ended" << std::endl;
     60        std::string message = "The match has ended.";
     61        COUT(0) << message << std::endl;
     62        Host::Broadcast(message);
    5963    }
    6064
     
    117121        Gametype::pawnKilled(victim, killer);
    118122    }
     123
     124    void Deathmatch::playerScored(PlayerInfo* player)
     125    {
     126        Gametype::playerScored(player);
     127
     128        if (player)
     129        {
     130            std::string message = player->getName() + " scores!";
     131            COUT(0) << message << std::endl;
     132            Host::Broadcast(message);
     133        }
     134    }
    119135}
  • code/branches/miniprojects/src/orxonox/objects/gametypes/Deathmatch.h

    r2820 r2824  
    4949
    5050            virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);
     51            virtual void playerScored(PlayerInfo* player);
    5152    };
    5253}
  • code/branches/miniprojects/src/orxonox/objects/gametypes/Gametype.cc

    r2820 r2824  
    200200                // Reward killer
    201201                if (killer)
    202                 {
    203                     std::map<PlayerInfo*, Player>::iterator itKiller = this->players_.find(killer->getPlayer());
    204                     if (itKiller != this->players_.end())
    205                     {
    206                         this->playerScored(itKiller->second);
    207                     }
    208                     else
    209                         COUT(2) << "Warning: Killing Pawn was not in the playerlist" << std::endl;
    210                 }
     202                    this->playerScored(killer->getPlayer());
    211203
    212204                ControllableEntity* entity = this->defaultControllableEntity_.fabricate(victim->getCreator());
     
    228220    }
    229221
    230     void Gametype::playerScored(Player& player)
    231     {
    232         player.frags_++;
     222    void Gametype::playerScored(PlayerInfo* player)
     223    {
     224        std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player);
     225        if (it != this->players_.end())
     226            it->second.frags_++;
    233227    }
    234228
  • code/branches/miniprojects/src/orxonox/objects/gametypes/Gametype.h

    r2820 r2824  
    8989            virtual bool playerChangedName(PlayerInfo* player);
    9090
    91             virtual void playerScored(Player& player);
     91            virtual void playerScored(PlayerInfo* player);
    9292
    9393            virtual bool allowPawnHit(Pawn* victim, Pawn* originator = 0);
     
    129129            virtual SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const;
    130130
    131             void addPlayer(PlayerInfo* player);
    132             void removePlayer(PlayerInfo* player);
    133 
    134             void assignDefaultPawnsIfNeeded();
    135             void checkStart();
    136             void spawnPlayer(PlayerInfo* player);
    137             void spawnPlayersIfRequested();
    138             void spawnDeadPlayersIfRequested();
     131            virtual void assignDefaultPawnsIfNeeded();
     132            virtual void checkStart();
     133            virtual void spawnPlayer(PlayerInfo* player);
     134            virtual void spawnPlayersIfRequested();
     135            virtual void spawnDeadPlayersIfRequested();
    139136
    140137            GametypeInfo gtinfo_;
  • code/branches/miniprojects/src/orxonox/objects/worldentities/CMakeLists.txt

    r2768 r2824  
    2020  SpawnPoint.cc
    2121  TeamSpawnPoint.cc
     22  PongCenterpoint.cc
     23  PongBall.cc
     24  PongBat.cc
    2225)
    2326
  • code/branches/miniprojects/src/orxonox/objects/worldentities/CameraPosition.cc

    r2662 r2824  
    4444        this->bDrag_ = false;
    4545        this->bAllowMouseLook_ = false;
     46        this->bAbsolute_ = false;
    4647
    4748        this->setObjectMode(0x0);
     
    5859        XMLPortParam(CameraPosition, "drag", setDrag, getDrag, xmlelement, mode).defaultValues(false);
    5960        XMLPortParam(CameraPosition, "mouselook", setAllowMouseLook, getAllowMouseLook, xmlelement, mode).defaultValues(false);
     61        XMLPortParam(CameraPosition, "absolute", setIsAbsolute, getIsAbsolute, xmlelement, mode).defaultValues(false);
    6062    }
    6163
  • code/branches/miniprojects/src/orxonox/objects/worldentities/CameraPosition.h

    r2662 r2824  
    5454                { return this->bAllowMouseLook_; }
    5555
     56            inline void setIsAbsolute(bool bAbsolute)
     57                { this->bAbsolute_ = bAbsolute; }
     58            inline bool getIsAbsolute() const
     59                { return this->bAbsolute_; }
     60
    5661            void attachCamera(Camera* camera);
    5762
     
    5964            bool bDrag_;
    6065            bool bAllowMouseLook_;
     66            bool bAbsolute_;
    6167    };
    6268}
  • code/branches/miniprojects/src/orxonox/objects/worldentities/ControllableEntity.cc

    r2662 r2824  
    144144    void ControllableEntity::addCameraPosition(CameraPosition* position)
    145145    {
    146         if (position->getAllowMouseLook())
    147             position->attachToNode(this->cameraPositionRootNode_);
     146        if (!position->getIsAbsolute())
     147        {
     148            if (position->getAllowMouseLook())
     149                position->attachToNode(this->cameraPositionRootNode_);
     150            else
     151                this->attach(position);
     152        }
    148153        else
    149             this->attach(position);
     154        {
     155            WorldEntity* parent = this->getParent();
     156            if (parent)
     157                parent->attach(position);
     158        }
    150159        this->cameraPositions_.push_back(position);
    151160    }
Note: See TracChangeset for help on using the changeset viewer.