Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 12, 2014, 3:58:59 PM (10 years ago)
Author:
sriedel
Message:

Working atm. including function after function.

Location:
code/branches/surfaceraceHS14/src/modules/dodgerace2
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • code/branches/surfaceraceHS14/src/modules/dodgerace2/CMakeLists.txt

    r10117 r10118  
    22DodgeRace.cc
    33DodgeRaceCenterPoint.cc
     4DodgeRaceShip.cc
    45DodgeRaceHUDinfo.cc
    5 DodgeRaceShip.cc
    66)
    77
  • code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRace.cc

    r10117 r10118  
    3333
    3434#include "DodgeRace.h"
    35 
    36 #include "core/CoreIncludes.h"
    37 #include "core/EventIncludes.h"
    38 #include "core/command/Executor.h"
    39 #include "core/config/ConfigValueIncludes.h"
    40 
    41 #include "gamestates/GSLevel.h"
    42 #include "chat/ChatManager.h"
    43 
    44 // ! HACK
    45 #include "infos/PlayerInfo.h"
    46 
    47 /*#include "DodgeRaceCenterPoint.h"
    48 #include "DodgeRaceShip.h"
    49 #include "DodgeRaceEnemy.h"
    50 #include "DodgeRaceEnemyShooter.h"
    51 */
    52 #include "core/command/ConsoleCommand.h"
    53 #include "worldentities/BigExplosion.h"
     35#include "DodgeRaceShip.h" // Necessary for getPlayer function. Do NOT include this in Header!
    5436
    5537namespace orxonox
    5638{
    57     RegisterClass(DodgeRace);
     39    RegisterUnloadableClass(DodgeRace);
    5840
    5941    DodgeRace::DodgeRace(Context* context) : Deathmatch(context)
    6042    {
    6143        RegisterObject(DodgeRace);
     44        init();
    6245        this->numberOfBots_ = 0; //sets number of default bots temporarly to 0
    63         this->center_ = NULL;
    64         init();
    65         this->setHUDTemplate("DodgeRaceHUD"); // !!!!!!!!!!!!!!!        change later
     46        this->center_ = 0;
     47        /*
     48        this->setHUDTemplate("DodgeRaceHUD"); // !!!!!!!!!!!!!!!        change later*/
    6649    }
    6750
     
    7558        multiplier = 1;
    7659        b_combo = false;
     60
    7761        // spawn enemy every 3.5 seconds
    7862        //enemySpawnTimer.setTimer(3.5f, true, createExecutor(createFunctor(&DodgeRace::spawnEnemy, this)));
    79         //comboTimer.setTimer(3.0f, true, createExecutor(createFunctor(&DodgeRace::comboControll, this)));
     63        comboTimer.setTimer(3.0f, true, createExecutor(createFunctor(&DodgeRace::comboControll, this)));
    8064    }
    8165
     
    8367    {
    8468        level++;
    85         if (getPlayer() != NULL)
     69       /* if (getPlayer() != NULL)
    8670        {
    8771            for (int i = 0; i < 7; i++)
     
    9276                chunk->setScale(20);
    9377            }
    94         }
     78        }*/
    9579        addPoints(multiplier * 42);
    9680        multiplier *= 2;
     
    11094        return player;
    11195    }
    112 
    113     /*void DodgeRace::spawnEnemy()
     96/*
     97    void DodgeRace::spawnEnemy()
    11498    {
    11599        if (getPlayer() == NULL)
     
    134118            newPawn->setPosition(player->getPosition() + Vector3(500.f + 100 * i, 0, float(rand())/RAND_MAX * 400 - 200));
    135119        }
    136     }*/
     120    }
    137121
    138122    void DodgeRace::costLife()
     
    144128         //   enemySpawnTimer.setTimer(30.0f, false, createExecutor(createFunctor(&DodgeRace::end, this)));
    145129    };
    146 
     130*/
    147131    void DodgeRace::comboControll()
    148132    {
     
    161145        this->bForceSpawn_ = true;
    162146
    163         if (this->center_ == NULL)  // abandon mission!
     147        /*if (this->center_ == NULL)  // abandon mission!
    164148        {
    165149            orxout(internal_error) << "DodgeRace: No Centerpoint specified." << endl;
    166150            GSLevel::startMainMenu();
    167151            return;
    168         }
     152        }*/
    169153        // Call start for the parent class.
    170154        Deathmatch::start();
     
    178162        }
    179163    }
    180 
     164/*
    181165    void DodgeRace::end()
    182166    {
     
    186170        // Instead startMainMenu, this won't crash.
    187171        GSLevel::startMainMenu();
    188     }
     172    }*/
    189173}
  • code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRace.h

    r10117 r10118  
    3838#include "dodgerace2/DodgeRacePrereqs.h"
    3939
    40 //#include "DodgeRaceCenterPoint.h"
     40#include "DodgeRaceCenterPoint.h" // Necessary for WeakPointer??
     41//#include "DodgeRaceShip.h" // DO NOT include in Header. Will cause forward declaration issues
     42
    4143//#include "DodgeRaceHUDinfo.h"
    42 //#include "DodgeRaceShip.h"
     44
     45
     46#include "core/CoreIncludes.h"
     47#include "core/EventIncludes.h"
     48#include "core/command/Executor.h"
     49#include "core/config/ConfigValueIncludes.h"
     50
     51#include "gamestates/GSLevel.h"
     52#include "chat/ChatManager.h"
     53
     54// ! HACK
     55#include "infos/PlayerInfo.h"
     56
     57#include "core/command/ConsoleCommand.h"
     58#include "worldentities/BigExplosion.h"
    4359
    4460#include "gametypes/Deathmatch.h"
     
    4864{
    4965
    50     class DodgeRace : public Deathmatch
     66    class _DodgeRaceExport DodgeRace : public Deathmatch
    5167    {
    52         public:
     68       public:
    5369            DodgeRace(Context* context);
    5470
     71            void init();
     72
    5573            virtual void start();
    56             virtual void end();
    57             virtual void addBots(unsigned int amount){} //<! overwrite function in order to bypass the addbots command
     74            //virtual void end();
    5875
    59             //void spawnEnemy();
    60 
    61             void setCenterpoint(DodgeRaceCenterPoint* center)
    62             { this->center_ = center; }
     76            void levelUp();
    6377
    6478            int getLives(){return this->lives;}
     
    6781            int getMultiplier(){return this->multiplier;}
    6882
    69             void costLife();
    70             void levelUp();
    71             void addPoints(int numPoints);
     83            void setCenterpoint(DodgeRaceCenterPoint* center)
     84                       { this->center_ = center; }
    7285
    7386            // checks if multiplier should be reset.
    7487            void comboControll();
    75             void init();
     88
     89            bool bEndGame;
     90            bool bShowLevel;
    7691            int lives;
    7792            int multiplier;
    78             bool bEndGame;
    79             bool bShowLevel;
    80         private:
     93
     94       private:
     95            WeakPtr<DodgeRaceShip> getPlayer();
     96            WeakPtr<DodgeRaceShip> player;
    8197            void toggleShowLevel(){bShowLevel = !bShowLevel;}
    82             WeakPtr<DodgeRaceShip> getPlayer();
     98            void addPoints(int numPoints);
     99
    83100            WeakPtr<DodgeRaceCenterPoint> center_;
    84             WeakPtr<DodgeRaceShip> player;
    85 
    86             Timer enemySpawnTimer;
    87             Timer comboTimer;
    88             Timer showLevelTimer;
    89             //Context* context;
    90101            int level;
    91102            int point;
    92103            bool b_combo;
     104
     105            Timer enemySpawnTimer;
     106                        Timer comboTimer;
     107                        Timer showLevelTimer;
     108
     109
     110         /* virtual void addBots(unsigned int amount){} //<! overwrite function in order to bypass the addbots command
     111
     112            //void spawnEnemy();
     113
     114
     115
     116
     117
     118            void costLife();
     119
     120
     121
     122
     123
     124
     125        private:
     126
     127
     128
     129
     130            //Context* context;
     131            */
    93132    };
    94133}
  • code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRaceCenterPoint.h

    r10117 r10118  
    4545namespace orxonox
    4646{
    47     class DodgeRaceCenterPoint : public StaticEntity
     47    class _DodgeRaceExport DodgeRaceCenterPoint : public StaticEntity
    4848    {
    4949        public:
  • code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRaceHUDinfo.cc

    r10117 r10118  
    3939    {
    4040        RegisterObject(DodgeRaceHUDinfo);
    41 
     41/*
    4242        this->DodgeRaceGame = 0;
    4343        this->bShowLives_ = false;
    4444        this->bShowLevel_ = false;
    4545        this->bShowPoints_ = false;
    46         this->bShowMultiplier_ = false;
     46        this->bShowMultiplier_ = false;*/
    4747    }
    48 
     48/*
    4949    void DodgeRaceHUDinfo::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    5050    {
     
    134134            this->DodgeRaceGame = 0;
    135135        }
    136     }
     136    }*/
    137137}
  • code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRaceHUDinfo.h

    r10117 r10118  
    3939namespace orxonox
    4040{
    41     class DodgeRaceHUDinfo : public OverlayText, public Tickable
     41    class _DodgeRaceExport DodgeRaceHUDinfo : public OverlayText, public Tickable
    4242    {
    43         public:
     43     public:
    4444            DodgeRaceHUDinfo(Context* context);
    45 
     45  /*
    4646            virtual void tick(float dt);
    4747            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     
    7474            bool bShowLevel_;
    7575            bool bShowPoints_;
    76             bool bShowMultiplier_;
     76            bool bShowMultiplier_;*/
    7777    };
    7878}
  • code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRacePrereqs.h

    r10117 r10118  
    7575    //class DodgeRaceWeapon;
    7676    //class DodgeRaceWeaponEnemy;
    77     class DodgeRaceHUDinfo;
     77    //class DodgeRaceHUDinfo;
    7878}
    7979
  • code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRaceShip.cc

    r10117 r10118  
    3434#include "DodgeRaceShip.h"
    3535
    36 #include "core/CoreIncludes.h"
    37 #include "core/XMLPort.h"
    38 //#include "DodgeRace.h"
    39 
    4036namespace orxonox
    4137{
     
    4945        isFireing = false;
    5046        damping = 10;
     47
     48        lastTimeFront = 0;
     49        lastTimeLeft = 0;
     50        lastTime = 0;
    5151    }
    5252
     
    106106        setPosition(pos);
    107107        setOrientation(Vector3::UNIT_Y, Degree(270));
    108 
     108/*
    109109        // Level up!
    110110        if (pos.x > 42000)
     
    113113            setPosition(Vector3(0, 0, pos.z)); // pos - Vector3(30000, 0, 0)
    114114        }
    115 
     115*/
    116116        SUPER(DodgeRaceShip, tick, dt);
    117117    }
     
    139139        isFireing = bBoost;
    140140    }
    141    /* inline bool DodgeRaceShip::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
     141    /*
     142    inline bool DodgeRaceShip::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    142143    {
    143144        // orxout() << "touch!!! " << endl; //<< otherObject << " at " << contactPoint;
     
    169170        return false;
    170171        // SUPER(DodgeRaceShip, collidesAgainst, otherObject, contactPoint);
    171     }*/
    172 
     172    }
     173*/
    173174    WeakPtr<DodgeRace> DodgeRaceShip::getGame()
    174175    {
     
    176177        {
    177178            for (ObjectList<DodgeRace>::iterator it = ObjectList<DodgeRace>::begin(); it != ObjectList<DodgeRace>::end(); ++it)
    178                 game = *it;
     179            {
     180                game = *it;
     181            }
    179182        }
    180183        return game;
    181184    }
    182 
     185/*
    183186    void DodgeRaceShip::death()
    184187    {
    185188        getGame()->costLife();
    186189        SpaceShip::death();
    187     }
     190    }*/
    188191}
  • code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRaceShip.h

    r10117 r10118  
    3838#include "dodgerace2/DodgeRacePrereqs.h"
    3939
     40#include "core/CoreIncludes.h"
     41#include "core/XMLPort.h"
    4042#include "worldentities/pawns/SpaceShip.h"
    4143#include "graphics/Camera.h"
    4244#include "weapons/projectiles/Projectile.h"
    43 //#include "DodgeRace.h"
     45
     46#include "DodgeRace.h" // Is necessary for getGame function
    4447//#include "DodgeRaceCenterPoint.h"
    4548
    4649namespace orxonox
    4750{
    48     class DodgeRaceShip : public SpaceShip
     51    class _DodgeRaceExport DodgeRaceShip : public SpaceShip
    4952    {
    5053        public:
     
    5457
    5558            // overwrite for 2d movement
    56             virtual void moveFrontBack(const Vector2& value);
    57             virtual void moveRightLeft(const Vector2& value);
     59                    virtual void moveFrontBack(const Vector2& value);
     60                    virtual void moveRightLeft(const Vector2& value);
    5861
    59             // Starts or stops fireing
    60             virtual void boost(bool bBoost);
     62                    // Starts or stops fireing
     63                    virtual void boost(bool bBoost);
    6164
    62             //no rotation!
    63             virtual void rotateYaw(const Vector2& value){};
    64             virtual void rotatePitch(const Vector2& value){};
    65             //return to main menu if game has ended.
    66             virtual void rotateRoll(const Vector2& value){if (getGame()) if (getGame()->bEndGame) getGame()->end();};
     65                    //no rotation!
     66                    virtual void rotateYaw(const Vector2& value){};
     67                    virtual void rotatePitch(const Vector2& value){};
    6768
    68             virtual void updateLevel();
     69                    //return to main menu if game has ended.
     70                    virtual void rotateRoll(const Vector2& value){if (getGame()) if (getGame()->bEndGame) getGame()->end();};
     71
     72                    virtual void updateLevel();
     73
     74            float speed, damping, posforeward;
     75            bool isFireing;
     76
     77        private:
     78            WeakPtr<DodgeRace> getGame();
     79            WeakPtr<DodgeRace> game;
     80            Camera* camera;
     81            float lastTimeFront, lastTimeLeft, lastTime;
     82            struct Velocity
     83            {
     84                           float x;
     85                           float y;
     86            } velocity, desiredVelocity;
     87
     88
     89
     90
     91/*
     92
    6993
    7094            //virtual inline bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
     
    7498
    7599        private:
    76             WeakPtr<DodgeRace> getGame();
    77             WeakPtr<DodgeRace> game;
    78             Camera* camera;
    79             bool isFireing;
    80             float speed, damping, posforeward;
    81             float lastTimeFront, lastTimeLeft, lastTime;
    82             struct Velocity
    83             {
    84                 float x;
    85                 float y;
    86             } velocity, desiredVelocity;
     100
     101
     102
     103
     104
     105
    87106
    88107           // WeakPtr<DodgeRaceEnemy> lastEnemy;
    89             WeakPtr<Projectile> lastShot;
     108            WeakPtr<Projectile> lastShot;*/
    90109
    91110    };
Note: See TracChangeset for help on using the changeset viewer.