Changeset 3605 in orxonox.OLD for orxonox/branches/levelloader/src/track_manager.h
- Timestamp:
- Mar 18, 2005, 11:52:15 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/levelloader/src/track_manager.h
r3530 r3605 19 19 class TrackNamer; 20 20 21 // ! condition for choosing a certain Path. \todo implement a useful way.22 struct PathCondition 23 { 24 25 }; 26 21 // Static Definitions 22 23 //! The Default Curve-Type to set for the whole path (if not chosen otherwise). 24 #define TMAN_DEFAULT_CURVETYPE BEZIERCURVE 25 #define TMAN_DEFAULT_DURATION 10 26 #define TMAN_DEFAULT_WIDTH 10 27 27 28 28 //! A Graph-Element, that holds the curve-structure of a Level. … … 38 38 39 39 TrackElement* findByID(unsigned int trackID); 40 40 41 TrackElement* findByName(const char* trackName); 41 void setName( const char* trackName);42 42 43 bool backLoopCheck(TrackElement* trackElem); 44 45 TrackElement* getChild(int childNumber); 46 void setName(const char* name); 47 char* getName(void) const; 48 49 // atributes 43 50 bool isFresh; //!< If no Points where added until now 44 51 bool isHotPoint; //!< If the first node is a specialPoint; … … 47 54 bool isJoined; //!< If the End of the Curve is joined. 48 55 bool mainJoin; //!< If the End of the Curve is joined, and this is the one Curve the others join to. 49 PathCondition cond; //!< The Split Condition;50 56 int ID; //!< The ID of this TrackElement 51 57 float startingTime; //!< The time at which this Track begins. … … 53 59 float endTime; //!< The time at which this Track ends. 54 60 float jumpTime; //!< The Time this Track has to jump to its preceding Track (only >0 if Track isJoined==true) 55 CurveType curveType; //!< The CurveType this will have.61 float width; //!< Th width of the Path. This tells the Player(s), how far he(they) can go to the left/right. 56 62 int nodeCount; //!< The count of points this TrackElement has. 57 char* name; //!< A name for the Trac.58 63 Curve* curve; //!< The Curve of this TrackElement 59 64 int childCount; //!< The number of Children This TrackElement has. 60 TrackElement** children; //!< A TrackElement can have a Tree of following TrackElements. 65 tList<TrackElement>* children; //!< A TrackElement can have a Tree of following TrackElements. 66 67 68 // runtime 69 TrackElement* history; //!< a pointer to the last TrackElement we were on. This is if you want to walk the path backwards again. 70 71 void debug(void); 72 73 // CONDITION FUNCTIONS and STUFF 74 void* subject; //!< The Subject the Condition should act upon. 75 int (TrackElement::*condFunc)(void*); //!< Pointer to the condition function 76 77 int lowest(void* nothing); 78 int highest(void* nothing); 79 int random(void* nothing); 80 81 int leftRight(void* node); 82 int nearest(void* node); 83 // todo int enemyKilled(void* entity); 84 85 private: 86 char* name; //!< A name for the Trac. 87 61 88 }; 62 89 63 90 //! the Condition to choose between the different ways of the game. 91 enum CONDITION {LOWEST, HIGHEST, RANDOM, LEFTRIGHT, NEAREST, ENEMYKILLED}; 64 92 65 93 //! The TrackManager handles the flow of the Players through the game. … … 103 131 TrackManager(void); 104 132 105 static TrackManager* singletonRef; //!< There may only be one TrackManager existing. 133 static TrackManager* singletonRef; //!< There may only be one TrackManager. 134 106 135 TrackElement* firstTrackElem; //!< The first TrackElement that exists. 107 136 TrackElement* currentTrackElem; //!< The TrackElement we are working on. 137 CurveType curveType; //!< The CurveType the entire TrackSystem will have. 108 138 float localTime; //!< The time that has been passed since the traveling the Track. 109 139 float maxTime; //!< The maximal time the track has. 110 140 int trackElemCount; //!< The count of TrackElements that exist. 111 PNode* bindSlave; 141 PNode* bindSlave; //!< The node that is slave to the TrackManager. This node will be moved while update the TrackManager, and must NOT move itself. 142 PNode* trackNode; //!< The main TrackNode of this Track. 112 143 113 144 void initChildren(unsigned int childCount, SubString* names = NULL); … … 117 148 118 149 public: 119 ~TrackManager(void); 150 virtual ~TrackManager(void); 151 120 152 static TrackManager* getInstance(void); 121 153 122 154 // Methods to change the Path (initialisation) 123 155 void workOn(unsigned int trackID); 124 inline void setCurveType(CurveType curveType) { this->setCurveType (curveType, this->currentTrackElem);} 156 /** \see setCurveType(CurveType curveType, TrackElement* trackElem); \param curveType the type of the Curve */ 157 inline void setCurveType(CurveType curveType) { this->setCurveType (curveType, this->currentTrackElem);}; 125 158 void setCurveType(CurveType curveType, TrackElement* trackElem); 126 159 void setDuration(float time); … … 131 164 void fork(unsigned int count, ...); 132 165 void forkV(unsigned int count, int* trackIDs, SubString* names = NULL); 133 void condition(unsigned int groupID, PathCondition cond); //!< \todo really do this!! 166 void condition(CONDITION cond, void* subject); 167 void condition(unsigned int groupID, CONDITION cond, void* subject); 134 168 void join(unsigned int count, ...); 135 169 void joinV(unsigned int count, int* trackIDs); … … 143 177 144 178 // Methods to calculate the position on the Path (runtime) 145 Vector calcPos(void) const; 146 Vector calcDir(void) const; 179 inline Vector calcPos(void) const; 180 inline Vector calcDir(void) const; 181 float getWidth(void) const; 147 182 void tick(float dt); 148 183 void jumpTo(float time); 149 void choosePath(int graphID);184 inline int choosePath(TrackElement* trackElem); 150 185 151 186 void setBindSlave(PNode* bindSlave); 187 PNode* getTrackNode(void); 152 188 153 189 // DEBUG //
Note: See TracChangeset
for help on using the changeset viewer.