Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 30, 2005, 9:02:23 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/textEngine: merged trunk here.
merged with command:
svn merge ../trunk textEngine -r 3467:HEAD
no conflicts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/textEngine/src/track_manager.h

    r3433 r3681  
    1212#define _TRACK_MANAGER_H
    1313
    14 #include "stdincl.h"
     14#include "curve.h"
     15#include "base_object.h"
    1516
    1617class PNode;
     18template<class T> class tList;
    1719
    18 //! condition for choosing a certain Path. \todo implement a useful way.
    19 struct PathCondition
    20 {
    21  
    22 };
    23  
     20// Static Definitions
     21
     22//! The Default Curve-Type to set for the whole path (if not chosen otherwise).
     23#define TMAN_DEFAULT_CURVETYPE BEZIERCURVE
     24#define TMAN_DEFAULT_DURATION 10
     25#define TMAN_DEFAULT_WIDTH    10
    2426
    2527//! A Graph-Element, that holds the curve-structure of a Level.
     
    3537
    3638  TrackElement* findByID(unsigned int trackID);
     39  bool backLoopCheck(TrackElement* trackElem);
    3740
     41  TrackElement* getChild(int childNumber);
     42  void setName(const char* name);
     43  char* getName(void) const;
     44
     45  // atributes
    3846  bool isFresh;              //!< If no Points where added until now
    3947  bool isHotPoint;           //!< If the first node is a specialPoint;
     
    4250  bool isJoined;             //!< If the End of the Curve is joined.
    4351  bool mainJoin;             //!< If the End of the Curve is joined, and this is the one Curve the others join to.
    44   PathCondition cond;        //!< The Split Condition;
    4552  int ID;                    //!< The ID of this TrackElement
    4653  float startingTime;        //!< The time at which this Track begins.
     
    4855  float endTime;             //!< The time at which this Track ends.
    4956  float jumpTime;            //!< The Time this Track has to jump to its preceding Track (only >0 if Track isJoined==true)
    50   CurveType curveType;       //!< The CurveType this will have.
     57  float width;               //!< Th width of the Path. This tells the Player(s), how far he(they) can go to the left/right.
    5158  int nodeCount;             //!< The count of points this TrackElement has.
    52   char* name;                //!< A name for the Trac.
    5359  Curve* curve;              //!< The Curve of this TrackElement
    5460  int childCount;            //!< The number of Children This TrackElement has.
    55   TrackElement** children;   //!< A TrackElement can have a Tree of following TrackElements.
     61  tList<TrackElement>* children;   //!< A TrackElement can have a Tree of following TrackElements.
     62
     63
     64  // runtime
     65  TrackElement* history;     //!< a pointer to the last TrackElement we were on. This is if you want to walk the path backwards again.
     66
     67  void debug(void);
     68
     69  // CONDITION FUNCTIONS and STUFF
     70  void* subject;             //!< The Subject the Condition should act upon.
     71  int (TrackElement::*condFunc)(void*); //!< Pointer to the condition function
     72
     73  int lowest(void* nothing);
     74  int highest(void* nothing);
     75  int random(void* nothing);
     76
     77  int leftRight(void* node);
     78  int nearest(void* node);
     79  // todo  int enemyKilled(void* entity);
     80
     81 private:
     82  char* name;                //!< A name for the Trac.
     83 
    5684};
    5785
    58 
     86//! the Condition to choose between the different ways of the game.
     87enum CONDITION {LOWEST, HIGHEST, RANDOM, LEFTRIGHT, NEAREST, ENEMYKILLED};
    5988
    6089//! The TrackManager handles the flow of the Players through the game.
     
    98127  TrackManager(void);
    99128
    100   static TrackManager* singletonRef;  //!< There may only be one TrackManager existing.
     129  static TrackManager* singletonRef;  //!< There may only be one TrackManager.
     130
    101131  TrackElement* firstTrackElem;       //!< The first TrackElement that exists.
    102132  TrackElement* currentTrackElem;     //!< The TrackElement we are working on.
     133  CurveType curveType;                //!< The CurveType the entire TrackSystem will have.
    103134  float localTime;                    //!< The time that has been passed since the traveling the Track.
    104135  float maxTime;                      //!< The maximal time the track has.
    105136  int trackElemCount;                 //!< The count of TrackElements that exist.
    106   PNode* bindSlave;
     137  PNode* bindSlave;                   //!< The node that is slave to the TrackManager. This node will be moved while update the TrackManager, and must NOT move itself.
     138  PNode* trackNode;                   //!< The main TrackNode of this Track.
    107139 
    108140  void initChildren(unsigned int childCount);
     
    111143 
    112144 public:
    113   ~TrackManager(void);
     145  virtual ~TrackManager(void);
     146
    114147  static TrackManager* getInstance(void);
    115148
    116149  // Methods to change the Path (initialisation)
    117150  void workOn(unsigned int trackID);
    118   inline void setCurveType(CurveType curveType) { this->setCurveType (curveType, this->currentTrackElem);}
     151  /** \see setCurveType(CurveType curveType, TrackElement* trackElem); \param curveType the type of the Curve */
     152  inline void setCurveType(CurveType curveType) { this->setCurveType (curveType, this->currentTrackElem);};
    119153  void setCurveType(CurveType curveType, TrackElement* trackElem);
    120154  void setDuration(float time);
     
    125159  void fork(unsigned int count, ...);
    126160  void forkV(unsigned int count, int* trackIDs);
    127   void condition(unsigned int groupID, PathCondition cond); //!< \todo really do this!!
     161  void condition(CONDITION cond, void* subject);
     162  void condition(unsigned int groupID, CONDITION cond, void* subject);
    128163  void join(unsigned int count, ...);
    129164  void joinV(unsigned int count, int* trackIDs);
     
    131166
    132167  // Methods to calculate the position on the Path (runtime)
    133   Vector calcPos(void) const;
    134   Vector calcDir(void) const;
     168  inline Vector calcPos(void) const;
     169  inline Vector calcDir(void) const;
     170  float getWidth(void) const;
    135171  void tick(float dt);
    136172  void jumpTo(float time);
    137   void choosePath(int graphID);
     173  inline int choosePath(TrackElement* trackElem);
    138174
    139175  void setBindSlave(PNode* bindSlave);
     176  PNode* getTrackNode(void);
    140177
    141178  // DEBUG //
Note: See TracChangeset for help on using the changeset viewer.