Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1855 for code/branches


Ignore:
Timestamp:
Sep 28, 2008, 7:10:08 PM (16 years ago)
Author:
rgrieder
Message:

TutorialShip should now do basic stuff.

Location:
code/branches/orxonox_tutorial
Files:
8 edited

Legend:

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

    r1755 r1855  
    9090    class SpaceShip;
    9191    class SpaceShipAI;
     92    class TutorialShip;
    9293    class WorldEntity;
    9394
  • code/branches/orxonox_tutorial/src/orxonox/OrxonoxStableHeaders.h

    r1846 r1855  
    3737#include "util/OrxonoxPlatform.h"
    3838
    39 #if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC && !defined(ORXONOX_DISABLE_PCH)
     39#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC && !defined(ORXONOX_DISABLE_PCH) && 0
    4040
    4141// including std headers here is useless since they're already precompiled
  • code/branches/orxonox_tutorial/src/orxonox/gamestates/GSLevel.cc

    r1826 r1855  
    136136        // call the loader
    137137        COUT(0) << "Loading level..." << std::endl;
    138         startLevel_ = new Level(Settings::getDataPath() + "levels/sample.oxw");
     138        startLevel_ = new Level(Settings::getDataPath() + "levels/tutorial.oxw");
    139139        Loader::open(startLevel_);
    140140    }
  • code/branches/orxonox_tutorial/src/orxonox/objects/SpaceShip.cc

    r1850 r1855  
    6464    SetConsoleCommand(SpaceShip, movePitch, true).accessLevel(AccessLevel::User).defaultValue(0, 1.0f).axisParamIndex(0).keybindMode(KeybindMode::OnHold);
    6565    SetConsoleCommand(SpaceShip, moveRoll, true).accessLevel(AccessLevel::User).defaultValue(0, 1.0f).axisParamIndex(0).keybindMode(KeybindMode::OnHold);
    66     SetConsoleCommand(SpaceShip, fire, true).accessLevel(AccessLevel::User).keybindMode(KeybindMode::OnHold);
     66    //SetConsoleCommand(SpaceShip, fire, true).accessLevel(AccessLevel::User).keybindMode(KeybindMode::OnHold);
    6767    SetConsoleCommandAliasMulti(SpaceShip, setMaxSpeedTest, "setMaxSpeed", 1, false).accessLevel(AccessLevel::Debug);
    6868    SetConsoleCommandAliasMulti(SpaceShip, setMaxSpeedTest, "setMaxBlubber", 2, false).accessLevel(AccessLevel::Debug);
     
    258258
    259259            // START CREATING ADDITIONAL EFFECTS
    260             /*this->backlight_ = new Backlight(this->maxSpeed_, 0.8);
    261             this->attachObject(this->backlight_);
    262             this->backlight_->setPosition(-2.35, 0, 0.2);
    263             this->backlight_->setColour(this->getProjectileColour());
    264 
    265             this->smoke_ = new ParticleSpawner();
    266             this->smoke_->setParticle("Orxonox/smoke5", LODParticle::normal, 0, 0, 3);
    267             this->attachObject(this->smoke_);
    268 
    269             this->fire_ = new ParticleSpawner();
    270             this->fire_->setParticle("Orxonox/fire3", LODParticle::normal, 0, 0, 1);
    271             this->attachObject(this->fire_);
    272             */
     260            if (this->hasSpecialEffects())
     261            {
     262                this->backlight_ = new Backlight(this->maxSpeed_, 0.8);
     263                this->attachObject(this->backlight_);
     264                this->backlight_->setPosition(-2.35, 0, 0.2);
     265                this->backlight_->setColour(this->getProjectileColour());
     266
     267                this->smoke_ = new ParticleSpawner();
     268                this->smoke_->setParticle("Orxonox/smoke5", LODParticle::normal, 0, 0, 3);
     269                this->attachObject(this->smoke_);
     270
     271                this->fire_ = new ParticleSpawner();
     272                this->fire_->setParticle("Orxonox/fire3", LODParticle::normal, 0, 0, 1);
     273                this->attachObject(this->fire_);
     274            }
    273275            // END CREATING ADDITIONAL EFFECTS
    274276
    275             if (this->isExactlyA(Class(SpaceShip)))
     277            if (!this->isExactlyA(Class(SpaceShipAI)))
    276278            {
    277279                // START of testing crosshair
     
    300302    {
    301303        SetConfigValue(bInvertYAxis_, false).description("Set this to true for joystick-like mouse behaviour (mouse up = ship down).");
    302         SetConfigValue(reloadTime_, 0.125).description("The reload time of the weapon in seconds");
     304        //SetConfigValue(reloadTime_, 0.125).description("The reload time of the weapon in seconds");
     305        reloadTime_ = 9999999.9f;
    303306        SetConfigValue(testvector_, Vector3()).description("asdfblah");
    304307    }
     
    376379        COUT(4) << "requesting focus for camera" << std::endl;
    377380        //CameraHandler::getInstance()->requestFocus(cam_);
    378         if(this->isExactlyA(Class(SpaceShip))){
     381        if(!this->isExactlyA(Class(SpaceShipAI))){
    379382          getFocus();
    380383          COUT(4) << "getting focus for obj id: " << objectID << std::endl;
     
    484487
    485488            projectile->setObjectMode(0x3);
    486             this->timeToReload_ = this->reloadTime_;
     489            this->timeToReload_ = this->getReloadTime();
    487490        }
    488491
  • code/branches/orxonox_tutorial/src/orxonox/objects/SpaceShip.h

    r1625 r1855  
    9898            void setMoveLateral(float value);
    9999            void doFire();
     100           
     101            virtual float getReloadTime() { return this->reloadTime_; }
     102            virtual bool hasSpecialEffects() { return false; }
    100103
    101104            inline const Vector3& getDir() const
  • code/branches/orxonox_tutorial/src/orxonox/objects/TutorialShip.cc

    r1852 r1855  
    4545namespace orxonox
    4646{
    47     SetConsoleCommand(TutorialShip, fire, true);
     47    SetConsoleCommand(TutorialShip, fire, true).keybindMode(KeybindMode::OnHold);
     48
     49    CreateFactory(TutorialShip);
    4850
    4951    TutorialShip::TutorialShip()
     
    5254
    5355        // reset variables
     56        this->hasSpecialEffects_ = false;
     57
     58        // set config values
     59        this->setConfigValues();
    5460    }
    5561
     
    6571    void TutorialShip::setConfigValues()
    6672    {
    67         //SetConfigValue(bInvertYAxis_, false).description("Set this to true for joystick-like mouse behaviour (mouse up = ship down).");
    68         //SetConfigValue(reloadTime_, 0.125).description("The reload time of the weapon in seconds");
    69         //SetConfigValue(testvector_, Vector3()).description("asdfblah");
     73        SetConfigValue(reloadTime_, 0.125).description("The reload time of the weapon in seconds");
    7074    }
    7175
    72     void TutorialShip::registerAllVariables()
    73     {
    74     }
     76    //void TutorialShip::registerAllVariables()
     77    //{
     78    //}
    7579   
    7680    /**
     
    8286    void TutorialShip::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    8387    {
     88        XMLPortParam(TutorialShip, "specialEffects", setSpecialEffects, hasSpecialEffects, xmlelement, mode);
     89
     90        // Calls SpaceShip::XMLPort
    8491        SUPER(TutorialShip, XMLPort, xmlelement, mode);
     92    }
    8593
    86         //XMLPortParam(SpaceShip, "camera", setCamera, getCamera, xmlelement, mode);
     94    bool TutorialShip::hasSpecialEffects()
     95    {
     96        return this->hasSpecialEffects_;
     97    }
     98
     99    void TutorialShip::setSpecialEffects(bool value)
     100    {
     101        this->hasSpecialEffects_ = value;
     102    }
     103
     104    /**
     105        @brief Returns the weapon reload time. Used virtually by the base class.
     106    */
     107    float TutorialShip::getReloadTime()
     108    {
     109        return this->reloadTime_;
    87110    }
    88111
     
    95118    void TutorialShip::fire()
    96119    {
     120        SpaceShip::getLocalShip()->doFire();
    97121    }
    98122}
  • code/branches/orxonox_tutorial/src/orxonox/objects/TutorialShip.h

    r1852 r1855  
    5050
    5151            bool create();
    52             void registerAllVariables();
     52            //void registerAllVariables();
    5353            void setConfigValues();
    5454            void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    5555            void tick(float dt);
     56            float getReloadTime();
     57
     58            // XML parameter loading
     59            bool hasSpecialEffects();
     60            void setSpecialEffects(bool value);
    5661
    5762            // Methods for console commands
     
    5964
    6065        private:
     66            float reloadTime_;
     67            bool hasSpecialEffects_;
    6168    };
    6269}
  • code/branches/orxonox_tutorial/visual_studio/vc8/orxonox.vcproj

    r1847 r1855  
    292292                                </File>
    293293                                <File
    294                                         RelativePath="..\..\src\orxonox\objects\SpaceShip_backend.cc"
    295                                         >
    296                                         <FileConfiguration
    297                                                 Name="Debug|Win32"
    298                                                 ExcludedFromBuild="true"
    299                                                 >
    300                                                 <Tool
    301                                                         Name="VCCLCompilerTool"
    302                                                 />
    303                                         </FileConfiguration>
    304                                         <FileConfiguration
    305                                                 Name="Release|Win32"
    306                                                 ExcludedFromBuild="true"
    307                                                 >
    308                                                 <Tool
    309                                                         Name="VCCLCompilerTool"
    310                                                 />
    311                                         </FileConfiguration>
    312                                 </File>
    313                                 <File
    314294                                        RelativePath="..\..\src\orxonox\objects\SpaceShipAI.cc"
    315295                                        >
Note: See TracChangeset for help on using the changeset viewer.