Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3238 in orxonox.OLD for orxonox/branches/sound/src/world.h


Ignore:
Timestamp:
Dec 20, 2004, 2:42:54 AM (21 years ago)
Author:
bensch
Message:

orxonox/branches: updated branches: buerli, nico, sound. And moved bezierTrack to old.bezierTrack. Conflicts resolved in a usefull order.
Conflics mostly resolved in favor of trunk
merge.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/sound/src/world.h

    r2644 r3238  
    44*/
    55
    6 #ifndef WORLD_H
    7 #define WORLD_H
     6#ifndef _WORLD_H
     7#define _WORLD_H
    88
    99#include "stdincl.h"
     
    2222  World (char* name);
    2323  World (int worldID);
    24   ~World ();
     24  virtual ~World ();
    2525
    2626  template<typename T>
    27     T* spawn(Location* loc, WorldEntity* owner);        // template to be able to spawn any derivation of WorldEntity
     27    T* spawn (Location* loc, WorldEntity* owner);       // template to be able to spawn any derivation of WorldEntity
    2828  template<typename T>
    29     T* spawn(Placement* plc, WorldEntity* owner);
     29    T* spawn (Placement* plc, WorldEntity* owner);
    3030 
    31   virtual Error init();
    32   virtual Error start();
    33   virtual Error stop();
    34   virtual Error pause();
    35   virtual Error resume();
     31  virtual ErrorMessage init ();
     32  virtual ErrorMessage start ();
     33  virtual ErrorMessage stop ();
     34  virtual ErrorMessage pause ();
     35  virtual ErrorMessage resume ();
    3636
    37   virtual void load();
     37  virtual void load ();
     38  virtual void destroy ();
    3839
    39   void time_slice (Uint32 deltaT);
     40  void timeSlice (Uint32 deltaT);
    4041  void collide ();
    4142  void draw ();
    4243  void update ();       // maps Locations to Placements
    43   void calc_camera_pos (Location* loc, Placement* plc);
     44  void calcCameraPos (Location* loc, Placement* plc);
    4445       
    4546  void unload ();
     47  bool command (Command* cmd);
    4648 
    47   void setTrackLen(Uint32 tracklen);
    48   int getTrackLen();
    49   bool system_command (Command* cmd);
    50   Camera* getCamera();
    51   //private:
     49  void setTrackLen (Uint32 tracklen);
     50  int getTrackLen ();
     51  //bool system_command (Command* cmd);
     52  Camera* getCamera ();
    5253
    53   void spawn(WorldEntity* entity);
     54  void spawn (WorldEntity* entity);
     55  void spawn (WorldEntity* entity, Location* loc);
     56  void spawn (WorldEntity* entity, Placement* plc);
    5457
    55   List<WorldEntity>* entities;
     58  tList<WorldEntity>* entities;
    5659 
    5760  // base level data
     
    6972  char* worldName;
    7073  int debugWorldNr;
     74  GLuint objectList;
    7175
    7276  WorldEntity* localPlayer;
    7377 
    74   void mainLoop();
    75   void synchronize();
    76   void handle_input();
    77   void time_slice();
    78   void collision();
    79   void display();
    80   void debug();
     78  void mainLoop ();
     79  void synchronize ();
     80  void handleInput ();
     81  void timeSlice ();
     82  void collision ();
     83  void display ();
     84  void debug ();
    8185};
    8286
    83 /**
    84     \brief spawn a new WorldEntity at a Location
    85     \param loc: the Location where the Entity should be spawned
    86     \param owner: a pointer to the parent of the Entity
    87     \return a pointer to the new WorldEntity or NULL if there was an error
    88    
    89     You can use this function to spawn any derivation of WorldEntity you want, just specify the desired
    90     class within the template specification brackets. Do not attempt to spawn any classes that have NOT been
    91     derived from WorldEntity, you won't even be able to compile the code. Note that this version of spawn()
    92     works with both free and bound WorldEntities.
    93 */
    94 template<typename T> T* World::spawn(Location* loc = NULL, WorldEntity* owner = NULL)
    95 {
    96   Location zeroloc;
    97   T* entity = new T();
    98   entities->add ((WorldEntity*)entity, LIST_ADD_NEXT);
    99   if( loc == NULL)
    100     {
    101       zeroloc.dist = 0;
    102       zeroloc.part = 0;
    103       zeroloc.pos = Vector();
    104       zeroloc.rot = Quaternion();
    105       loc = &zeroloc;
    106     }
    107   entity->init (loc, owner);
    108   if (entity->bFree)
    109     {
    110       track[loc->part].map_coords( loc, entity->get_placement());
    111     }
    112   entity->post_spawn ();
    113   return entity;
    114 }
    115 
    116 /**
    117     \brief spawn a new WorldEntity at a Placement
    118     \param lplc: the placement where the Entity should be spawned
    119     \param owner: a pointer to the parent of the Entity
    120     \return a pointer to the new WorldEntity or NULL if there was an error
    121    
    122     You can use this function to spawn any FREE derivation of WorldEntity you want, just specify the desired
    123     class within the template specification brackets. Do not attempt to spawn any classes that have NOT been
    124     derived from WorldEntity, you won't even be able to compile the code. Note that this version of spawn()
    125     works with free WorldEntities only, you will provoke an error message if you try to spawn a bound Entity with
    126     a Placement.
    127 */
    128 template<typename T> T* World::spawn(Placement* plc, WorldEntity* owner = NULL)
    129 {
    130   T* entity = new T();
    131   entities->add ((WorldEntity*)entity, LIST_ADD_NEXT);
    132   entity->init (plc, owner);
    133   if (!entity->bFree)
    134     {
    135       printf("Can't spawn unfree entity with placement\n");
    136       entities->remove( (WorldEntity*)entity, LIST_FIND_FW);
    137       return NULL;
    138     }
    139   entity->post_spawn ();
    140   return entity;
    141 }
    142 
    143 #endif
     87#endif /* _WORLD_H */
Note: See TracChangeset for help on using the changeset viewer.