Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9941 for code/trunk


Ignore:
Timestamp:
Dec 29, 2013, 8:06:44 PM (11 years ago)
Author:
jo
Message:

Adding most of the changes that were proposed in the release2012 branch.

Location:
code/trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/data/gui/layouts/CreditsMenu.layout

    r9016 r9941  
    4646   
    4747    Credits:
     48    http://www.orxonox.net/wiki/credits
     49
     50    Thanks to AMIV:
     51    https://www.amiv.ethz.ch/
    4852                      </Property>
    4953                    </Window>
  • code/trunk/data/gui/scripts/MiscConfigMenu.lua

    r9939 r9941  
    3333    table.insert(P.commandList, "UnderAttack gameTime_")
    3434    table.insert(P.commandList, "TeamDeathmatch teams_")
     35    table.insert(P.commandList, "TeamDeathmatch maxScore_")
    3536    table.insert(P.commandList, "HumanPlayer nick_")
    3637    table.insert(P.commandList, "ChatOverlay displayTime_")
     
    5657    table.insert(P.nameList, "UnderAttack: game time")
    5758    table.insert(P.nameList, "TeamDeathmatch: Number of teams")
     59    table.insert(P.nameList, "TeamDeathmatch: Score needed to end the game")
    5860    table.insert(P.nameList, "Playername")
    5961    table.insert(P.nameList, "Chat: display time")
  • code/trunk/data/levels/missionOne.oxw

    r9939 r9941  
    22<LevelInfo
    33 name = "Mission One"
    4  description = "First Guided Steps in the Orxonoxian Universe."
     4 description = "Codename: Awakening - First Guided Steps in the Orxonoxian Universe."
    55 screenshot = "missionOne.png"
    66 tags = "mission"
  • code/trunk/data/levels/underAttack.oxw

    r9939 r9941  
    5656      angularDamping    = 0.9999999
    5757      health            = 10000
    58       maxhealth         = 10000
     58      maxhealth         = 10000000
    5959      initialhealth     = 10000
    6060      radarname         = "Transporter"
     
    6262
    6363      <attached>
    64         <TeamSpawnPoint team=1 position="150,0,7" direction="-1,0,0" roll=90 yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff />
    65         <TeamSpawnPoint team=1 position="0,0,7" lookat="-1,0,0" roll="90"  yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff />
    66         <TeamSpawnPoint team=1 position="-50,0,7" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff />
    67         <TeamSpawnPoint team=1 position="100,0,7" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff />
    68         <TeamSpawnPoint team=1 position="50,0,7" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff />
     64        <SpaceBoundaries position="1,2,3" maxDistance="1600" warnDistance="300" showDistance="300" reactionMode="1" healthDecrease="5.0" />
     65        <TeamSpawnPoint team=1 position="200,0,20" direction="-1,0,0" roll=90 yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff />
     66        <TeamSpawnPoint team=1 position="50,0,100" lookat="-1,0,0" roll="90"  yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff />
     67        <TeamSpawnPoint team=1 position="-200,0,-60" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff />
     68        <TeamSpawnPoint team=1 position="100,0,-50" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff />
     69        <TeamSpawnPoint team=1 position="400,0,20" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff />
    6970        <?lua for i = 1, 100, 1 do ?>
    7071          <TeamSpawnPoint
    7172            team=0
    72             position="<?lua print((math.random() * 500 + 500) * (math.floor(math.random() + 0.5) * 2 - 1)) ?>,<?lua print((math.random() * 500 + 500) * (math.floor(math.random() + 0.5) * 2 - 1)) ?>,<?lua print((math.random() * 500 + 500) * (math.floor(math.random() + 0.5) * 2 - 1)) ?>"
     73            position="<?lua print((math.random() * 450 + 450) * (math.floor(math.random() + 0.5) * 2 - 1)) ?>,<?lua print((math.random() * 450 + 450) * (math.floor(math.random() + 0.5) * 2 - 1)) ?>,<?lua print((math.random() * 450 + 450) * (math.floor(math.random() + 0.5) * 2 - 1)) ?>"
    7374            lookat="0,0,0"
    7475            spawnclass=SpaceShip
  • code/trunk/src/modules/objects/SpaceBoundaries.cc

    r9667 r9941  
    117117        this->billboards_[current].usedYet = true;
    118118
    119         Vector3 directionVector = (this->getPosition() - position).normalisedCopy(); // vector from the position of the billboard to the center of the sphere
     119        Vector3 directionVector = (this->getWorldPosition() - position).normalisedCopy(); // vector from the position of the billboard to the center of the sphere
    120120        this->billboards_[current].billy->setCommonDirection(directionVector);
    121121
     
    252252        if(item != NULL)
    253253        {
    254             Vector3 itemPosition = item->getPosition();
    255             return (itemPosition.distance(this->getPosition()));
     254            Vector3 itemPosition = item->getWorldPosition();
     255            return (itemPosition.distance(this->getWorldPosition()));
    256256        } else {
    257257            return -1;
     
    267267    {
    268268
    269         Vector3 direction = item->getPosition() - this->getPosition();
     269        Vector3 direction = item->getWorldPosition() - this->getWorldPosition();
    270270        direction.normalise();
    271271
    272         Vector3 boundaryPosition = this->getPosition() + direction * this->maxDistance_;
     272        Vector3 boundaryPosition = this->getWorldPosition() + direction * this->maxDistance_;
    273273
    274274        this->positionBillboard(boundaryPosition, alpha);
     
    277277    void SpaceBoundaries::conditionalBounceBack(Pawn *item, float currentDistance, float dt)
    278278    {
    279         Vector3 normal = item->getPosition() - this->getPosition();
     279        Vector3 normal = item->getWorldPosition() - this->getWorldPosition();
    280280        normal.normalise();
    281281        Vector3 velocity = item->getVelocity();
     
    300300        acceleration = acceleration.reflect(*normal);
    301301
    302         item->lookAt( *velocity + this->getPosition() );
     302        item->lookAt( *velocity + this->getWorldPosition() );
    303303
    304304        item->setAcceleration(acceleration * dampingFactor);
    305305        item->setVelocity(*velocity * dampingFactor);
    306306
    307         item->setPosition( item->getPosition() - *normal * 10 ); // Set the position of the Pawn to be well inside the boundary.
     307        item->setPosition( item->getWorldPosition() - *normal * 10 ); // Set the position of the Pawn to be well inside the boundary.
    308308    }
    309309
  • code/trunk/src/orxonox/gametypes/LastTeamStanding.cc

    r9667 r9941  
    242242                    party = it2->second;
    243243                }
    244                 //if (party < 0) return; //if search failed
     244                if (party < 0) return; //if search failed
    245245                //victory message to all team members, loose message to everyone else
    246                 for (std::map<PlayerInfo*, int>::iterator it3 = this->teamnumbers_.begin(); it3 != this->teamnumbers_.end(); ++it3)
    247                 {
    248                   if (it3->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    249                         continue;
    250                     if (it3->second == party)
    251                         {this->gtinfo_->sendAnnounceMessage("You have won the match!", it3->first->getClientID());}
    252                     else
    253                         {this->gtinfo_->sendAnnounceMessage("You have lost the match!", it3->first->getClientID());}
    254                 }
     246                this->announceTeamWin(party);
     247
    255248                return;
    256249            }
  • code/trunk/src/orxonox/gametypes/TeamDeathmatch.cc

    r9667 r9941  
    3333#include "infos/PlayerInfo.h"
    3434#include "worldentities/pawns/Pawn.h"
     35#include "core/config/ConfigValueIncludes.h"
    3536
    3637namespace orxonox
     
    4142    {
    4243        RegisterObject(TeamDeathmatch);
     44
     45        this->setConfigValues();
     46    }
     47
     48    void TeamDeathmatch::setConfigValues()
     49    {
     50        SetConfigValue(maxScore_, 10);
    4351    }
    4452
     
    5765        std::string message("The match has ended.");
    5866        ChatManager::message(message);
     67       
     68        //find team that won the match
     69        int winnerTeam = 0;
     70        int highestScore = 0;
     71        for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
     72        {
     73            if ( this->getTeamScore(it->first) > highestScore )
     74            {
     75                winnerTeam = this->getTeam(it->first);
     76                highestScore = this->getTeamScore(it->first);
     77            }
     78        }
     79
     80        //announce win
     81        this->announceTeamWin(winnerTeam);
    5982    }
    6083
     
    100123            {
    101124                if (killer->getPlayer())
     125                {
    102126                    message = victim->getPlayer()->getName() + " was killed by " + killer->getPlayer()->getName();
     127                    if(this->isExactlyA(Class(TeamDeathmatch)) && (this->getTeamScore(killer->getPlayer()) >= (this->maxScore_ -1)) )
     128                        this->end();
     129                }
    103130                else
    104131                    message = victim->getPlayer()->getName() + " was killed";
  • code/trunk/src/orxonox/gametypes/TeamDeathmatch.h

    r9667 r9941  
    4141            virtual ~TeamDeathmatch() {}
    4242
     43            void setConfigValues();
    4344            virtual void start();
    4445            virtual void end();
     
    4950            virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);
    5051            virtual void playerScored(PlayerInfo* player, int score = 1);
     52       protected:
     53            int maxScore_;
    5154    };
    5255}
  • code/trunk/src/orxonox/gametypes/TeamGametype.cc

    r9667 r9941  
    173173    }
    174174
     175    int TeamGametype::getTeamScore(PlayerInfo* player)
     176    {
     177        int teamscore = 0;
     178        if(!player || this->getTeam(player) == -1)
     179            return 0;
     180        for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
     181        {
     182            if ( this->getTeam(it->first) ==  this->getTeam(player) )
     183            {
     184                teamscore += it->second.frags_;
     185            }
     186        }
     187        return teamscore;
     188    }
     189
     190    int TeamGametype::getTeamSize(int team)
     191    {
     192        int teamSize = 0;
     193        for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
     194        {
     195            if (it->second == team)
     196                teamSize++;
     197        }
     198        return teamSize;
     199    }
     200
     201    int TeamGametype::getHumansInTeam(int team)
     202    {
     203        int teamSize = 0;
     204        for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
     205        {
     206            if (it->second == team  && it->first->isHumanPlayer())
     207                teamSize++;
     208        }
     209        return teamSize;
     210    }
     211
     212
    175213    SpawnPoint* TeamGametype::getBestSpawnPoint(PlayerInfo* player) const
    176214    {
     
    336374    }
    337375
     376    void TeamGametype::announceTeamWin(int winnerTeam)
     377    {
     378        for (std::map<PlayerInfo*, int>::iterator it3 = this->teamnumbers_.begin(); it3 != this->teamnumbers_.end(); ++it3)
     379        {
     380            if (it3->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     381                continue;
     382            if (it3->second == winnerTeam)
     383            {
     384                this->gtinfo_->sendAnnounceMessage("Your team has won the match!", it3->first->getClientID());
     385            }
     386            else
     387            {
     388                this->gtinfo_->sendAnnounceMessage("Your team has lost the match!", it3->first->getClientID());
     389            }
     390        }   
     391    }
     392
    338393}
  • code/trunk/src/orxonox/gametypes/TeamGametype.h

    r9667 r9941  
    6262            inline const ColourValue& getTeamColour(int teamnr) const
    6363                { return this->teamcolours_[teamnr]; }
     64            int getTeamScore(PlayerInfo* player);
     65            int getTeamSize(int team);
     66            int getHumansInTeam(int team);
    6467
    6568        protected:
     
    7780            void setDefaultObjectColour(Pawn* pawn);
    7881            void colourPawn(Pawn* pawn, int teamNr);
     82            void announceTeamWin(int winnerTeam);
     83
    7984    };
    8085}
  • code/trunk/src/orxonox/gametypes/UnderAttack.cc

    r9667 r9941  
    3838namespace orxonox
    3939{
     40    const int attacker_ = 0; // teamnumber of the attacking team
     41    const int defender_ = 1; // defender's teamnumber
     42
    4043    RegisterUnloadableClass(UnderAttack);
    4144
     
    7679                continue;
    7780
    78             if (it->second == 0)
     81            if (it->second == attacker_)
    7982                this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID());
    8083            else
     
    188191        }
    189192    }
     193
     194    void UnderAttack::playerEntered(PlayerInfo* player)
     195    {
     196        if (!player)
     197            return;
     198        TeamDeathmatch::playerEntered(player);
     199        this->setTransporterHealth();
     200    }
     201
     202    void UnderAttack::setTransporterHealth()
     203    {
     204        if (this->destroyer_ != 0)
     205        {
     206            //Calculation: Each attacker deals about 3500 damage. A human attacker deals 1500 damage additionally.
     207            //Each defender prevents 500 damage. If human 2000 damage will be additionally be prevented.
     208            //TODO: use gametime and the damage dealt so far in order to calculate the transporter's life more precisely
     209            float health = this->getTeamSize(attacker_)*2000.0f + this->getHumansInTeam(attacker_)*3000.0f - this->getTeamSize(defender_)*500.0f - this->getHumansInTeam(defender_)*2000.0f ;
     210            this->destroyer_->setHealth(std::max(health, 5000.0f)); //the destoyer should have at least 5000.0f life.
     211        }
     212    }
     213
     214
    190215}
  • code/trunk/src/orxonox/gametypes/UnderAttack.h

    r9667 r9941  
    5151            virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0);
    5252            virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0);
     53            virtual void playerEntered(PlayerInfo* player);
    5354
    5455        protected:
    5556            virtual void killedDestroyer();
     57            void setTransporterHealth();
    5658
    5759            WeakPtr<Destroyer> destroyer_;
Note: See TracChangeset for help on using the changeset viewer.