[9399] | 1 | /* |
---|
[9412] | 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
| 3 | * > www.orxonox.net < |
---|
[9399] | 4 | * |
---|
[9412] | 5 | * |
---|
| 6 | * License notice: |
---|
| 7 | * |
---|
| 8 | * This program is free software; you can redistribute it and/or |
---|
| 9 | * modify it under the terms of the GNU General Public License |
---|
| 10 | * as published by the Free Software Foundation; either version 2 |
---|
| 11 | * of the License, or (at your option) any later version. |
---|
| 12 | * |
---|
| 13 | * This program is distributed in the hope that it will be useful, |
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | * GNU General Public License for more details. |
---|
| 17 | * |
---|
| 18 | * You should have received a copy of the GNU General Public License |
---|
| 19 | * along with this program; if not, write to the Free Software |
---|
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
| 21 | * |
---|
| 22 | * |
---|
[9399] | 23 | * Created on: Oct 8, 2012 |
---|
| 24 | * Author: purgham |
---|
| 25 | */ |
---|
| 26 | |
---|
| 27 | #ifndef SPACERACECONTROLLER_H_ |
---|
| 28 | #define SPACERACECONTROLLER_H_ |
---|
| 29 | |
---|
| 30 | #include "gametypes/GametypesPrereqs.h" |
---|
| 31 | #include "controllers/ArtificialController.h" |
---|
| 32 | #include "gametypes/Gametype.h" |
---|
[9412] | 33 | #include "gametypes/RaceCheckPoint.h" |
---|
[9517] | 34 | #include "util/Math.h" |
---|
[9399] | 35 | |
---|
| 36 | namespace orxonox |
---|
| 37 | { |
---|
[9487] | 38 | class _GametypesExport SpaceRaceController: public ArtificialController, |
---|
| 39 | public Tickable |
---|
[9399] | 40 | { |
---|
[9432] | 41 | private: |
---|
| 42 | std::vector<RaceCheckPoint*> staticRacePoints_; |
---|
[9487] | 43 | RaceCheckPoint* nextRaceCheckpoint_; // checkpoint that should be reached |
---|
[9441] | 44 | RaceCheckPoint* currentRaceCheckpoint_; // last checkPoint (already reached) |
---|
[9432] | 45 | std::vector<RaceCheckPoint*> checkpoints_; |
---|
[9459] | 46 | Vector3 lastPositionSpaceship; |
---|
| 47 | int virtualCheckPointIndex; |
---|
[9432] | 48 | |
---|
| 49 | int recCalculateDistance(RaceCheckPoint*, Vector3 currentPosition); |
---|
| 50 | int distanceSpaceshipToCheckPoint(RaceCheckPoint*); |
---|
| 51 | RaceCheckPoint* nextPointFind(RaceCheckPoint*); |
---|
| 52 | RaceCheckPoint* adjustNextPoint(); |
---|
[9507] | 53 | std::vector<RaceCheckPoint*> findStaticCheckpoints(std::vector< |
---|
| 54 | RaceCheckPoint*>); |
---|
[9412] | 55 | std::vector<RaceCheckPoint*> staticCheckpoints(); |
---|
[9507] | 56 | int rekSimulationCheckpointsReached(RaceCheckPoint*, std::map< |
---|
| 57 | RaceCheckPoint*, int>*); |
---|
[9459] | 58 | // same as SpaceRaceManager, but needed to add virtuell Checkpoints ( Checkpoints which don't exist but needed to avoid collisions with big Objects) |
---|
| 59 | RaceCheckPoint* findCheckpoint(int index) const; |
---|
[9507] | 60 | RaceCheckPoint |
---|
| 61 | * addVirtualCheckPoint(RaceCheckPoint*, int , Vector3); |
---|
| 62 | void placeVirtualCheckpoints(RaceCheckPoint*, RaceCheckPoint*); |
---|
[9487] | 63 | bool vergleicheQuader(Vector3, Vector3); |
---|
[9507] | 64 | bool directLinePossible(RaceCheckPoint*, RaceCheckPoint*, std::vector<StaticEntity*>); |
---|
| 65 | void computeVirtualCheckpoint(RaceCheckPoint*, RaceCheckPoint*, std::vector<StaticEntity*>); |
---|
[9432] | 66 | |
---|
[9399] | 67 | public: |
---|
[9487] | 68 | SpaceRaceController(BaseObject* creator); |
---|
| 69 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
---|
| 70 | virtual ~SpaceRaceController(); |
---|
| 71 | virtual void tick(float dt); |
---|
[9399] | 72 | }; |
---|
| 73 | |
---|
| 74 | } |
---|
| 75 | |
---|
| 76 | #endif /* SPACERACECONTROLLER_H_ */ |
---|