Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9907 for code


Ignore:
Timestamp:
Dec 16, 2013, 2:22:45 PM (11 years ago)
Author:
smerkli
Message:

Merged spacestationentry branch

Location:
code/branches/presentationHS13
Files:
9 edited
4 copied

Legend:

Unmodified
Added
Removed
  • code/branches/presentationHS13

  • code/branches/presentationHS13/data/levels/FPSTest.oxw

    r9348 r9907  
     1<!-- -->
    12<LevelInfo
    23 name = "FPS testlevel"
  • code/branches/presentationHS13/data/levels/docking.oxw

    r9348 r9907  
     1<!-- -->
    12<LevelInfo
    23 name = "Transporter"
  • code/branches/presentationHS13/src/modules/docking/Dock.cc

    r9667 r9907  
    6969        XMLPortObject(Dock, DockingAnimation, "animations", addAnimation, getAnimation, xmlelement, mode);
    7070        XMLPortEventSink(Dock, BaseObject, "execute", execute, xmlelement, mode);
     71        XMLPortEventSink(Dock, BaseObject, "undocking", undocking, xmlelement, mode);
     72
    7173    }
    7274
     
    7678
    7779        XMLPortEventSink(Dock, BaseObject, "execute", execute, xmlelement, mode);
    78     }
     80
     81        XMLPortEventSink(Dock, BaseObject, "undocking", undocking, xmlelement, mode);
     82    }
     83
     84
     85    bool Dock::undocking(bool bTriggered, BaseObject* trigger)
     86    {
     87
     88        PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger);
     89        PlayerInfo* player = NULL;
     90
     91        // Check whether it is a player trigger and extract pawn from it
     92        if(pTrigger != NULL)
     93        {
     94              if(!pTrigger->isForPlayer()) {  // The PlayerTrigger is not exclusively for Pawns which means we cannot extract one.
     95              orxout(verbose, context::docking) << "Docking:execute PlayerTrigger was not triggered by a player.." << endl;
     96              return false;
     97              }
     98              player = pTrigger->getTriggeringPlayer();
     99        }
     100        else
     101        {
     102              orxout(verbose, context::docking) << "Docking::execute Not a player trigger, can't extract pawn from it.." << endl;
     103              return false;
     104        }
     105        if(player == NULL)
     106        {
     107              orxout(verbose, context::docking) << "Docking::execute Can't retrieve PlayerInfo from Trigger. (" << trigger->getIdentifier()->getName() << ")" << endl;
     108              return false;
     109        }
     110
     111            if(bTriggered)
     112        {
     113              // Add player to this Docks candidates
     114              candidates_.insert(player);
     115
     116              // Show docking dialog
     117              this->showUndockingDialogHelper(player);
     118        }
     119        else
     120        {
     121              // Remove player from candidates list
     122              candidates_.erase(player);
     123        }
     124
     125        return true;
     126    }
     127
     128
    79129
    80130    bool Dock::execute(bool bTriggered, BaseObject* trigger)
     
    119169        return true;
    120170    }
     171
     172
     173    void Dock::showUndockingDialogHelper(PlayerInfo* player)
     174        {
     175            assert(player);
     176
     177            if(!player->isHumanPlayer())
     178                return;
     179
     180            if(GameMode::isMaster())
     181            {
     182                if(GameMode::showsGraphics())
     183                    GUIManager::showGUI("UndockingDialog");
     184            }
     185            else
     186                callStaticNetworkFunction(Dock::showDockingDialog, player->getClientID());
     187
     188        }
    121189
    122190    void Dock::showDockingDialogHelper(PlayerInfo* player)
     
    177245        if (animations_.empty())
    178246            return dockingAnimationFinished(player);
     247
    179248        else
    180249            DockingAnimation::invokeAnimation(true, player, animations_);
  • code/branches/presentationHS13/src/modules/docking/Dock.h

    r9667 r9907  
    6262            // Trigger interface
    6363            bool execute(bool bTriggered, BaseObject* trigger);
     64            bool undocking(bool bTriggered, BaseObject* trigger);
    6465
    6566            // XML interface
     
    8586            void dock()
    8687                { this->dock(HumanController::getLocalControllerSingleton()->getPlayer()); }
     88            void undock()
     89                { this->undock(HumanController::getLocalControllerSingleton()->getPlayer()); }
    8790            static unsigned int getNumberOfActiveDocks();
    8891            static Dock* getActiveDockAtIndex(unsigned int index);
     
    9598            // Network functions
    9699            void showDockingDialogHelper(PlayerInfo* player);
     100            void showUndockingDialogHelper(PlayerInfo* player);
    97101            static void showDockingDialog();
    98102
  • code/branches/presentationHS13/src/modules/docking/MoveToDockingTarget.cc

    r9667 r9907  
    6666    {
    6767        //TODO: Investigate strange things...
    68         this->parent_->detach((WorldEntity*)player->getControllableEntity());
     68        //this->parent_->detach((WorldEntity*)player->getControllableEntity());
    6969
     70        //TODO: Check the issue with this detach call.
     71        //I have removed the line because the detach call only caused a warning and terminated. And because I didn't find a attach call either.
     72        //Didn't find the need for the line.
    7073        this->parent_->undockingAnimationFinished(player);
    7174        return true;
  • code/branches/presentationHS13/src/modules/objects/ForceField.cc

    r9667 r9907  
    4545    /*static*/ const std::string ForceField::modeSphere_s = "sphere";
    4646    /*static*/ const std::string ForceField::modeInvertedSphere_s = "invertedSphere";
     47
     48    /*static*/ const std::string ForceField::modeHomogen_s = "homogen";
     49
    4750    /*static*/ const std::string ForceField::modeNewtonianGravity_s = "newtonianGravity";
    4851    /*static*/ const float ForceField::gravConstant_ = 6.673e-11;
    4952    /*static*/ const float ForceField::attenFactor_ = 1;
     53
    5054
    5155    /**
     
    8993        XMLPortParam(ForceField, "length", setLength  , getLength  , xmlelement, mode).defaultValues(2000);
    9094        XMLPortParam(ForceField, "mode", setMode, getMode, xmlelement, mode);
     95        XMLPortParam(ForceField, "forcedirection", setForceDirection, getForceDirection, xmlelement, mode).defaultValues(Vector3(0,-400,0));
    9196    }
    9297   
     
    196201            }
    197202        }
     203        else if(this->mode_ == forceFieldMode::homogen)
     204        {
     205                // Iterate over all objects that could possibly be affected by the ForceField.
     206                for (ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)
     207                {
     208                        Vector3 distanceVector = it->getWorldPosition() - this->getWorldPosition();
     209                    float distance = distanceVector.length();
     210                    if (distance < this->radius_ && distance > this->massRadius_)
     211                    {
     212                        // Add a Acceleration in forceDirection_.
     213                        // Vector3(0,0,0) is the direction, where the force should work.
     214                        it->addAcceleration(forceDirection_ , Vector3(0,0,0));
     215                    }
     216                }
     217        }
    198218    }
    199219
     
    214234        else if(mode == ForceField::modeNewtonianGravity_s)
    215235            this->mode_ = forceFieldMode::newtonianGravity;
     236
     237        else if(mode == ForceField::modeHomogen_s)
     238            this->mode_ = forceFieldMode::homogen;
     239
    216240        else
    217241        {
     
    239263            case forceFieldMode::newtonianGravity:
    240264                return ForceField::modeNewtonianGravity_s;
     265
     266            case forceFieldMode::homogen:
     267                return ForceField::modeHomogen_s;
     268
    241269            default:
    242270                return ForceField::modeTube_s;
  • code/branches/presentationHS13/src/modules/objects/ForceField.h

    r9667 r9907  
     1
    12/*
    23 *   ORXONOX - the hottest 3D action shooter ever to exist
     
    5758            sphere, //!< The ForceField has a spherical shape.
    5859            invertedSphere, //!< The ForceField has a spherical shape but "inverted" behavior.
    59             newtonianGravity //!< The ForceField imitates Newtonian gravitation for use in stellar bodies.
     60            newtonianGravity, //!< The ForceField imitates Newtonian gravitation for use in stellar bodies.
     61            homogen //!< Local homogenous Force field with changeable direction for the Space Station
    6062        };
    6163    }
     
    6668
    6769        The following parameters can be set to specify the behavior of the ForceField.
     70        - @b forcedirection The direction and the strength of the homogenous force field. Default is 0,-400,0.
    6871        - @b velocity The amount of force the ForceField excerts. Default is 100.
    6972        - @b diameter The diameter of the ForceField. Default is 500.
     
    147150                { return this->halfLength_*2; }
    148151
     152            inline void setForceDirection(Vector3 forcedir)
     153                { this->forceDirection_ = forcedir; }
     154
     155            inline Vector3 getForceDirection()
     156                { return this->forceDirection_; }
     157
     158
    149159            void setMode(const std::string& mode); //!< Set the mode of the ForceField.
    150160            const std::string& getMode(void); //!< Get the mode of the ForceField.
     
    156166            static const std::string modeInvertedSphere_s;
    157167            static const std::string modeNewtonianGravity_s;
     168
     169            static const std::string modeHomogen_s;
    158170
    159171            float velocity_; //!< The velocity of the ForceField.
     
    167179            //! Attenuation factor for Newtonian ForceFields
    168180            static const float attenFactor_;
     181            Vector3 forceDirection_;
    169182  };
    170183}
  • code/branches/presentationHS13/src/orxonox/infos/PlayerInfo.cc

    r9667 r9907  
    229229            return;
    230230
    231         this->controllableEntity_->getController()->setActive(false);
     231        Controller* tmp =this->controllableEntity_->getController();
     232        if (tmp == NULL)
     233        {
     234                orxout(verbose) <<  "PlayerInfo: pauseControl, Controller is NULL " << endl;
     235                return;
     236        }
     237        tmp->setActive(false);
    232238        //this->controllableEntity_->getController()->setControllableEntity(NULL);
    233239        this->controllableEntity_->setController(0);
Note: See TracChangeset for help on using the changeset viewer.