Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2438


Ignore:
Timestamp:
Dec 14, 2008, 3:53:05 AM (16 years ago)
Author:
landauf
Message:
  • If the player dies, the Spectator spawns at the same position the players camera was before.
  • Fixed some related problems and potential bugs
Location:
code/branches/objecthierarchy2/src/orxonox
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy2/src/orxonox/objects/Radar.cc

    r2361 r2438  
    134134            Vector3 targetPosition = localPosition;
    135135            if (*(this->itFocus_))
    136                 targetPosition = this->itFocus_->getWorldPosition();
     136                targetPosition = this->itFocus_->getRVWorldPosition();
    137137
    138138            // find the closed object further away than targetPosition
     
    147147                    continue;
    148148
    149                 float targetDistance = localPosition.squaredDistance((*it)->getWorldPosition());
     149                float targetDistance = localPosition.squaredDistance((*it)->getRVWorldPosition());
    150150                if (targetDistance > currentDistance && targetDistance < nextDistance)
    151151                {
     
    187187        for (ObjectList<RadarViewable>::iterator it = ObjectList<RadarViewable>::begin(); it; ++it, ++i)
    188188        {
    189             COUT(3) << i++ << ": " << (*it)->getWorldPosition() << std::endl;
     189            COUT(3) << i++ << ": " << (*it)->getRVWorldPosition() << std::endl;
    190190        }
    191191    }
  • code/branches/objecthierarchy2/src/orxonox/objects/RadarViewable.cc

    r2256 r2438  
    6161    }
    6262
    63     const Vector3& RadarViewable::getWorldPosition() const
     63    const Vector3& RadarViewable::getRVWorldPosition() const
    6464    {
    6565        const WorldEntity* object = this->getWorldEntity();
     
    6868    }
    6969
    70     Vector3 RadarViewable::getOrientedVelocity() const
     70    Vector3 RadarViewable::getRVOrientedVelocity() const
    7171    {
    7272        const WorldEntity* object = this->getWorldEntity();
  • code/branches/objecthierarchy2/src/orxonox/objects/RadarViewable.h

    r2256 r2438  
    7272        virtual const WorldEntity* getWorldEntity() const = 0;
    7373
    74         const Vector3& getWorldPosition() const;
    75         Vector3 getOrientedVelocity() const;
     74        const Vector3& getRVWorldPosition() const;
     75        Vector3 getRVOrientedVelocity() const;
    7676
    7777        inline void setRadarObjectShape(Shape shape)
  • code/branches/objecthierarchy2/src/orxonox/objects/gametypes/Gametype.cc

    r2428 r2438  
    3838#include "objects/worldentities/pawns/Spectator.h"
    3939#include "objects/worldentities/SpawnPoint.h"
     40#include "objects/worldentities/Camera.h"
    4041
    4142#include "network/Host.h"
     
    6263    {
    6364        SetConfigValue(initialStartCountdown_, 3.0f);
     65        SetConfigValue(bAutoStart_, false);
     66        SetConfigValue(bForceSpawn_, false);
    6467    }
    6568
     
    146149    void Gametype::pawnKilled(Pawn* victim, Pawn* killer)
    147150    {
     151        if (victim)
     152        {
     153            std::map<PlayerInfo*, PlayerState::Enum>::iterator it = this->players_.find(victim->getPlayer());
     154            it->second = PlayerState::Dead;
     155
     156            ControllableEntity* entity = this->defaultControllableEntity_.fabricate(victim->getCreator());
     157            if (victim->getCamera())
     158            {
     159                entity->setPosition(victim->getCamera()->getWorldPosition());
     160                entity->setOrientation(victim->getCamera()->getWorldOrientation());
     161            }
     162            else
     163            {
     164                entity->setPosition(victim->getWorldPosition());
     165                entity->setOrientation(victim->getWorldOrientation());
     166            }
     167            it->first->startControl(entity);
     168        }
    148169    }
    149170
  • code/branches/objecthierarchy2/src/orxonox/objects/infos/PlayerInfo.cc

    r2428 r2438  
    115115    }
    116116
    117     void PlayerInfo::startControl(ControllableEntity* entity)
     117    void PlayerInfo::startControl(ControllableEntity* entity, bool callback)
    118118    {
    119119        if (entity == this->controllableEntity_)
     
    121121
    122122        if (this->controllableEntity_)
    123             this->stopControl(this->controllableEntity_);
     123            this->stopControl(this->controllableEntity_, callback);
    124124
    125125        this->controllableEntity_ = entity;
  • code/branches/objecthierarchy2/src/orxonox/objects/infos/PlayerInfo.h

    r2428 r2438  
    6565                { return this->bReadyToSpawn_; }
    6666
    67             void startControl(ControllableEntity* entity);
     67            void startControl(ControllableEntity* entity, bool callback = true);
    6868            void stopControl(ControllableEntity* entity, bool callback = true);
    6969
  • code/branches/objecthierarchy2/src/orxonox/objects/worldentities/ControllableEntity.cc

    r2428 r2438  
    8181        if (this->isInitialized())
    8282        {
    83             if (this->bHasLocalController_)
     83            if (this->bHasLocalController_ && this->bHasHumanController_)
    8484                this->stopLocalHumanControl();
    8585
     
    250250    void ControllableEntity::stopLocalHumanControl()
    251251    {
    252         this->camera_->detachFromParent();
    253         delete this->camera_;
    254         this->camera_ = 0;
    255 
    256         delete this->hud_;
    257         this->hud_ = 0;
     252        if (this->camera_)
     253        {
     254            this->camera_->detachFromParent();
     255            delete this->camera_;
     256            this->camera_ = 0;
     257        }
     258
     259        if (this->hud_)
     260        {
     261            delete this->hud_;
     262            this->hud_ = 0;
     263        }
    258264    }
    259265
  • code/branches/objecthierarchy2/src/orxonox/objects/worldentities/pawns/Pawn.cc

    r2422 r2438  
    160160        this->bAlive_ = false;
    161161
     162        this->setDestroyWhenPlayerLeft(false);
     163
    162164        if (this->getGametype())
    163165            this->getGametype()->pawnKilled(this, this->lastHitOriginator_);
    164 
    165         this->setDestroyWhenPlayerLeft(false);
    166166
    167167        if (this->getPlayer())
  • code/branches/objecthierarchy2/src/orxonox/overlays/hud/HUDNavigation.cc

    r2361 r2438  
    151151*/
    152152        // transform to screen coordinates
    153         Vector3 pos = /*transformationMatrix * */Radar::getInstance().getFocus()->getWorldPosition();
     153        Vector3 pos = /*transformationMatrix * */Radar::getInstance().getFocus()->getRVWorldPosition();
    154154
    155155        bool outOfView;
     
    225225/*
    226226            Vector3 aimpos = transformationMatrix * getPredictedPosition(SpaceShip::getLocalShip()->getPosition(),
    227                     Projectile::getSpeed(), Radar::getInstance().getFocus()->getWorldPosition(), Radar::getInstance().getFocus()->getOrientedVelocity());
     227                    Projectile::getSpeed(), Radar::getInstance().getFocus()->getRVWorldPosition(), Radar::getInstance().getFocus()->getRVOrientedVelocity());
    228228*/
    229229            if (wasOutOfView_)
     
    252252/*
    253253        if (Radar::getInstance().getFocus())
    254             return (Radar::getInstance().getFocus()->getWorldPosition() - SpaceShip::getLocalShip()->getPosition()).length();
     254            return (Radar::getInstance().getFocus()->getRVWorldPosition() - SpaceShip::getLocalShip()->getPosition()).length();
    255255        else
    256256*/
Note: See TracChangeset for help on using the changeset viewer.