Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5955 in orxonox.OLD for branches/powerups/src


Ignore:
Timestamp:
Dec 7, 2005, 1:05:10 PM (19 years ago)
Author:
bensch
Message:

branches/powerups: merged the trunk to branches/powerup
merged with commandsvn merge ../trunk/ powerups/ -r5848:HEAD
conflicts resolved in favor of the trunk

Location:
branches/powerups/src
Files:
3 deleted
61 edited
22 copied

Legend:

Unmodified
Added
Removed
  • branches/powerups/src/Makefile.am

    r5766 r5955  
    2121                       lib/collision_detection/libORXcd.a \
    2222                       lib/graphics/spatial_separation/libORXquadtree.a \
    23                        lib/tinyxml/libtinyxml.a \
     23                       lib/parser/tinyxml/libtinyxml.a \
     24                       lib/parser/ini_parser/libIniParser.a \
    2425                       lib/gui/gl_gui/libORXglgui.a \
    2526                       lib/shell/libORXshell.a
     
    3637                lib/particles/libORXparticles.a \
    3738                lib/graphics/spatial_separation/libORXquadtree.a \
    38                 lib/tinyxml/libtinyxml.a \
     39                lib/parser/tinyxml/libtinyxml.a \
     40                lib/parser/ini_parser/libIniParser.a \
    3941                lib/gui/gl_gui/libORXglgui.a \
    4042                lib/shell/libORXshell.a \
     
    4749                  world_entities/world_entity.cc \
    4850                  world_entities/camera.cc \
     51                  world_entities/playable.cc \
    4952                  world_entities/player.cc \
    5053                  world_entities/npcs/npc.cc \
     
    7679                  world_entities/power_ups/turret_power_up.cc \
    7780                  world_entities/power_ups/laser_power_up.cc \
     81                  world_entities/space_ships/space_ship.cc \
    7882                  subprojects/benchmark.cc
    7983
     
    8791                 world_entities/world_entity.h \
    8892                 world_entities/camera.h \
     93                 world_entities/playable.h \
    8994                 world_entities/player.h \
    9095                 world_entities/npcs/npc.h \
  • branches/powerups/src/defs/class_id.h

    r5871 r5955  
    5757  // superclasses
    5858  CL_MASK_SUPER_CLASS           =    0xff000000,
    59   CL_BASE_OBJECT                =    0xff000000,
     59  CL_BASE_OBJECT                =    0x00000000,
    6060
    6161  CL_PARENT_NODE                =    0x01000000,
     
    6969  CL_ELEMENT_2D                 =    0x10000000,
    7070
    71   CL_SYNCHRONIZEABLE             =    0x20000000,
     71  CL_SYNCHRONIZEABLE            =    0x20000000,
    7272
    7373  CL_WORLD_ENTITY               =    0x40000000,
    7474
    75 
     75  // subsuper-classes derivations taken : 1, 2, 5, a, b, c.     << THIS IS A LIST OF ALL THE DCL_MASK_SUBSUPERCLASS_ID's taken
    7676
    7777  // subsuper-classes
    7878  CL_MASK_SUBSUPER_CLASS        =    0x00fff000,
    79   CL_MASK_SUBSUPER_CLASS_ID     =    0x00f00000,
    80   CL_MASK_SUBSUPER_CLASS_ID2    =    0x000ff000,
    81   CL_PLAYER                     =    0x00101000,
    82   CL_NPC                        =    0x00102000,
    83   CL_POWER_UP                   =    0x00104000,
    84   CL_FIELD                      =    0x00108000,
    85   CL_PROJECTILE                 =    0x00110000,
    86   CL_WEAPON                     =    0x00120000,
     79  CL_MASK_SUBSUPER_CLASS_IDA    =    0x00f00000,
     80  CL_MASK_SUBSUPER_CLASS_IDB    =    0x000ff000,
     81  // SUPER-PNodes
     82  CL_FIELD                      =    0x00101000,
     83  // SUPER-WorldEntities
     84  CL_PLAYABLE                   =    0x00201000,
     85  CL_PLAYER                     =    0x00202000,
     86  CL_NPC                        =    0x00204000,
     87  CL_PROJECTILE                 =    0x00208000,
     88  CL_WEAPON                     =    0x00210000,
     89  CL_POWER_UP                   =    0x00220000,
    8790  CL_EXTENDABLE                 =    0x00140000,
    88   // subsuper-classes derivations taken : 1, 5, a, b, c.     << THIS IS A LIST OF ALL THE DCL_MASK_SUBSUPERCLASS_ID's taken
     91  // SUPER-Modeling
     92  CL_TEXTURE                    =    0x00c01000,
     93  CL_MODEL                      =    0x00c02000,
     94
     95
     96  // subsuper-classes derivations taken : 1, 2, 5, a, b, c.     << THIS IS A LIST OF ALL THE DCL_MASK_SUBSUPERCLASS_ID's taken
    8997
    9098  // lowest level classes
     
    121129
    122130
     131
    123132  // StoryEntities (range from 0x00000100 to 0x000001ff)
    124133  CL_CAMPAIGN                   =    0x00000101,
     
    136145  CL_TERRAIN                    =    0x00000207,
    137146  CL_TEST_ENTITY                =    0x00000209,
     147  CL_SPACE_SHIP                 =    0x0000020a,
    138148
    139149  CL_TURRET_POWER_UP            =    0x00000211,
     
    178188
    179189  // graphical stuff (range from 0x00000800 to 0x000009ff)
    180   CL_TEXTURE                    =    0x00c01000,
     190  CL_FONT                       =    0x00c02802,
     191
     192
    181193  CL_TEXT                       =    0x00b01801,
    182   CL_FONT                       =    0x00c02802,
    183194  CL_MATERIAL                   =    0x00000804,
    184   CL_MODEL                      =    0x00000805, //!< @todo make this a SUBCLASS maybe
    185   CL_OBJMODEL                   =    0x00000806,
    186   CL_PROMITIVE_MODEL            =    0x00000807,
    187   CL_MD2Model                   =    0x00000808,
    188   CL_LIGHT                      =    0x00000809,
    189   CL_PARTICLE_EMITTER           =    0x0000080a,
    190   CL_PARTICLE_SYSTEM            =    0x0000080b,
     195  CL_TEXTURE_SEQUENCE           =    0x00c04805,
     196  CL_OBJMODEL                   =    0x00000807,
     197  CL_PROMITIVE_MODEL            =    0x00000808,
     198  CL_MD2Model                   =    0x00000809,
     199  CL_LIGHT                      =    0x0000080a,
     200  CL_PARTICLE_EMITTER           =    0x0000080b,
     201  CL_PARTICLE_SYSTEM            =    0x0000080c,
    191202  CL_ENVIRONMENT                =    0x00000810,
    192203  CL_SHADER                     =    0x00000811,
  • branches/powerups/src/defs/debug.h

    r5822 r5955  
    2727
    2828#include "confincl.h"
    29 #include "shell_buffer.h"
     29#ifndef NO_SHELL
     30 #include "shell_buffer.h"
     31#endif /* NO_SHELL */
    3032
    3133#include <stdio.h>
     
    7880  #define DEBUG_MODULE_SPATIAL_SEPARATION    2
    7981  #define DEBUG_MODULE_GUI                   2
     82  #define DEBUG_MODULE_SOUND                 2
    8083
    8184  // MISC
  • branches/powerups/src/lib/Makefile.am

    r5822 r5955  
    1515                            network/libORXnet.a \
    1616                            graphics/spatial_separation/libORXquadtree.a \
    17                             tinyxml/libtinyxml.a \
     17                            parser/tinyxml/libtinyxml.a \
     18                            parser/ini_parser/libIniParser.a \
    1819                            shell/libORXshell.a
    1920
     
    2930                            network/libORXnet.a \
    3031                            graphics/spatial_separation/libORXquadtree.a \
    31                             tinyxml/libtinyxml.a \
    3232                            shell/libORXshell.a \
    3333                            $(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS)
     
    3737                        lang/base_object.cc \
    3838                        lang/class_list.cc \
    39                         util/ini_parser.cc \
    4039                        util/substring.cc \
    4140                        util/color.cc \
     
    5352                        graphics/render2D/render_2d.h \
    5453                        lang/class_list.h \
    55                         util/ini_parser.h \
    5654                        util/substring.h \
    5755                        util/array.h \
     
    7573          collision_detection \
    7674          network \
    77           tinyxml \
     75          parser \
    7876          shell \
    7977          gui \
  • branches/powerups/src/lib/collision_detection/cd_engine.cc

    r5134 r5955  
    2424#include "world_entity.h"
    2525#include "terrain.h"
    26 #include "player.h"
     26// #include "player.h"
    2727
    2828#include "spatial_separation.h"
     
    119119    Quadtree* q = this->terrain->ssp->getQuadtree();
    120120
    121     QuadtreeNode* n = q->getQuadtreeFromPosition(this->player->getAbsCoor());
     121//    QuadtreeNode* n = q->getQuadtreeFromPosition(this->player->getAbsCoor());
    122122  }
    123123  //sTriangleExt* tri = q->getTriangleFromPosition(this->player->getAbsCoor());
  • branches/powerups/src/lib/collision_detection/cd_engine.h

    r5039 r5955  
    1717class OBBTree;
    1818class Terrain;
    19 class Player;
     19//class Player;
    2020
    2121
     
    5151  inline void setEntityList(tList<WorldEntity>* entityList) { this->entityList = entityList; }
    5252  inline void setTerrain(Terrain* terrain) { this->terrain = terrain; }
    53   inline void setPlayer(Player* player) { this->player = player; } /* only for debug purposes \todo: delete*/
     53  //  inline void setPlayer(Player* player) { this->player = player; } /* only for debug purposes \todo: delete*/
    5454
    5555  void drawBV(int depth, int drawMode) const;
     
    7979
    8080  Terrain*                terrain;                          //!< this it a ref to the terrain, serving as a ground for all WE
    81   Player*                 player;
     81//  Player*                 player;
    8282};
    8383
  • branches/powerups/src/lib/coord/p_node.cc

    r5819 r5955  
    428428
    429429  this->bias = bias;
     430  this->bRelDirChanged = true;
    430431}
    431432
     
    836837        glEnd();
    837838      }
     839
    838840      /* if we want to draw the children too */
    839841      if (depth == 0) /* -> all of them */
  • branches/powerups/src/lib/coord/p_node.h

    r5770 r5955  
    7676  inline const Vector& getRelCoor () const { return this->prevRelCoordinate; };
    7777  /** @returns the Relative Coordinate Destination */
    78   inline const Vector& getRelCoorSoft2D() const { return (this->toCoordinate)?*this->toCoordinate:this->relCoordinate; };
     78  inline const Vector& getRelCoorSoft2D() const { return (this->toCoordinate)? *this->toCoordinate : this->relCoordinate; };
    7979  void setAbsCoor (const Vector& absCoord);
    8080  void setAbsCoor (float x, float y, float z);
     
    9393  inline const Quaternion& getRelDir () const { return this->prevRelDirection; };
    9494  /** @returns the Relative Directional Destination */
    95   inline const Quaternion& getRelDirSoft2D() const { return (this->toDirection)?*this->toDirection:this->relDirection; };
     95  inline const Quaternion& getRelDirSoft2D() const { return (this->toDirection)? *this->toDirection : this->relDirection; };
    9696  /** @returns a Vector pointing into the relative Direction */
    9797  inline Vector getRelDirV() const { return this->prevRelDirection.apply(Vector(0,1,0)); };
     
    100100  void setAbsDirSoft(const Quaternion& absDirSoft, float bias = 1.0);
    101101  void setAbsDirSoft(float x, float y, float z, float bias = 1.0);
     102  void shiftDir (const Quaternion& shift);
    102103  /** @returns the absolute Direction */
    103104  inline const Quaternion& getAbsDir () const { return this->absDirection; };
    104105  /** @returns a Vector pointing into the absolute Direction */
    105106  inline Vector getAbsDirV() const { return this->absDirection.apply(Vector(0,1,0)); };
    106   void shiftDir (const Quaternion& shift);
     107  /** @returns A Vector pointing into the forward direction (X) of the Node */
     108  inline Vector getAbsDirX() const { return this->absDirection.apply(Vector(1,0,0)); };
     109  /** @returns A Vector pointing into the upward direction (Y) of the Node */
     110  inline Vector getAbsDirY() const { return this->absDirection.apply(Vector(0,1,0)); };
     111  /** @returns A Vector pointing into the right direction (Z) of the Node */
     112  inline Vector getAbsDirZ() const { return this->absDirection.apply(Vector(0,0,1)); };
    107113
    108114  /** @returns the Speed of the Node */
  • branches/powerups/src/lib/event/key_mapper.cc

    r5474 r5955  
    2121#include "key_mapper.h"
    2222
     23#include "event_def.h"
     24
    2325#include "globals.h"
    24 #include "ini_parser.h"
     26#include "parser/ini_parser/ini_parser.h"
    2527#include "key_names.h"
    2628#include "debug.h"
     29
    2730
    2831using namespace std;
     
    129132  int* index;
    130133
    131   iniParser->getFirstVar();
     134  iniParser->firstVar();
    132135  while(iniParser->getCurrentName())
    133136  {
     
    148151  }
    149152
    150   iniParser->getFirstVar();
     153  iniParser->firstVar();
    151154  while(iniParser->getCurrentName())
    152155  {
     
    191194      {
    192195        if( index[0] == 0)
    193         {
     196        {
    194197          *map[i].pValue = index[1];
    195198          PRINTF(4)("Mapping %s to '%s' (id %i)\n", name, SDLKToKeyname(index[1]), index[1]);
    196199          break;
    197         }
    198         else {
     200        }
     201        else {
    199202          *map[i].pValue = index[1];
    200203          PRINTF(4)("Mapping %s to '%s' (id %i)\n", name, SDLBToButtonname(index[1]), index[1]);
    201204          break;
    202         }
     205        }
    203206      }
    204207    }
  • branches/powerups/src/lib/event/key_mapper.h

    r5819 r5955  
    1010
    1111#include "base_object.h"
    12 #include "event_def.h"
     12//#include "event_def.h"
    1313
    1414class IniParser;
     
    6666
    6767 private:
    68   Sint32     coord[2];              //!< temp place to save variables in nameToIndex() function
     68  int         coord[2];              //!< temp place to save variables in nameToIndex() function
    6969};
    7070
  • branches/powerups/src/lib/graphics/graphics_engine.cc

    r5819 r5955  
    2626#include "debug.h"
    2727
    28 #include "ini_parser.h"
     28#include "parser/ini_parser/ini_parser.h"
    2929#include "substring.h"
    3030#include "text.h"
    3131
    3232#include "globals.h"
     33#include "texture.h"
    3334
    3435#ifdef __WIN32__
    3536 #include "class_list.h"
    36  #include "texture.h"
    3737 #include "list.h"
    3838 #include "model.h"
     
    131131  const char* textures = iniParser->getVar(CONFIG_NAME_TEXTURES, CONFIG_SECTION_VIDEO_ADVANCED, "0");
    132132  if (strchr(textures, '1') || !strcasecmp(textures, "true"))
    133     this->texturesEnabled = true;
     133    Texture::setTextureEnableState( true);
    134134  else
    135     this->texturesEnabled = false;
     135    Texture::setTextureEnableState(false);
    136136
    137137  // searching for a usefull resolution
     
    365365
    366366/**
    367  * if Textures should be enabled
    368 */
    369 bool GraphicsEngine::texturesEnabled = true;
    370 
    371 /**
    372367 *
    373368 * @param show if The mouse-cursor should be visible
  • branches/powerups/src/lib/graphics/graphics_engine.h

    r5366 r5955  
    8383
    8484  public:
    85     static bool             texturesEnabled;    //!< if textures should be enabled (globally)
    86 
    8785
    8886  private:
  • branches/powerups/src/lib/graphics/importer/Makefile.am

    r5463 r5955  
    99                           md2Model.cc \
    1010                           material.cc \
    11                            texture.cc
     11                           texture.cc \
     12                           texture_sequence.cc
    1213
    1314
     
    2021                 material.h \
    2122                 texture.h \
     23                 texture_sequence.h \
    2224                 anorms.h \
    2325                 anormtab.h
  • branches/powerups/src/lib/graphics/importer/material.h

    r5405 r5955  
    5151  static void addTexturePath(const char* pathName);
    5252
    53  private:
    54   int         illumModel;       //!< The IlluminationModel is either flat or smooth.
    55   float       diffuse [4];      //!< The diffuse color of the Material.
    56   float       ambient [4];      //!< The ambient color of the Material.
    57   float       specular [4];     //!< The specular color of the Material.
    58   float       shininess;        //!< The shininess of the Material.
    59   float       transparency;     //!< The transperency of the Material.
     53  private:
     54    int         illumModel;       //!< The IlluminationModel is either flat or smooth.
     55    float       diffuse [4];      //!< The diffuse color of the Material.
     56    float       ambient [4];      //!< The ambient color of the Material.
     57    float       specular [4];     //!< The specular color of the Material.
     58    float       shininess;        //!< The shininess of the Material.
     59    float       transparency;     //!< The transperency of the Material.
    6060  public:
    61   Texture*    diffuseTexture;   //!< The diffuse texture of the Material.
    62   Texture*    ambientTexture;   //!< The ambient texture of the Material.
    63   Texture*    specularTexture;  //!< The specular texture of the Material.
     61    Texture*    diffuseTexture;   //!< The diffuse texture of the Material.
     62    Texture*    ambientTexture;   //!< The ambient texture of the Material.
     63    Texture*    specularTexture;  //!< The specular texture of the Material.
    6464};
    6565#endif
  • branches/powerups/src/lib/graphics/importer/texture.cc

    r5790 r5955  
    1919
    2020#include "debug.h"
    21 #include "graphics_engine.h"
    22 
     21
     22// INCLUDING SDL_Image
    2323#ifdef HAVE_SDL_IMAGE_H
    2424#include <SDL_image.h>
     
    4545}
    4646
     47
    4748/**
    4849 *  Destructor of a Texture
     
    6566bool Texture::loadImage(const char* imageName)
    6667{
    67   if (GraphicsEngine::texturesEnabled)
     68  if (Texture::texturesEnabled)
    6869    {
    6970      if (this->image != NULL)
     
    8081        {
    8182          SDL_Surface* tmpSurf;
    82           if (this->texture)
     83          if (this->texture != 0 && glIsTexture(this->texture))
    8384            glDeleteTextures(1, &this->texture);
    8485          // load the new Image to memory
     
    8788          {
    8889            PRINTF(4)("loading Image %s\n", imageName);
    89             if (this->prepareSurface(tmpSurf))
    90               loadTexToGL();
     90            bool hasAlpha;
     91            SDL_Surface* newSurf = this->prepareSurface(tmpSurf, hasAlpha);
     92            if (newSurf != NULL)
     93            {
     94              this->setSurface(newSurf);
     95              this->setAlpha(hasAlpha);
     96              this->setTexture(Texture::loadTexToGL(newSurf));
     97            }
     98
    9199            SDL_FreeSurface(tmpSurf);
    92100            return true;
     
    108116}
    109117
     118
     119/**
     120 * rebuilds the texture.
     121 * reloads the Texture from Memory to OpenGL.
     122 */
    110123bool Texture::rebuild()
    111124{
    112125  if (this->texture != 0)
    113126    {
    114       glDeleteTextures(1,&this->texture);
    115       this->texture = 0;
     127      if (glIsTexture(this->texture))
     128        glDeleteTextures(1,&this->texture);
     129      this->setTexture(0);
    116130    }
    117131
     
    119133    {
    120134      PRINTF(3)("Reloading Texture of %s '%s'\n", this->getClassName(), this->getName());
    121       this->loadTexToGL();
     135      this->setTexture(loadTexToGL(this->image));
    122136    }
    123 
    124 }
    125 
     137}
     138
     139
     140/**
     141 * set the surface this Texture handles
     142 * @param newSurface the new Surface to set as the image for this Texture.
     143 *
     144 * This deletes the old version of the stored Texture,
     145 * and sets the newly given Surface as current.
     146 */
     147bool Texture::setSurface(SDL_Surface* newSurface)
     148{
     149  if (this->image != NULL)
     150    SDL_FreeSurface(this->image);
     151
     152  this->image = newSurface;
     153
     154  return (this->image != NULL);
     155}
     156
     157
     158bool Texture::texturesEnabled = true;
     159
     160/**
     161 * enables, disables textures
     162 * @param texturesEnabled true if the textures should be enabled
     163 */
     164void Texture::setTextureEnableState(bool texturesEnabled)
     165{
     166  Texture::texturesEnabled = texturesEnabled;
     167}
     168
     169
     170//////////////////////////////////////
     171// UTILITY FUNCTIONALITY OF TEXTURE //
     172//////////////////////////////////////
    126173/**
    127174 * converts surface to a new SDL_Surface, that is loadable by openGL
    128175 * @param surface the Surface to convert
     176 * @param hasAlpha if the newly created Surface has an alpha channel, true is returned otherwise false.
    129177 * @returns a !!new!! Surface, that is loadable by openGL.
    130178 */
    131 bool Texture::prepareSurface(SDL_Surface* surface)
     179SDL_Surface* Texture::prepareSurface(SDL_Surface* surface, bool& hasAlpha)
    132180{
    133181  PRINTF(4)("Loading texture to OpenGL-Environment.\n");
    134182
    135   SDL_Surface* putSurface;
     183  SDL_Surface* retSurface;
    136184  SDL_Rect area;
    137185  Uint32 saved_flags;
    138186  Uint8  saved_alpha;
    139187
    140   putSurface = SDL_CreateRGBSurface(SDL_SWSURFACE,
    141                                surface->w, surface->h,
    142                                32,
     188  hasAlpha = false;
     189  retSurface = SDL_CreateRGBSurface(SDL_SWSURFACE,
     190                                    surface->w, surface->h,
     191                                    32,
    143192#if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */
    144193                               0x000000FF,
     
    147196                               0xFF000000
    148197#else
    149                                0xFF000000,
     198                                   0xFF000000,
    150199                               0x00FF0000,
    151200                               0x0000FF00,
    152201                               0x000000FF
    153202#endif
    154                                );
    155   if ( putSurface == NULL )
     203                                   );
     204  if ( retSurface == NULL )
    156205  {
    157     this->setSurface(NULL);
    158     return false;
     206    return NULL;
    159207  }
    160208
     
    171219  area.w = surface->w;
    172220  area.h = surface->h;
    173   SDL_BlitSurface(surface, &area, putSurface, &area);
     221  SDL_BlitSurface(surface, &area, retSurface, &area);
    174222
    175223  /* Restore the alpha blending attributes */
     
    177225  {
    178226    SDL_SetAlpha(surface, saved_flags | SDL_OPENGL, saved_alpha);
    179     this->bAlpha = true;
    180   }
    181 
    182   return (this->setSurface(putSurface));
    183 }
    184 
    185 bool Texture::setSurface(SDL_Surface* newSurface)
    186 {
    187   if (this->image != NULL)
    188     SDL_FreeSurface(this->image);
    189 
    190   this->image = newSurface;
    191 
    192   return (this->image != NULL);
     227    hasAlpha = true;
     228  }
     229
     230  return (retSurface);
    193231}
    194232
     
    199237 * @returns The ID of the texture.
    200238 */
    201 GLuint Texture::loadTexToGL ()
    202 {
    203   if (this->texture != 0 && glIsTexture(this->texture))
    204     glDeleteTextures(1, &this->texture);
    205   this->texture = 0;
    206 
    207   if (this->image == NULL)
     239GLuint Texture::loadTexToGL (const SDL_Surface* surface)
     240{
     241//   if (this->texture != 0 && glIsTexture(this->texture))
     242//     glDeleteTextures(1, &this->texture);
     243//   this->texture = 0;
     244
     245  GLuint texture;
     246
     247  if (surface == NULL)
    208248    return 0;
    209249
    210250  /* Create an OpenGL texture for the image */
    211   glGenTextures(1, &this->texture);
    212   glBindTexture(GL_TEXTURE_2D, this->texture);
     251  glGenTextures(1, &texture);
     252  glBindTexture(GL_TEXTURE_2D, texture);
    213253  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    214254  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
     
    217257               0,
    218258               GL_RGBA,
    219                this->image->w, this->image->h,
     259               surface->w, surface->h,
    220260               0,
    221261               GL_RGBA,
    222262               GL_UNSIGNED_BYTE,
    223                this->image->pixels);
     263               surface->pixels);
    224264  // build the MipMaps
    225265  gluBuild2DMipmaps(GL_TEXTURE_2D,
    226266                    GL_RGBA,
    227                     this->image->w,
    228                     this->image->h,
     267                    surface->w,
     268                    surface->h,
    229269                    GL_RGBA,
    230270                    GL_UNSIGNED_BYTE,
    231                     this->image->pixels);
     271                    surface->pixels);
    232272  glBindTexture(GL_TEXTURE_2D, 0);
    233   return this->texture;
    234 }
     273  return texture;
     274}
  • branches/powerups/src/lib/graphics/importer/texture.h

    r5768 r5955  
    1414struct SDL_Surface;
    1515
    16 //! an enumerator for different procedural texture-types
    17 typedef enum TEXTURE_TYPE { TEXTURE_RADIAL_ALIAS,
    18   TEXTURE_NOISE };
    19 
    2016//! A Class, that reads in Textures from different fileformats.
    2117  class Texture : public BaseObject
     
    2723
    2824      bool loadImage(const char* imageName);
    29       bool rebuild();
     25      virtual bool rebuild();
    3026
    3127      /** @returns The textureID of this texture.  */
     
    3329      /** @returns true if texture has alpha, false otherwise */
    3430      inline bool hasAlpha() const {return bAlpha;}
     31      /** @returns the stored image of this Texture */
     32      const SDL_Surface* const getStoredImage() const { return this->image; };
     33
     34
     35
     36      static void setTextureEnableState(bool texturesEnabled);
     37      /** @returns true if Textures are enabled */
     38      inline static bool getTextureEnableState() { return Texture::texturesEnabled; };
     39
     40      // Utility functionality:
     41      static SDL_Surface* prepareSurface(SDL_Surface* input, bool& hasAlpha);
     42      static GLuint loadTexToGL (const SDL_Surface* surface);
    3543
    3644    protected:
    37       bool prepareSurface(SDL_Surface* input);
     45
    3846      bool setSurface(SDL_Surface* newSurface);
     47      bool setAlpha(bool hasAlpha) { this->bAlpha = hasAlpha; };
     48      bool setTexture(GLuint texture) { this->texture = texture; };
    3949
    40       GLuint loadTexToGL ();
    4150
    4251    private:
    43       GLuint        texture;            //!< The Texture-ID of opengl from this Texture.
    44       bool          bAlpha;             //!< if the texture has an alpha channel.
    45       SDL_Surface*  image;              //!< The SDL_Surfce that stores the Texture on it.
     52      GLuint           texture;            //!< The Texture-ID of opengl from this Texture.
     53      bool             bAlpha;             //!< if the texture has an alpha channel.
     54      SDL_Surface*     image;              //!< The SDL_Surfce that stores the Texture on it.
     55
     56      static bool      texturesEnabled;    //!< If the Textures are enabled.
    4657  };
    4758
  • branches/powerups/src/lib/graphics/light.cc

    r5750 r5955  
    2222#include "glincl.h"
    2323#include "vector.h"
    24 #include "tinyxml.h"
     24#include "parser/tinyxml/tinyxml.h"
    2525#include "load_param.h"
    2626#include "factory.h"
  • branches/powerups/src/lib/graphics/render2D/element_2d.cc

    r5783 r5955  
    2323#include "graphics_engine.h"
    2424#include "load_param.h"
    25 #include "tinyxml.h"
     25#include "parser/tinyxml/tinyxml.h"
    2626#include "class_list.h"
    2727
  • branches/powerups/src/lib/graphics/text_engine/font.cc

    r5768 r5955  
    181181    this->fontTTF = NULL;
    182182  }
    183   if (this->prepareSurface(surface))
    184     this->loadTexToGL( );
     183  bool hasAlpha;
     184  SDL_Surface* newSurf = this->prepareSurface(surface, hasAlpha);
     185  if (newSurf != NULL)
     186  {
     187    this->setSurface(newSurf);
     188    this->setAlpha(hasAlpha);
     189    this->setTexture(Texture::loadTexToGL(newSurf));
     190  }
    185191
    186192  // initializing the Glyphs.
     
    491497
    492498  if (this->setSurface(tmpSurf))
    493     loadTexToGL();
     499    (this->setTexture(Texture::loadTexToGL(tmpSurf)));
    494500}
    495501
  • branches/powerups/src/lib/graphics/text_engine/text_engine.cc

    r5780 r5955  
    6464{
    6565  // first remove all the remaining Texts (if any).
    66   std::list<BaseObject*>* textList = ClassList::getList(CL_TEXT);
     66  const std::list<BaseObject*>* textList = ClassList::getList(CL_TEXT);
    6767  if (textList != NULL)
    6868  {
     
    7171  }
    7272  // delete all remaining fonts (There should not be Anything to do here)
    73   std::list<BaseObject*>* fontList = ClassList::getList(CL_FONT);
     73  const std::list<BaseObject*>* fontList = ClassList::getList(CL_FONT);
    7474  if (fontList != NULL)
    7575  {
     
    124124void TextEngine::debug() const
    125125{
    126   list<BaseObject*>* textList = ClassList::getList(CL_TEXT);
     126  const list<BaseObject*>* textList = ClassList::getList(CL_TEXT);
    127127  if (textList != NULL)
    128128  {
     
    132132    PRINT(0)("Reference: %p; Text Counts: %d\n", this, textList->size());
    133133
    134     list<BaseObject*>::iterator text;
     134    list<BaseObject*>::const_iterator text;
    135135    for ( text = textList->begin(); text != textList->end(); text++)
    136136      dynamic_cast<Text*>(*text)->debug();
  • branches/powerups/src/lib/gui/gtk_gui/gui_audio.cc

    r5298 r5955  
    4242    {
    4343      CheckButton* enableSound; //!< A Ckeckbutton for enabling Sound.
     44      Slider* audioChannels;    //!< A Slider for the count of audio-channels.
    4445      Slider* musicVolume;      //!< A Slider for music volume.
    4546      Slider* effectsVolume;    //!< A Slider for effects volume.
     
    5152      enableSound->saveability();
    5253      audioBox->fill(enableSound);
     54
     55      Label* audioChannelsLabel = new Label(CONFIG_NAME_AUDIO_CHANNELS);
     56      audioBox->fill(audioChannelsLabel);
     57      audioChannels = new Slider(CONFIG_NAME_AUDIO_CHANNELS, 0, 32);
     58      audioChannels->setFlagName("channels", "c", 32);
     59      audioChannels->setDescription("Sets the count of channels in the game");
     60      audioChannels->saveability();
     61      audioBox->fill (audioChannels);
     62
     63
    5364      Label* musicVolumeLabel = new Label(CONFIG_NAME_MUSIC_VOLUME);
    5465      audioBox->fill(musicVolumeLabel);
     
    5869      musicVolume->saveability();
    5970      audioBox->fill (musicVolume);
     71
    6072      Label* effectsVolumeLabel = new Label (CONFIG_NAME_EFFECTS_VOLUME);
    6173      audioBox->fill (effectsVolumeLabel);
  • branches/powerups/src/lib/gui/gtk_gui/gui_exec.cc

    r5241 r5955  
    2727
    2828#include "resource_manager.h"
    29 #include "ini_parser.h"
     29#include "parser/ini_parser/ini_parser.h"
    3030
    3131#include <string.h>
     
    254254
    255255/**
    256  * Reads in Configuration Data.
     256 * @brief Reads in Configuration Data.
    257257 * @param widget from which Widget on should be saved.
    258258*/
     
    265265    return;
    266266
    267   iniParser.getFirstSection();
     267  iniParser.firstSection();
    268268  Widget* groupWidget = widget;
    269269  const char* groupName;
     
    272272  while (groupName = iniParser.getCurrentSection())
    273273  {
     274    printf("GROUP:::%s\n", groupName);
    274275    if((groupWidget = locateGroup(widget, groupName, 1))==NULL)
    275     {
    276       PRINTF(2)("!!There is no group called %s in this GUI.\n First best Widget will get the Infos assigned.\n Config-File will be updated in next Save\n", groupName);
    277       groupWidget = widget;
    278       continue;
    279     }
     276      {
     277        PRINTF(2)("!!There is no group called %s in this GUI.\n First best Widget will get the Infos assigned.\n Config-File will be updated in next Save\n", groupName);
     278        groupWidget = widget;
     279        continue;
     280      }
    280281    else
    281       PRINT(0)("Group %s located.\n", static_cast<Packer*>(groupWidget)->groupName);
    282 
    283     iniParser.getFirstVar();
    284     while(iniParser.getCurrentName())
    285     {
    286       varInfo.variableName = iniParser.getCurrentName();
     282      PRINT(4)("Group %s located.\n", static_cast<Packer*>(groupWidget)->groupName);
     283
     284    const char* entryName;
     285    iniParser.firstVar();
     286    while(entryName = iniParser.getCurrentName())
     287    {
     288      PRINTF(4)("ENTRY:::%s = %s\n", entryName, iniParser.getCurrentValue());
     289      varInfo.variableName = entryName;
    287290      varInfo.variableValue = iniParser.getCurrentValue();
    288291      groupWidget->walkThrough(this->readFileText, &varInfo, 0);
     
    303306{
    304307  VarInfo* info =(VarInfo*)varInfo;
     308  if (info == NULL || info->variableName == NULL)
     309    return;
     310
    305311  if(widget->title && !strcmp(widget->title, info->variableName))
    306312    {
    307313      PRINT(5)("Located Option %s.\n", widget->title);
    308314      if(widget->optionType > GUI_NOTHING)
    309         static_cast<Option*>(widget)->load(info->variableValue);
     315        if (info->variableValue != NULL)
     316          static_cast<Option*>(widget)->load(info->variableValue);
    310317    }
    311318}
     
    323330{
    324331  Widget* tmp;
     332  if (widget  == NULL || groupName == NULL)
     333    return NULL;
    325334
    326335  if(widget->optionType < GUI_NOTHING)
    327336    {
    328       if(static_cast<Packer*>(widget)->getGroupName() &&
     337      if(static_cast<Packer*>(widget)->getGroupName() != NULL &&
    329338         !strcmp(groupName, static_cast<Packer*>(widget)->getGroupName()))
    330         {
    331           return widget;
    332         }
     339        return widget;
    333340      else
    334341        {
    335           if((tmp = locateGroup(static_cast<Packer*>(widget)->down, groupName, depth+1)) != NULL)
     342          if((tmp = locateGroup(static_cast<Packer*>(widget)->down,
     343                                groupName, depth+1)) != NULL)
    336344            return tmp;
    337345        }
  • branches/powerups/src/lib/gui/gtk_gui/gui_keys.cc

    r5766 r5955  
    119119        pKeysBox->fill(addKey(CONFIG_NAME_PLAYER_LEFT, "LEFT"));
    120120        pKeysBox->fill(addKey(CONFIG_NAME_PLAYER_RIGHT, "RIGHT"));
    121         pKeysBox->fill(addKey(CONFIG_NAME_PLAYER_FIRE, "MOUSE_LEFT"));
     121        pKeysBox->fill(addKey(CONFIG_NAME_PLAYER_FIRE, "BUTTON_LEFT"));
    122122        pKeysBox->fill(addKey(CONFIG_NAME_PLAYER_NEXT_WEAPON, "m"));
    123123        pKeysBox->fill(addKey(CONFIG_NAME_PLAYER_PREV_WEAPON, "n"));
  • branches/powerups/src/lib/lang/base_object.cc

    r5791 r5955  
    112112  else if (classID & CL_MASK_SUBSUPER_CLASS)
    113113  {
    114     if (likely(((this->classID & CL_MASK_SUBSUPER_CLASS_ID) == (this->classID & CL_MASK_SUBSUPER_CLASS_ID)) &&
    115         this->classID & classID & CL_MASK_SUBSUPER_CLASS_ID2))
     114    if (likely(((this->classID & CL_MASK_SUBSUPER_CLASS_IDA) == (this->classID & CL_MASK_SUBSUPER_CLASS_IDA)) &&
     115        this->classID & classID & CL_MASK_SUBSUPER_CLASS_IDB))
    116116      return true;
    117117  }
  • branches/powerups/src/lib/lang/class_list.cc

    r5822 r5955  
    133133 * @return the List accessed by classID, or NULL if not found
    134134 */
    135 std::list<BaseObject*>* ClassList::getList(ClassID classID)
     135const std::list<BaseObject*>* ClassList::getList(ClassID classID)
    136136{
    137137  ClassList* fl;
     
    156156 * @return the List accessed by classID, or NULL if not found
    157157 */
    158 std::list<BaseObject*>* ClassList::getList(const char* className)
     158const std::list<BaseObject*>* ClassList::getList(const char* className)
    159159{
    160160  ClassList* fl;
  • branches/powerups/src/lib/lang/class_list.h

    r5821 r5955  
    4040    static void                           removeFromClassList(BaseObject* objectPointer);
    4141
    42     static std::list<BaseObject*>*        getList(ClassID classID = CL_NULL);// { return (ClassList* fl = ClassList::getClassList(classID) != NULL)? &(fl->objectList) : NULL; };
    43     static std::list<BaseObject*>*        getList(const char* className); // { return (ClassList* fl = ClassList::getClassList(className) != NULL)? &(fl->objectList) : NULL;  };
     42    static const std::list<BaseObject*>*  getList(ClassID classID = CL_NULL);// { return (ClassList* fl = ClassList::getClassList(classID) != NULL)? &(fl->objectList) : NULL; };
     43    static const std::list<BaseObject*>*  getList(const char* className); // { return (ClassList* fl = ClassList::getClassList(className) != NULL)? &(fl->objectList) : NULL;  };
    4444    static const std::list<const char*>*  getClassNames();
    4545    static BaseObject*                    getObject(const char* name, ClassID classID = CL_NULL);
    4646    static bool                           exists(const BaseObject* object, ClassID classID = CL_NULL);
     47
     48    void                                  sendBack(std::list<BaseObject*>::const_iterator it);
    4749
    4850    static void                           whatIs(const BaseObject* object);
     
    5153    static long                           StringToID(const char* className);
    5254    static void                           debug(unsigned int debugLevel = 0, long classID = CL_NULL);
    53     static void                           debugS(const char* className = 0x0, unsigned int debugLevel = 0);
     55    static void                           debugS(const char* className = NULL, unsigned int debugLevel = 0);
    5456
    5557    inline bool                           operator==(ClassID classID) { return (this->classID == classID); };
  • branches/powerups/src/lib/network/network_manager.cc

    r5822 r5955  
    161161  if (this->netStreamList != NULL || (this->netStreamList = ClassList::getList(CL_NETWORK_STREAM)) != NULL)
    162162  {
    163     std::list<BaseObject*>::iterator stream;
     163    std::list<BaseObject*>::const_iterator stream;
    164164    for (stream = this->netStreamList->begin(); stream != this->netStreamList->end(); ++stream)
    165165      static_cast<NetworkStream*>(*stream)->processData();
  • branches/powerups/src/lib/network/network_manager.h

    r5822 r5955  
    4141
    4242private:
    43   std::list<BaseObject*>*    netStreamList;            // list with refs to all network streams
    44   std::list<BaseObject*>*    syncList;                 // list of synchronizeables
     43  const std::list<BaseObject*>*    netStreamList;            // list with refs to all network streams
     44  const std::list<BaseObject*>*    syncList;                 // list of synchronizeables
    4545
    4646};
  • branches/powerups/src/lib/particles/particle_engine.h

    r5447 r5955  
    1212#include "particle_emitter.h"
    1313
    14 #include "tinyxml.h"
     14#include "parser/tinyxml/tinyxml.h"
    1515
    1616// FORWARD DECLARATION
  • branches/powerups/src/lib/particles/particle_system.cc

    r5750 r5955  
    3030#include "shell_command.h"
    3131
    32 #include "tinyxml.h"
     32#include "parser/tinyxml/tinyxml.h"
    3333
    3434CREATE_FACTORY(ParticleSystem, CL_PARTICLE_SYSTEM);
  • branches/powerups/src/lib/physics/physics_engine.cc

    r5779 r5955  
    2020#include "class_list.h"
    2121#include "list.h"
    22 #include "tinyxml.h"
     22#include "parser/tinyxml/tinyxml.h"
    2323#include "factory.h"
    2424#include "load_param.h"
  • branches/powerups/src/lib/shell/shell_command.cc

    r5791 r5955  
    159159  long classID = CL_NULL;                      //< the classID retrieved from the Class.
    160160  ShellCommandClass* commandClass = NULL;      //< the command class this command applies to.
    161   std::list<BaseObject*>* objectList = NULL;   //< the list of Objects stored in classID
     161  const std::list<BaseObject*>* objectList = NULL;   //< the list of Objects stored in classID
    162162  BaseObject* objectPointer = NULL;            //< a pointer to th Object to Execute the command on
    163163  bool emptyComplete = false;                  //< if the completion input is empty string. e.g ""
  • branches/powerups/src/lib/shell/shell_completion.cc

    r5791 r5955  
    5858
    5959  long classID;                         //< the classID retrieved from the Class.
    60   std::list<BaseObject*>* objectList;   //< the list of Objects stored in classID
     60  const std::list<BaseObject*>* objectList;   //< the list of Objects stored in classID
    6161  bool emptyComplete = false;           //< if the completion input is empty string. e.g ""
    6262  long completeType = SHELLC_NONE;      //< the Type we'd like to complete.
  • branches/powerups/src/lib/sound/sound_buffer.cc

    r5422 r5955  
    2020#include "sound_engine.h"
    2121
    22 
    2322using namespace std;
    24 
    2523
    2624//////////////////
     
    3634  this->setName(fileName);
    3735
    38   SoundEngine::getInstance()->addBuffer(this);
    39 
    4036  ALenum format;
    4137  ALvoid* data;
     
    4743  alGenBuffers(1, &this->bufferID);
    4844  if ((result = alGetError()) != AL_NO_ERROR)
    49     SoundEngine::PrintALErrorString(result);
     45    PRINTF(2)("%s\n", SoundEngine::getALErrorString(result));
    5046
    5147  // read in the wav data
     
    5955#endif
    6056  if ((result = alGetError()) != AL_NO_ERROR)
    61     SoundEngine::PrintALErrorString(result);
     57    PRINTF(2)("%s\n", SoundEngine::getALErrorString(result));
    6258
    6359  // send the loaded wav data to the buffer
    6460  alBufferData(this->bufferID, format, data, this->size, freq);
    6561  if ((result = alGetError()) != AL_NO_ERROR)
    66     SoundEngine::PrintALErrorString(result);
     62    PRINTF(2)("%s\n", SoundEngine::getALErrorString(result));
    6763
    6864  // remove the wav data (redundant)
    6965  alutUnloadWAV(format, data, this->size, freq);
    7066  if ((result = alGetError()) != AL_NO_ERROR)
    71     SoundEngine::PrintALErrorString(result);
     67    PRINTF(2)("%s\n", SoundEngine::getALErrorString(result));
    7268}
    7369
  • branches/powerups/src/lib/sound/sound_engine.cc

    r5871 r5955  
    2727#include "resource_manager.h"
    2828#include "debug.h"
    29 #include "ini_parser.h"
     29#include "parser/ini_parser/ini_parser.h"
    3030#include "globals.h"
    3131
     
    4747  this->bufferList = NULL;
    4848  this->sourceList = NULL;
     49
     50  this->device = NULL;
     51  this->context = NULL;
     52
     53  this->maxSourceCount = 32;
    4954}
    5055
     
    6469    while (this->sourceList->size() > 0)
    6570      delete dynamic_cast<SoundSource*>(this->sourceList->front());
     71  }
     72
     73  while(!this->ALSources.empty())
     74  {
     75    alDeleteSources(1, &this->ALSources.top());
     76    this->ALSources.pop();
    6677  }
    6778
     
    8697void SoundEngine::loadSettings(IniParser* iniParser)
    8798{
     99  const char* channels = iniParser->getVar(CONFIG_NAME_AUDIO_CHANNELS, CONFIG_SECTION_AUDIO, "32");
     100  this->maxSourceCount = atoi(channels);
    88101  const char* musicVolume = iniParser->getVar(CONFIG_NAME_MUSIC_VOLUME, CONFIG_SECTION_AUDIO, "80");
    89102  this->musicVolume = atof(musicVolume)/100.0;
     
    118131
    119132
    120 /**
    121  *  adds a SoundBuffer to the bufferList of the SoundEngine
    122  * @param buffer The buffer to add to the bufferList
    123 */
    124 void SoundEngine::addBuffer(SoundBuffer* buffer)
    125 {
    126   if (unlikely(this->bufferList == NULL))
    127     this->bufferList = ClassList::getList(CL_SOUND_BUFFER);
    128 }
    129 
    130 /**
    131  *  removes a SoundBuffer from the bufferList of the SoundEngine
    132  * @param buffer The buffer to delete from the SoundEngine
    133 */
    134 void SoundEngine::removeBuffer(SoundBuffer* buffer)
    135 {
    136   // look if there are any sources that have the buffer still loaded
    137   if (this->sourceList != NULL)
    138   {
    139     list<BaseObject*>::iterator source;
    140     for (source = this->sourceList->begin(); source != this->sourceList->end(); source++)
    141     {
    142       if (buffer == static_cast<SoundSource*>(*source)->getBuffer())
    143         delete (*source);
     133void SoundEngine::popALSource(ALuint& source)
     134{
     135  if (source != 0)
     136    return;
     137  else
     138  {
     139
     140    /// @TODO try to create more sources if needed
     141    if (!this->ALSources.empty())
     142    {
     143
     144      source = this->ALSources.top();
     145      printf("test: : %d\n", source);
     146      this->ALSources.pop();
    144147    }
    145148  }
    146149}
    147150
    148 /**
    149  * adds a SoundSource to the sourceList of the SoundEngine
    150  * @param source The source to add to the sourceList
    151 */
    152 void SoundEngine::addSource(SoundSource* source)
    153 {
    154   this->sourceList = ClassList::getList(CL_SOUND_SOURCE);
    155 }
    156151
    157152/**
     
    180175
    181176  // updating all the Sources positions
    182   if (likely(this->sourceList != NULL))
    183   {
    184     list<BaseObject*>::iterator sourceIT;
     177  if (likely(this->sourceList != NULL || (this->sourceList = ClassList::getList(CL_SOUND_SOURCE)) != NULL))
     178  {
     179    list<BaseObject*>::const_iterator sourceIT;
    185180    SoundSource* source;
    186181    for (sourceIT = this->sourceList->begin(); sourceIT != this->sourceList->end(); sourceIT++)
    187182    {
    188183      source = static_cast<SoundSource*>(*sourceIT);
    189       if (likely(source->getNode() != NULL))
     184      if (source->isPlaying())
    190185      {
    191         alSource3f(source->getID(), AL_POSITION,
    192                    source->getNode()->getAbsCoor().x,
    193                    source->getNode()->getAbsCoor().y,
    194                    source->getNode()->getAbsCoor().z);
    195         alSource3f(source->getID(), AL_VELOCITY,
    196                    source->getNode()->getVelocity().x,
    197                    source->getNode()->getVelocity().y,
    198                    source->getNode()->getVelocity().z);
     186        int play;
     187        alGetSourcei(source->getID(), AL_SOURCE_STATE, &play);
     188        if(play == AL_PLAYING)
     189        {
     190          if (likely(source->getNode() != NULL))
     191          {
     192            alSource3f(source->getID(), AL_POSITION,
     193                       source->getNode()->getAbsCoor().x,
     194                       source->getNode()->getAbsCoor().y,
     195                       source->getNode()->getAbsCoor().z);
     196            alSource3f(source->getID(), AL_VELOCITY,
     197                       source->getNode()->getVelocity().x,
     198                       source->getNode()->getVelocity().y,
     199                       source->getNode()->getVelocity().z);
     200          }
     201
     202        }
     203        else
     204        {
     205          source->stop();
     206        }
    199207      }
    200208    }
     
    281289
    282290  // INITIALIZING THE DEVICE:
     291#ifndef AL_VERSION_1_1
    283292  ALubyte deviceName[] =
     293#else
     294  ALCchar deviceName[] =
     295#endif
    284296#ifdef __WIN32__
    285       "native";
     297      "Direct3D";
    286298#else
    287       "'( ( devices '( native arts null ) ) )";
     299      "'( ( devices '( native null ) ) )";
    288300#endif
    289301  //
     
    296308
    297309  if ((result = alGetError()) != AL_NO_ERROR)
    298     SoundEngine::PrintALErrorString(result);
     310    PRINTF(2)("%s\n", SoundEngine::getALErrorString(result));
    299311
    300312  this->setDopplerValues(SOUND_DOPPLER_FACTOR, SOUND_DOPPLER_VELOCITY);
     313}
     314
     315
     316/**
     317 * Allocates openAL sources
     318 * @param count how many sources to allocate
     319 * @returns true on success, false if at least one source could not be allocated
     320 */
     321bool SoundEngine::allocateSources(unsigned int count)
     322{
     323  ALenum result;
     324  // Setting default values.
     325  for (unsigned int i = 0; i < count; i++)
     326  {
     327    ALuint source;
     328
     329    alGenSources(1, &source);
     330    if ((result = alGetError()) != AL_NO_ERROR)
     331      PRINTF(1)("Error Generating Sources: '%s'\n", SoundEngine::getALErrorString(result));
     332
     333    alSourcef (source, AL_PITCH,    1.0      );
     334    alSourcef (source, AL_GAIN,     this->getEffectsVolume() );
     335    alSourcei (source, AL_LOOPING,  AL_FALSE );
     336    this->ALSources.push(source);
     337  }
     338  return true;
    301339}
    302340
     
    305343 * @param err The error found
    306344*/
    307 void SoundEngine::PrintALErrorString(ALenum err)
     345const char* SoundEngine::getALErrorString(ALenum err)
    308346{
    309347  switch(err)
    310348    {
    311349    case AL_NO_ERROR:
    312       PRINTF(4)("AL_NO_ERROR\n");
    313       break;
    314 
     350      return ("AL_NO_ERROR");
    315351    case AL_INVALID_NAME:
    316       PRINTF(2)("AL_INVALID_NAME\n");
    317       break;
    318 
     352      return ("AL_INVALID_NAME");
    319353    case AL_INVALID_ENUM:
    320       PRINTF(2)("AL_INVALID_ENUM\n");
    321       break;
    322 
     354      return ("AL_INVALID_ENUM");
    323355    case AL_INVALID_VALUE:
    324       PRINTF(2)("AL_INVALID_VALUE\n");
    325       break;
    326 
     356      return ("AL_INVALID_VALUE");
    327357    case AL_INVALID_OPERATION:
    328       PRINTF(2)("AL_INVALID_OPERATION\n");
    329       break;
    330 
     358      return ("AL_INVALID_OPERATION");
    331359    case AL_OUT_OF_MEMORY:
    332       PRINTF(2)("AL_OUT_OF_MEMORY\n");
    333       break;
     360      return ("AL_OUT_OF_MEMORY");
    334361    };
    335362}
     
    337364void SoundEngine::listDevices()
    338365{
    339 
    340366  printf("%s\n",(const char*)alcGetString(NULL, ALC_DEVICE_SPECIFIER));
    341367}
  • branches/powerups/src/lib/sound/sound_engine.h

    r5819 r5955  
    1414
    1515#include <list>
     16#include <stack>
    1617
    1718#define SOUND_DOPPLER_FACTOR       0.001          //!< A factor for the audible doppler effect
     
    2223class IniParser;
    2324
     25
    2426//! A class that handles audio via the openAudioLibrary
    2527class SoundEngine : public BaseObject {
    26 
    2728  public:
    2829    virtual ~SoundEngine();
     
    4748
    4849  // administrative
    49     void addBuffer(SoundBuffer* buffer);
    50     void removeBuffer(SoundBuffer* buffer);
    51     void addSource(SoundSource* source);
     50    void popALSource(ALuint& source);
     51    void pushALSource(ALuint& source) { if (source != 0) this->ALSources.push(source); };
    5252
    5353    void flushUnusedBuffers();
    5454    void flushAllBuffers();
    5555    void flushAllSources();
     56
    5657    bool initAudio();
     58    bool allocateSources(unsigned int count);
    5759
    5860  // error handling:
    59     static void PrintALErrorString(ALenum err);
    60   //  static void PrintALCErrorString(ALenum err);
    61 
     61    static const char* getALErrorString(ALenum err);
    6262
    6363  private:
    6464    SoundEngine();
     65
    6566    void listDevices();
    6667
    6768  private:
    68     static SoundEngine*      singletonRef;             //!< Reference to this class
     69    static SoundEngine*            singletonRef;             //!< Reference to this class
    6970
    70     ALCdevice*               device;                   //!< the used audio-device.
    71     ALCcontext*              context;                  //!< the context, currently in use.
     71    ALCdevice*                     device;                   //!< the used audio-device.
     72    ALCcontext*                    context;                  //!< the context, currently in use.
    7273
    73     float                    musicVolume;              //!< the maximum volume of the music in % (0f,1f]
    74     float                    effectsVolume;            //!< the maximum volume of sound-effects in % (0f,1f]
    75     PNode*                   listener;                 //!< The listener of the Scene
     74    float                          musicVolume;              //!< the maximum volume of the music in % (0f,1f]
     75    float                          effectsVolume;            //!< the maximum volume of sound-effects in % (0f,1f]
     76    PNode*                         listener;                 //!< The listener of the Scene
    7677
    77     std::list<BaseObject*>*  bufferList;               //!< A list of buffers
    78     std::list<BaseObject*>*  sourceList;               //!< A list for all the sources in the scene.
     78    const std::list<BaseObject*>*  bufferList;               //!< A list of buffers
     79    const std::list<BaseObject*>*  sourceList;               //!< A list for all the sources in the scene.
    7980
    80 
     81    unsigned int                   maxSourceCount;           //!< How many Sources is the Maximum
     82    std::stack<ALuint>             ALSources;                //!< A list of real openAL-Sources, the engine allocates, and stores for reuse.
    8183};
    8284
  • branches/powerups/src/lib/sound/sound_source.cc

    r5386 r5955  
    1818#include "sound_source.h"
    1919#include "sound_engine.h"
     20
    2021#include "alincl.h"
    2122#include "compiler.h"
     
    3334
    3435  // adding the Source to the SourcesList of the SoundEngine
    35   SoundEngine::getInstance()->addSource(this);
    36 
    3736  this->buffer = buffer;
    3837  this->sourceNode = sourceNode;
    3938
    40   alGenSources(1, &this->sourceID);
    41   if ((result = alGetError()) != AL_NO_ERROR)
    42     SoundEngine::PrintALErrorString(result);
    43   if (this->buffer != NULL)
    44     alSourcei (this->sourceID, AL_BUFFER,   this->buffer->getID());
    45   alSourcef (this->sourceID, AL_PITCH,    1.0      );
    46   alSourcef (this->sourceID, AL_GAIN,     SoundEngine::getInstance()->getEffectsVolume() );
    47   alSourcei (sourceID, AL_LOOPING,  AL_FALSE     );
     39  this->sourceID = 0;
     40  this->bPlay = false;
    4841}
    4942
     
    5346SoundSource::~SoundSource()
    5447{
    55   //SoundEngine::getInstance()->removeSource(this);
    56   alDeleteSources(1, &this->sourceID);
     48  SoundEngine::getInstance()->pushALSource(this->sourceID);
    5749}
    5850
     
    6254void SoundSource::play()
    6355{
     56  if (this->sourceID == 0)
     57    SoundEngine::getInstance()->popALSource(this->sourceID);
    6458  alSourcePlay(this->sourceID);
     59  this->bPlay = true;
    6560}
    6661
     
    7166void SoundSource::play(const SoundBuffer* buffer)
    7267{
     68  if (unlikely(this->sourceID == 0))
     69    SoundEngine::getInstance()->popALSource(this->sourceID);
     70
     71  printf("%d\n",sourceID);
    7372  alSourceStop(this->sourceID);
    7473  alSourcei (this->sourceID, AL_BUFFER, buffer->getID());
     
    7776  if (unlikely(this->buffer != NULL))
    7877    alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID());
     78  this->bPlay = true;
    7979}
    8080
     
    8484void SoundSource::stop()
    8585{
     86  this->bPlay = false;
    8687  alSourceStop(this->sourceID);
     88  SoundEngine::getInstance()->pushALSource(this->sourceID);
    8789}
    8890
  • branches/powerups/src/lib/sound/sound_source.h

    r5386 r5955  
    3131    /** @returns The ID of this Source */
    3232    inline ALuint getID() const { return this->sourceID; }
     33    /** @returns true, if the Source is Playing */
     34    inline bool   isPlaying() const { return this->bPlay; };
    3335    /** @returns the SoundBuffer of this Source */
    3436    inline const SoundBuffer* getBuffer() const { return this->buffer; }
     
    3941
    4042  private:
     43    bool                   bPlay;                 //!< If the Source is Playing.
    4144    ALuint                 sourceID;              //!< The ID of the Source
    4245    const SoundBuffer*     buffer;                //!< The buffer to play in this source.
  • branches/powerups/src/lib/util/executor/executor_specials.h

    r5754 r5955  
    1010
    1111#include "compiler.h"
    12 #include "tinyxml.h"
     12#include "parser/tinyxml/tinyxml.h"
    1313// FORWARD DECLARATION
    1414
  • branches/powerups/src/orxonox.cc

    r5822 r5955  
    3333
    3434#include "world.h"
    35 #include "ini_parser.h"
     35#include "parser/ini_parser/ini_parser.h"
    3636#include "game_loader.h"
    3737
     
    235235  // SDL_InitSubSystem(SDL_INIT_AUDIO);
    236236  SoundEngine::getInstance()->initAudio();
     237  SoundEngine::getInstance()->allocateSources(1);
    237238
    238239  SoundEngine::getInstance()->loadSettings(this->iniParser);
  • branches/powerups/src/story_entities/world.cc

    r5819 r5955  
    2626#include "null_parent.h"
    2727#include "pilot_node.h"
    28 #include "track_node.h"
    2928#include "world_entity.h"
    3029#include "player.h"
     
    4039#include "shell.h"
    4140
    42 #include "track_manager.h"
    4341#include "garbage_collector.h"
    4442#include "fast_factory.h"
     
    6361#include "weapons/projectile.h"
    6462#include "event_handler.h"
    65 
    6663#include "sound_engine.h"
    6764#include "ogg_player.h"
     
    7269#include "npcs/npc_test1.h"
    7370#include "shader.h"
     71
     72#include "playable.h"
    7473
    7574SHELL_COMMAND(speed, World, setSpeed);
     
    122121  PRINTF(3)("World::~World() - deleting current world\n");
    123122
     123
    124124  // here everything that is alocated by the World is deleted
    125125  delete this->entities;
    126126  State::setWorldEntityList(NULL);
    127127
     128  delete this->localPlayer;
    128129
    129130  // delete all the initialized Engines.
    130131  FastFactory::flushAll(true);
    131132  delete LightManager::getInstance();
    132   delete TrackManager::getInstance();
    133133  delete ParticleEngine::getInstance();
    134134  delete AnimationPlayer::getInstance();
     
    142142  // erease everything that is left.
    143143  delete NullParent::getInstance();
     144
    144145  Shader::suspendShader();
    145146
     
    172173  this->shell = NULL;
    173174  this->entities = NULL;
     175  this->localPlayer = NULL;
     176  this->localCamera = NULL;
    174177
    175178  this->showPNodes = false;
     
    213216
    214217  AnimationPlayer::getInstance(); // initializes the animationPlayer
     218  ParticleEngine::getInstance();
    215219  PhysicsEngine::getInstance();
    216220
     
    242246    }
    243247
    244   TiXmlDocument* XMLDoc = new TiXmlDocument( path);
     248  TiXmlDocument* XMLDoc = new TiXmlDocument( getPath());
    245249  // load the campaign document
    246250  if( !XMLDoc->LoadFile())
    247251  {
    248252    // report an error
    249     PRINTF(1)("loading XML File: %s @ %d:%d\n", XMLDoc->ErrorDesc(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
     253    PRINTF(1)("loading XML File: %s @ %s:l%d:c%d\n", XMLDoc->ErrorDesc(), this->getPath(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
    250254    delete XMLDoc;
    251255    return (ErrorMessage){213,"XML File parsing error","World::load()"};
     
    313317      while( element != NULL)
    314318        {
    315           WorldEntity* created = dynamic_cast<WorldEntity*>( loader->fabricate( element));
    316           if( created != NULL) this->spawn( created);
     319          BaseObject* created = (loader->fabricate(element));
     320          if( created != NULL )
     321          {
     322            if(created->isA(CL_WORLD_ENTITY))
     323              this->spawn(dynamic_cast<WorldEntity*>(created));
     324            printf("Created a %s: %s\n", created->getClassName(), created->getName());
     325          }
     326
    317327          // if we load a 'Player' we use it as localPlayer
     328
     329
    318330          //todo do this more elegant
    319           if( element->Value() != NULL && !strcmp( element->Value(), "Player"))
    320           {
    321             localPlayer = (Player*) created;
    322             CDEngine::getInstance()->setPlayer(localPlayer);
    323           }
    324           if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox")) sky = (SkyBox*) created;
     331          if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox"))
     332            sky = dynamic_cast<SkyBox*>(created);
    325333          if( element->Value() != NULL && !strcmp( element->Value(), "Terrain"))
    326334          {
    327             terrain = (Terrain*) created;
     335            terrain = dynamic_cast<Terrain*>(created);
    328336            CDEngine::getInstance()->setTerrain(terrain);
    329337          }
     
    340348    LoadParamXML(root, "LightManager", LightManager::getInstance(), LightManager, loadParams);
    341349
    342     LoadParamXML(root, "ParticleEngine", ParticleEngine::getInstance(), ParticleEngine, loadParams);
    343     LoadParamXML(root, "PhysicsEngine", PhysicsEngine::getInstance(), PhysicsEngine, loadParams);
    344 
    345   // find Track
    346   element = root->FirstChildElement( "Track");
    347   if( element == NULL)
    348     {
    349       PRINTF(0)("World is missing a 'Track'\n");
    350     }
    351   else
    352     {
    353       //load track
    354       PRINTF(4)("Loading Track\n");
    355 
    356       TrackManager::getInstance()->loadParams( element);
    357       TrackManager::getInstance()->finalize();
    358     }
     350   LoadParamXML(root, "ParticleEngine", ParticleEngine::getInstance(), ParticleEngine, loadParams);
     351//   LoadParamXML(root, "PhysicsEngine", PhysicsEngine::getInstance(), PhysicsEngine, loadParams);
    359352
    360353  // free the XML data
     
    363356  /* GENERIC LOADING PROCESS FINISHED */
    364357
    365   // bind input
    366   EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_UP);
    367   EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_DOWN);
    368   EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_LEFT);
    369   EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_RIGHT);
    370   EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_FIRE1);
    371   EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_NEXT_WEAPON);
    372   EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_PREVIOUS_WEAPON);
    373   EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, SDLK_PAGEUP);
    374   EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, SDLK_PAGEDOWN);
     358
     359  // Create a Player
     360  this->localPlayer = new Player();
     361
     362  Playable* playable;
     363  const list<BaseObject*>* playableList = ClassList::getList(CL_PLAYABLE);
     364  if (playableList != NULL)
     365  {
     366    playable = dynamic_cast<Playable*>(playableList->front());
     367    this->localPlayer->setControllable(playable);
     368  }
    375369
    376370  // bind camera
    377   //this->localCamera->bind (localPlayer);
    378  // this->localPlayer->addChild (this->localCamera);
    379 
    380 
    381   //        TrackManager::getInstance()->setBindSlave(env);
    382   PNode* tn = TrackManager::getInstance()->getTrackNode();
    383   tn->addChild(this->localPlayer);
    384 
    385   //localCamera->setParent(TrackNode::getInstance());
    386   tn->addChild(this->localCamera);
    387   localCamera->lookAt(tn);
     371  playable->addChild (this->localCamera);
     372
     373//   //localCamera->setParent(TrackNode::getInstance());
     374//  tn->addChild(this->localCamera);
    388375  localCamera->setClipRegion(1, 10000.0);
    389   this->localPlayer->setParentMode(PNODE_ALL);
    390   TrackManager::getInstance()->condition(1, LEFTRIGHT, this->localPlayer);
    391 
     376  localCamera->lookAt(playable);
     377//  this->localPlayer->setParentMode(PNODE_ALL);
    392378  if (sky != NULL)
    393379  {
     
    400386  glNewList (objectList, GL_COMPILE);
    401387
    402   //TrackManager::getInstance()->drawGraph(.01);
    403   //TrackManager::getInstance()->debug(2);
    404388  glEndList();
    405389
     
    412396  ////////////
    413397
    414   Gravity* test = new Gravity();
    415 
    416   // SYSTEM TRAILING THE PLAYER
    417   // Creating a Test Particle System
    418 
    419   //new PhysicsConnection(system, gravity);
    420   //    new PhysicsConnection(this->localPlayer, gravity);
    421398
    422399//   TestEntity* testEntity = new TestEntity();
     
    424401//   testEntity->setRelDir(Quaternion(M_PI, Vector(0, 1, 0)));
    425402//   this->spawn(testEntity);
    426 
    427 //   TestEntity* testEntity2 = new TestEntity();
    428 //   testEntity2->setAnim(STAND);
    429 //   testEntity2->setRelCoor(Vector(2400.0, 10.0, -30.0));
    430 //   testEntity2->setRelDir(Quaternion(M_PI, Vector(0, 1, 0)));
    431 //   //testEntity2->setParent(this->localPlayer);
    432 //   this->spawn(testEntity2);
    433 //
    434 //   TestEntity* testEntity3 = new TestEntity();
    435 //   testEntity3->setAnim(BOOM);
    436 //   testEntity3->setRelCoor(Vector(2450.0, 10.0, -40.0));
    437 //   testEntity3->setRelDir(Quaternion(M_PI, Vector(0, 1, 0)));
    438 //   this->spawn(testEntity3);
    439 //
    440 //   TestEntity* testEntity4 = new TestEntity();
    441 //   testEntity4->setAnim(FLIP);
    442 //   testEntity4->setRelCoor(Vector(2500.0, 10.0, -22.0));
    443 //   testEntity4->setRelDir(Quaternion(M_PI, Vector(0, 1, 0)));
    444 //   this->spawn(testEntity4);
    445 //
    446 //   TestEntity* testEntity5 = new TestEntity();
    447 //   testEntity5->setAnim(WAVE);
    448 //   testEntity5->setRelCoor(Vector(2420.0, 10.0, -50.0));
    449 //   testEntity5->setRelDir(Quaternion(M_PI, Vector(0, 1, 0)));
    450 //   this->spawn(testEntity5);
    451 //
    452 //   TestEntity* testEntity6 = new TestEntity();
    453 //   testEntity6->setAnim(WAVE);
    454 //   testEntity6->setRelCoor(Vector(2420.0, 10.0, -20.0));
    455 //   testEntity6->setRelDir(Quaternion(M_PI, Vector(0, 1, 0)));
    456 //   this->spawn(testEntity6);
    457 //
    458 //   TestEntity* testEntity7 = new TestEntity();
    459 //   testEntity7->setAnim(WAVE);
    460 //   testEntity7->setRelCoor(Vector(2500.0, 10.0, -50.0));
    461 //   testEntity7->setRelDir(Quaternion(M_PI, Vector(0, 1, 0)));
    462 //   this->spawn(testEntity7);
    463 
    464 
    465 
    466 //  PhysicsEngine::getInstance()->debug();
    467 
    468 
    469403
    470404  for(int i = 0; i < 100; i++)
     
    476410    tmp->setAbsCoor(((float)rand()/RAND_MAX) * 5000, 50/*+ (float)rand()/RAND_MAX*20*/, ((float)rand()/RAND_MAX -.5) *30);
    477411    this->spawn(tmp);
    478 
    479 
    480412  }
    481 
    482 
    483 
    484 //  ClassList::debug();
    485413
    486414  this->music = NULL;//(OggPlayer*)ResourceManager::getInstance()->load("sound/00-luke_grey_-_hypermode.ogg", OGG, RP_LEVEL);
     
    498426  this->glmis->step();
    499427  // stuff beyond this point remains to be loaded properly
    500 
    501   // initializing the TrackManager
    502   TrackManager::getInstance()->addPointV(Vector(150, -35, 5));
    503   TrackManager::getInstance()->addPointV(Vector(200,-35, 5));
    504   TrackManager::getInstance()->addPointV(Vector(250, -35, 5));
    505   TrackManager::getInstance()->addPointV(Vector(320,-33,-.55));
    506   TrackManager::getInstance()->setDuration(1);
    507   TrackManager::getInstance()->setSavePoint();
    508 
    509   TrackManager::getInstance()->addPointV(Vector(410, 0, 0));
    510   TrackManager::getInstance()->addPointV(Vector(510, 20, -10));
    511   TrackManager::getInstance()->addPointV(Vector(550, 20, -10));
    512   TrackManager::getInstance()->addPointV(Vector(570, 20, -10));
    513   TrackManager::getInstance()->setDuration(2);
    514 
    515   TrackManager::getInstance()->forkS("testFork1,testFork2");
    516   TrackManager::getInstance()->workOnS("testFork1");
    517   TrackManager::getInstance()->addPointV(Vector(640, 25, -30));
    518   TrackManager::getInstance()->addPointV(Vector(700, 40, -120));
    519   TrackManager::getInstance()->addPointV(Vector(800, 50, -150));
    520   TrackManager::getInstance()->addPointV(Vector(900, 60, -100));
    521   TrackManager::getInstance()->addPointV(Vector(900, 60, -70));
    522   TrackManager::getInstance()->addPointV(Vector(990, 65, -15));
    523   TrackManager::getInstance()->addPointV(Vector(1050, 65, -10));
    524   TrackManager::getInstance()->addPointV(Vector(1100, 65, -20));
    525   TrackManager::getInstance()->setDuration(4);
    526 
    527   TrackManager::getInstance()->workOnS("testFork2");
    528   TrackManager::getInstance()->addPointV(Vector(640, 25, 20));
    529   TrackManager::getInstance()->addPointV(Vector(670, 50, 120));
    530   TrackManager::getInstance()->addPointV(Vector(700, 70, 80));
    531   TrackManager::getInstance()->addPointV(Vector(800, 70, 65));
    532   TrackManager::getInstance()->addPointV(Vector(850, 65, 65));
    533   TrackManager::getInstance()->addPointV(Vector(920, 35, 40));
    534   TrackManager::getInstance()->addPointV(Vector(945, 40, 40));
    535   TrackManager::getInstance()->addPointV(Vector(970, 24, 40));
    536   TrackManager::getInstance()->addPointV(Vector(1000, 40, -7));
    537 
    538   TrackManager::getInstance()->setDuration(4);
    539 
    540 
    541   TrackManager::getInstance()->joinS("testFork1,testFork2");
    542 
    543   TrackManager::getInstance()->addPointV(Vector(1200, 60, -50));
    544   TrackManager::getInstance()->addPointV(Vector(1300, 50, -50));
    545   TrackManager::getInstance()->addPointV(Vector(1400, 40, -50));
    546   TrackManager::getInstance()->addPointV(Vector(1500, 40, -60));
    547   TrackManager::getInstance()->addPointV(Vector(1600, 35, -55));
    548   TrackManager::getInstance()->addPointV(Vector(1700, 45, -40));
    549   TrackManager::getInstance()->addPointV(Vector(1750, 60, -40));
    550   TrackManager::getInstance()->addPointV(Vector(1770, 80, -40));
    551   TrackManager::getInstance()->addPointV(Vector(1800, 100, -40));
    552   TrackManager::getInstance()->setDuration(10);
    553 
    554   TrackManager::getInstance()->finalize();
    555 
    556428
    557429  // LIGHT initialisation
     
    571443      {
    572444        LightManager::getInstance()->getLight()->setAbsCoor(-5.0, 10.0, -40.0);
    573 
    574 
    575         this->localPlayer = new Player ();
    576         this->localPlayer->setName ("player");
    577         this->spawn (this->localPlayer);
    578         this->localPlayer->setRelCoor(Vector(5,0,0));
    579445        /*monitor progress*/
    580446        this->glmis->step();
    581 
    582 
    583         EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_FIRE1);
    584         EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_NEXT_WEAPON);
    585         EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_PREVIOUS_WEAPON);
    586 
    587         /*
    588         Field* testField = new Gravity();
    589         testField->setMagnitude(10);
    590         new PhysicsConnection(this->localPlayer, testField);
    591         */
    592447
    593448        // bind camera
     
    614469        this->glmis->step();
    615470
    616         this->pilotNode = new PilotNode();
    617         this->spawn(this->pilotNode);
    618         this->pilotNode->setAbsCoor(Vector(150, -35, 5));
    619         this->pilotNode->addChild(this->localPlayer);
    620         this->pilotNode->addChild(this->localCamera);
    621         this->localCamera->lookAt(this->localPlayer);
    622 
    623         EventHandler::getInstance()->subscribe(this->pilotNode, ES_GAME, KeyMapper::PEV_UP);
    624         EventHandler::getInstance()->subscribe(this->pilotNode, ES_GAME, KeyMapper::PEV_DOWN);
    625         EventHandler::getInstance()->subscribe(this->pilotNode, ES_GAME, KeyMapper::PEV_LEFT);
    626         EventHandler::getInstance()->subscribe(this->pilotNode, ES_GAME, KeyMapper::PEV_RIGHT);
    627         EventHandler::getInstance()->subscribe(this->pilotNode, ES_GAME, EV_MOUSE_MOTION);
    628 
    629         /*
    630         PNode* tn = TrackManager::getInstance()->getTrackNode();
    631         tn->addChild(this->localPlayer);
    632         this->localCamera->lookAt(tn);
    633 
    634         tn->addChild(this->localCamera);
    635         this->localPlayer->setParentMode(PNODE_ALL);
    636         TrackManager::getInstance()->condition(2, LEFTRIGHT, this->localPlayer);
    637         */
    638471        this->glmis->step();
    639472        break;
     
    663496{
    664497  this->bPause = false;
    665   this->pilotNode = NULL;
    666498
    667499  /* update the object position before game start - so there are no wrong coordinates used in the first processing */
     
    838670void World::handleInput ()
    839671{
    840   // localinput
    841   //CommandNode* cn = Orxonox::getInstance()->getLocalInput();
    842   //cn->process();
    843 
    844672  EventHandler::getInstance()->process();
    845673
     
    893721
    894722      /* update tick the rest */
    895       TrackManager::getInstance()->tick(this->dtS);
    896723      this->localCamera->tick(this->dtS);
    897724      // tick the engines
  • branches/powerups/src/story_entities/world.h

    r5429 r5955  
    1616class Camera;
    1717class Player;
    18 class PNode;
    1918class GLMenuImageScreen;
    2019class Terrain;
     
    2221class Text;
    2322class TiXmlElement;
    24 class PilotNode;
    2523
    2624class Shell;
     
    121119    tList<WorldEntity>* entities;       //!< A template List of all entities. Every moving thing should be included here, and world automatically updates them.
    122120    Player* localPlayer;                //!< The Player, you fly through the level.
    123     PilotNode* pilotNode;               //!< THe pilot node to fly with the mouse
    124 
    125 
    126121};
    127122
  • branches/powerups/src/subprojects/framework.cc

    r5819 r5955  
    2424#include "resource_manager.h"
    2525#include "camera.h"
    26 #include "ini_parser.h"
     26#include "parser/ini_parser/ini_parser.h"
    2727#include "globals.h"
    2828
  • branches/powerups/src/subprojects/importer/Makefile.am

    r5750 r5955  
    66importer_LDFLAGS = $(MWINDOWS)
    77
    8 bin_PROGRAMS = importer
     8bin_PROGRAMS = importer \
     9               multitex
    910
    1011importer_LDADD = $(MAINSRCDIR)/lib/event/libORXevent.a \
     
    3233                  $(MAINSRCDIR)/lib/util/color.cc \
    3334                  $(MAINSRCDIR)/lib/util/multi_type.cc \
     35                  $(MAINSRCDIR)/lib/util/executor/executor.cc \
    3436                  $(MAINSRCDIR)/util/loading/factory.cc
     37
     38
     39multitex_LDADD = $(MAINSRCDIR)/lib/event/libORXevent.a \
     40                 $(MAINSRCDIR)/lib/tinyxml/libtinyxml.a \
     41                 $(MAINSRCDIR)/lib/graphics/libORXgraphics.a \
     42                 $(MAINSRCDIR)/lib/shell/libORXshell.a \
     43                 $(MAINSRCDIR)/lib/sound/libORXsound.a \
     44                 $(MAINSRCDIR)/lib/graphics/importer/libORXimporter.a
     45
     46multitex_SOURCES= ../framework.cc \
     47                  multitex.cc \
     48                  $(MAINSRCDIR)/util/state.cc \
     49                  $(MAINSRCDIR)/world_entities/camera.cc \
     50                  $(MAINSRCDIR)/lib/lang/base_object.cc \
     51                  $(MAINSRCDIR)/lib/lang/class_list.cc \
     52                  $(MAINSRCDIR)/lib/math/vector.cc \
     53                  $(MAINSRCDIR)/util/loading/resource_manager.cc \
     54                  $(MAINSRCDIR)/lib/util/ini_parser.cc \
     55                  $(MAINSRCDIR)/lib/coord/p_node.cc \
     56                  $(MAINSRCDIR)/lib/coord/null_parent.cc \
     57                  $(MAINSRCDIR)/util/loading/load_param.cc \
     58                  $(MAINSRCDIR)/util/loading/load_param_description.cc \
     59                  $(MAINSRCDIR)/lib/util/helper_functions.cc \
     60                  $(MAINSRCDIR)/lib/util/substring.cc \
     61                  $(MAINSRCDIR)/lib/util/color.cc \
     62                  $(MAINSRCDIR)/lib/util/multi_type.cc \
     63                  $(MAINSRCDIR)/lib/util/executor/executor.cc \
     64                  $(MAINSRCDIR)/util/loading/factory.cc
  • branches/powerups/src/util/loading/factory.h

    r5750 r5955  
    2525class BaseObject;
    2626
    27 #include "tinyxml.h"
     27#include "parser/tinyxml/tinyxml.h"
    2828#include "base_object.h"
    2929#include "debug.h"
  • branches/powerups/src/util/loading/resource_manager.cc

    r5483 r5955  
    3333#endif /* NO_TEXT */
    3434#ifndef NO_AUDIO
    35 #include "sound_engine.h"
     35#include "sound_buffer.h"
    3636#include "ogg_player.h"
    3737#endif /* NO_AUDIO */
  • branches/powerups/src/util/track/track_manager.cc

    r5767 r5955  
    2828
    2929
    30 #include "tinyxml.h"
     30#include "parser/tinyxml/tinyxml.h"
    3131#include "substring.h"
    3232
  • branches/powerups/src/world_entities/Makefile.am

    r5750 r5955  
    77                  world_entity.cc \
    88                  camera.cc \
    9                   player.cc \
     9                  playable.cc \
     10                  player.cc \
    1011                  npc.cc \
    1112                  npc2.cc \
     
    1718                  character_attributes.cc \
    1819                  test_entity.cc \
     20                  space_ships/space_ship.cc \
    1921                  weapons/weapon_manager.cc \
    2022                  weapons/weapon.cc \
     
    3537                 world_entity.h \
    3638                 camera.h \
    37                  player.h \
     39                 playable.h \
     40                 player.h \
    3841                 npc.h \
    3942                 npc2.h \
     
    4548                 character_attributes.h \
    4649                 test_entity.h \
     50                 space_ships/space_ship.h \
    4751                 weapons/weapon_manager.h \
    4852                 weapons/weapon.h \
  • branches/powerups/src/world_entities/player.cc

    r5767 r5955  
    1010
    1111   ### File Specific:
    12    main-programmer: Patrick Boenzli
    13    co-programmer: Christian Meyer
     12   main-programmer: Silvan Nellen
     13   co-programmer: Benjamin Knecht
    1414*/
    1515
    16 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
    17 
    18 
    19 #include "executor/executor.h"
    2016#include "player.h"
    21 
    22 #include "track_manager.h"
    23 #include "objModel.h"
    24 #include "resource_manager.h"
    25 #include "factory.h"
    26 
    27 #include "weapons/weapon_manager.h"
    28 #include "weapons/test_gun.h"
    29 #include "weapons/turret.h"
    30 #include "weapons/cannon.h"
    31 
    32 #include "list.h"
     17#include "playable.h"
    3318
    3419#include "event_handler.h"
    3520
    36 #include "event.h"
    37 
    3821using namespace std;
    3922
    40 CREATE_FACTORY(Player, CL_PLAYER);
    4123
    4224/**
    4325 * creates a new Player
    44  * @param isFree if the player is free
    4526*/
    4627Player::Player()
     
    4930}
    5031
    51 /**
    52  * loads a Players information from a specified file.
    53  * @param fileName the name of the File to load the player from (absolute path)
    54  */
    55 Player::Player(const char* fileName)
    56 {
    57   this->init();
    58   TiXmlDocument doc(fileName);
    59 
    60   if(!doc.LoadFile())
    61   {
    62     PRINTF(2)("Loading file %s failed for player.\n", fileName);
    63     return;
    64   }
    65 
    66   this->loadParams(doc.RootElement());
    67 }
    68 
    69 /**
    70  *  creates a new Player from Xml Data
    71  * @param root the xml element containing player data
    72 
    73    @todo add more parameters to load
    74 */
    75 Player::Player(const TiXmlElement* root)
    76 {
    77   this->init();
    78   if (root != NULL)
    79     this->loadParams(root);
    80 
    81   //weapons:
    82   Weapon* wpRight = new TestGun(0);
    83   wpRight->setName("testGun Right");
    84   Weapon* wpLeft = new TestGun(1);
    85   wpLeft->setName("testGun Left");
    86   Weapon* cannon = dynamic_cast<Weapon*>(Factory::getFirst()->fabricate(CL_CANNON));
    87 
    88   cannon->setName("BFG");
    89 
    90   this->weaponMan->addWeapon(wpLeft, 1, 0);
    91   this->weaponMan->addWeapon(wpRight,1 ,1);
    92   this->weaponMan->addWeapon(cannon, 0, 6);
    93 
    94   //this->weaponMan->addWeapon(turret, 3, 0);
    95 
    96   this->weaponMan->changeWeaponConfig(1);
    97 }
    9832
    9933/**
     
    10236Player::~Player ()
    10337{
    104   /* do not delete the weapons, they are contained in the pnode tree
    105   and will be deleted there.
    106   this only frees the memory allocated to save the list.
    107   */
    108   delete this->weaponMan;
    10938}
    11039
    111 //#include "glgui_pushbutton.h"
    11240
    11341/**
     
    12048
    12149  PRINTF(4)("PLAYER INIT\n");
    122   travelSpeed = 15.0;
    123   bUp = bDown = bLeft = bRight = bAscend = bDescend = false;
    124   bFire = false;
    125   acceleration = 10.0;
    12650
    127 //   GLGuiButton* button = new GLGuiPushButton();
    128 //   button->show();
    129 //   button->setLabel("orxonox");
    130 //   button->setBindNode(this);
    131 
    132   this->weaponMan = new WeaponManager(this);
    133   this->weaponMan->setSlotCount(7);
    134 
    135   this->weaponMan->setSlotPosition(0, Vector(-2.6, .1, -3.0));
    136   this->weaponMan->setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    137 
    138   this->weaponMan->setSlotPosition(1, Vector(-2.6, .1, 3.0));
    139   this->weaponMan->setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    140 
    141   this->weaponMan->setSlotPosition(2, Vector(-1.5, .5, -.5));
    142   this->weaponMan->setSlotDirection(2, Quaternion(-M_PI_4*.5, Vector(1,0,0)));
    143 
    144   this->weaponMan->setSlotPosition(3, Vector(-1.5, .5, .5));
    145   this->weaponMan->setSlotDirection(3, Quaternion(M_PI_4*.5, Vector(1,0,0)));
    146 
    147   this->weaponMan->setSlotPosition(4, Vector(-1.5, -.5, .5));
    148   this->weaponMan->setSlotDirection(4, Quaternion(-M_PI_4*.5+M_PI, Vector(1,0,0)));
    149 
    150   this->weaponMan->setSlotPosition(5, Vector(-1.5, -.5, -.5));
    151   this->weaponMan->setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0)));
    152 //
    153    this->weaponMan->setSlotPosition(6, Vector(-1, 0.0, 0));
    154    this->weaponMan->setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    155    //
    156 //   this->weaponMan->setSlotPosition(8, Vector(-2.5, -0.3, -2.0));
    157 //   this->weaponMan->setSlotDirection(8, Quaternion(-M_PI, Vector(1,0,0)));
    158 //
    159 //   this->weaponMan->setSlotPosition(9, Vector(-2.5, -0.3, 2.0));
    160 //   this->weaponMan->setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));:
    161 
     51  this->controllable = NULL;
    16252}
    16353
    16454
    165 /**
    166  * loads the Settings of a Player from an XML-element.
    167  * @param root the XML-element to load the Player's properties from
    168  */
    169 void Player::loadParams(const TiXmlElement* root)
     55bool Player::setControllable(Playable* controllable)
    17056{
    171   static_cast<WorldEntity*>(this)->loadParams(root);
    172 
    173 
    174 
     57  if(controllable != NULL && controllable->subscribePlayer(this))
     58  {
     59      this->controllable = controllable;
     60      return true;
     61  }
     62  else
     63    return false;
    17564}
    17665
    177 /**
    178  * adds a weapon to the weapon list of player
    179  * @param weapon to add
    180 */
    181 void Player::addWeapon(Weapon* weapon)
    182 {
    183   this->weaponMan->addWeapon(weapon);
    184 }
     66bool Player::disconnectControllable()
     67 {
     68   if(this->controllable == NULL) return true;
    18569
     70   if(this->controllable->unsubscribePlayer(this))
     71   {
     72     this->controllable = NULL;
     73     return true;
     74   }
     75   else
     76     return false;
     77 }
    18678
    187 /**
    188  *  removes a weapon from the player
    189  * @param weapon to remove
    190 */
    191 void Player::removeWeapon(Weapon* weapon)
    192 {
    193   this->weaponMan->removeWeapon(weapon);
    194 }
     79 void Player::process(const Event &event)
     80 {
     81   if (likely(this->controllable != NULL))
     82     this->controllable->process(event);
     83 }
    19584
    196 
    197 /**
    198  *  effect that occurs after the player is spawned
    199 */
    200 void Player::postSpawn ()
    201 {
    202   //setCollision(new CollisionCluster(1.0, Vector(0,0,0)));
    203 }
    204 
    205 
    206 /**
    207  *  the action occuring if the player left the game
    208 */
    209 void Player::leftWorld ()
    210 {}
    211 
    212 
    213 WorldEntity* ref = NULL;
    214 /**
    215  *  this function is called, when two entities collide
    216  * @param entity: the world entity with whom it collides
    217  *
    218  * Implement behaviour like damage application or other miscellaneous collision stuff in this function
    219  */
    220 void Player::collidesWith(WorldEntity* entity, const Vector& location)
    221 {
    222   if (entity->isA(CL_TURRET_POWER_UP) && entity != ref)
    223   {
    224     this->ADDWEAPON();
    225     ref = entity;
    226     }
    227 //  PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassName(), entity->getClassName(), location.x, location.y, location.z);
    228 }
    229 
    230 /**
    231  *  draws the player after transforming him.
    232 */
    233 void Player::draw () const
    234 {
    235   glMatrixMode(GL_MODELVIEW);
    236   glPushMatrix();
    237   /* translate */
    238   glTranslatef (this->getAbsCoor ().x,
    239                 this->getAbsCoor ().y,
    240                 this->getAbsCoor ().z);
    241   /* rotate */
    242   Vector tmpRot = this->getAbsDir().getSpacialAxis();
    243   glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    244   this->model->draw();
    245   glPopMatrix();
    246 
    247   this->weaponMan->draw();
    248 
    249   //this->debug(0);
    250 }
    251 
    252 
    253 /**
    254  *  the function called for each passing timeSnap
    255  * @param time The timespan passed since last update
    256 */
    257 void Player::tick (float time)
    258 {
    259   // player controlled movement
    260   this->move(time);
    261 
    262   this->weaponMan->tick(time);
    263   // weapon system manipulation
    264   this->weaponAction();
    265 }
    266 
    267 
    268 /**
    269  *  action if player moves
    270  * @param time the timeslice since the last frame
    271 */
    272 void Player::move (float time)
    273 {
    274   Vector accel(0.0, 0.0, 0.0);
    275   Vector rot(0.0, 0.0, 0.0);
    276   float rotVal = 0.0;
    277   /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */
    278   /* calculate the direction in which the craft is heading  */
    279   Vector direction (1.0, 0.0, 0.0);
    280   //direction = this->absDirection.apply (direction);
    281   Vector orthDirection (0.0, 0.0, 1.0);
    282   //orthDirection = orthDirection.cross (direction);
    283 
    284   if( this->bUp && this->getRelCoor().x < 20)
    285     accel += direction;
    286   if( this->bDown && this->getRelCoor().x > -5)
    287     accel -= direction;
    288 
    289   if( this->bLeft && TrackManager::getInstance()->getWidth() > -this->getRelCoor().z*2)
    290   {
    291     accel -=(orthDirection);
    292     rot +=Vector(1,0,0);
    293     rotVal -= .4;
    294   }
    295   if( this->bRight && TrackManager::getInstance()->getWidth() > this->getRelCoor().z*2)
    296   {
    297     accel += orthDirection;
    298     rot += Vector(1,0,0);
    299     rotVal += .4;
    300   }
    301   if (this->bAscend )
    302   {
    303     accel += Vector(0,1,0);
    304     rot += Vector(0,0,1);
    305     rotVal += .4;
    306   }
    307   if (this->bDescend )
    308   {
    309     accel -= Vector(0,1,0);
    310     rot += Vector(0,0,1);
    311     rotVal -= .4;
    312   }
    313 
    314   Vector move = accel * time *acceleration;
    315 
    316 /*  if (accel.z < 0)
    317     this->setRelDirSoft(Quaternion(-.4, accel), 5);
    318   else if (accel.z > 0)
    319     this->setRelDirSoft(Quaternion(.4, accel), 5);
    320   else*/
    321   rot.normalize();
    322   this->setRelDirSoft(Quaternion(rotVal, rot), 5);
    323   this->shiftCoor (move);
    324 }
    325 
    326 
    327 /**
    328  * weapon manipulation by the player
    329 */
    330 void Player::weaponAction()
    331 {
    332   if( this->bFire)
    333     {
    334       this->weaponMan->fire();
    335     }
    336 }
    337 
    338 /**
    339  * @todo switch statement ??
    340  */
    341 void Player::process(const Event &event)
    342 {
    343   if( event.type == KeyMapper::PEV_UP)
    344       this->bUp = event.bPressed;
    345   else if( event.type == KeyMapper::PEV_DOWN)
    346       this->bDown = event.bPressed;
    347   else if( event.type == KeyMapper::PEV_RIGHT)
    348       this->bRight= event.bPressed;
    349   else if( event.type == KeyMapper::PEV_LEFT)
    350       this->bLeft = event.bPressed;
    351   else if( event.type == KeyMapper::PEV_FIRE1)
    352       this->bFire = event.bPressed;
    353   else if( event.type == KeyMapper::PEV_NEXT_WEAPON && event.bPressed)
    354     this->weaponMan->nextWeaponConfig();//if( !event.bPressed) this->bWeaponChange = !this->bWeaponChange;
    355   else if ( event.type == KeyMapper::PEV_PREVIOUS_WEAPON && event.bPressed)
    356     this->weaponMan->previousWeaponConfig();
    357 
    358   else if( event.type == SDLK_PAGEUP)
    359     this->bAscend = event.bPressed; //this->shiftCoor(0,.1,0);
    360   else if( event.type == SDLK_PAGEDOWN)
    361     this->bDescend = event.bPressed; //this->shiftCoor(0,-.1,0);
    362 }
    363 
    364 #include "weapons/aiming_turret.h"
    365 // FIXME THIS MIGHT BE CONSIDERED EITHER A FEATURE, OR A BUG
    366 void Player::ADDWEAPON()
    367 {
    368   Weapon* turret = NULL;
    369 
    370   if ((float)rand()/RAND_MAX < .1)
    371   {
    372     //if (this->weaponMan->hasFreeSlot(2, WTYPE_TURRET))
    373     {
    374       turret = new Turret();
    375       this->weaponMan->addWeapon(turret, 2);
    376       this->weaponMan->changeWeaponConfig(2);
    377     }
    378   }
    379   else
    380   {
    381     //if (this->weaponMan->hasFreeSlot(3))
    382     {
    383       turret = new AimingTurret();
    384       this->weaponMan->addWeapon(turret, 3);
    385 
    386       this->weaponMan->changeWeaponConfig(3);
    387     }
    388   }
    389 
    390   if(turret != NULL)
    391   {
    392     turret->setName("Turret");
    393     turret->setStateDuration(WS_SHOOTING, (float)rand()/RAND_MAX*.5+.1);
    394   }
    395 }
  • branches/powerups/src/world_entities/player.h

    r5500 r5955  
    77#define _PLAYER_H
    88
    9 #include "world_entity.h"
    10 #include "physics_interface.h"
    119#include "event_listener.h"
    1210
    13 template<class T> class tList;
    14 class Weapon;
    15 class WeaponManager;
    16 class Vector;
    17 class Event;
     11/* Forward Declaration */
     12class Playable;
    1813
    1914//! Basic controllable WorldEntity
     
    2318     the player.cc for debug also
    2419*/
    25 class Player : public WorldEntity, public EventListener
     20class Player : public EventListener
    2621{
    27   friend class World;
    2822
    2923  public:
    3024    Player();
    31     Player(const char* fileName);
    32     Player(const TiXmlElement* root);
    3325    virtual ~Player();
    3426
    35     void init();
    36     void loadParams(const TiXmlElement* root);
     27    bool              setControllable(Playable* controllalble);
     28    inline Playable*  getControllable() { return this->controllable; };
    3729
    38     void addWeapon(Weapon* weapon);
    39     void removeWeapon(Weapon* weapon);
     30    bool              disconnectControllable();
    4031
    41     virtual void postSpawn();
    42     virtual void leftWorld();
     32    // eventListener extension.
     33    virtual void      process(const Event &event);
    4334
    44     virtual void collidesWith(WorldEntity* entity, const Vector& location);
    45     virtual void tick(float time);
    46     virtual void draw() const;
    47 
    48     virtual void process(const Event &event);
     35  private:
     36    void              init();
    4937
    5038
    5139  private:
    52     void move(float time);
    53     void weaponAction();
    54 
    55     // !! temporary !!
    56     void ADDWEAPON();
    57 
    58   private:
    59     bool                  bUp;                //!< up button pressed.
    60     bool                  bDown;              //!< down button pressed.
    61     bool                  bLeft;              //!< left button pressed.
    62     bool                  bRight;             //!< right button pressed.
    63     bool                  bAscend;            //!< ascend button pressed.
    64     bool                  bDescend;           //!< descend button presses.
    65     bool                  bFire;              //!< fire button pressed.
    66 
    67     WeaponManager*        weaponMan;          //!< the weapon manager: managing a list of weapon to wepaon-slot mapping
    68 
    69     Vector                velocity;           //!< the velocity of the player.
    70     float                 travelSpeed;        //!< the current speed of the player (to make soft movement)
    71     float                 acceleration;       //!< the acceleration of the player.
     40    Playable*         controllable;                  //!< The one we controll or NULL if none
    7241};
    7342
  • branches/powerups/src/world_entities/power_ups/laser_power_up.cc

    r5750 r5955  
    7979{
    8080 // PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassName(), entity->getClassName(), location.x, location.y, location.z);
    81  if (entity->isA(CL_PLAYER))
     81 if (entity->isA(CL_PLAYABLE))
    8282  State::getWorldEntityList()->remove(this);
    8383}
  • branches/powerups/src/world_entities/power_ups/turret_power_up.cc

    r5750 r5955  
    7979{
    8080 // PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassName(), entity->getClassName(), location.x, location.y, location.z);
    81  if (entity->isA(CL_PLAYER))
     81 if (entity->isA(CL_PLAYABLE))
    8282  State::getWorldEntityList()->remove(this);
    8383}
  • branches/powerups/src/world_entities/weapons/aiming_turret.cc

    r5819 r5955  
    2626
    2727#include "animation3d.h"
    28 #include "sound_engine.h"
    2928
    3029#include "factory.h"
     
    9392
    9493  this->setCapability(WTYPE_ALLDIRS | WTYPE_TURRET);
    95   this->setProjectileType(CL_ROCKET);
     94  this->setProjectileType(CL_GUIDED_MISSILE);
    9695
    9796
     
    142141    return;
    143142
    144     pj->setVelocity(/*this->getVelocity()+*/(this->getAbsDir().apply(Vector(1,0,0))*250.0 + VECTOR_RAND(13)
     143  pj->setVelocity(/*this->getVelocity()+*/(this->getAbsDir().apply(Vector(1,0,0))*250.0 + VECTOR_RAND(13)
    145144            /*target->getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity());
    146145
     146  pj->setTarget(this->target->getParent());
    147147  pj->setParent(NullParent::getInstance());
    148148  pj->setAbsCoor(this->getEmissionPoint());
  • branches/powerups/src/world_entities/weapons/cannon.cc

    r5828 r5955  
    3232#include "list.h"
    3333#include "animation3d.h"
    34 #include "sound_engine.h"
    3534
    3635#include "null_parent.h"
  • branches/powerups/src/world_entities/weapons/ground_turret.cc

    r5819 r5955  
    145145void GroundTurret::collidesWith (WorldEntity* entity, const Vector& location)
    146146{
    147 
     147  if (entity->isA(CL_PROJECTILE))
     148    this->setAbsDirSoft(Quaternion(-90, Vector(0,0,1)), 90);
    148149}
    149150
  • branches/powerups/src/world_entities/weapons/guided_missile.cc

    r5779 r5955  
    4848  this->energyMin = 1;
    4949  this->energyMax = 10;
    50   this->lifeSpan = 5;
    51   this->agility = 5;
     50  this->lifeSpan = 5.0;
     51  this->agility = 5.0;
    5252  this->maxVelocity = 100;
    5353
  • branches/powerups/src/world_entities/weapons/test_gun.cc

    r5819 r5955  
    3232#include "list.h"
    3333#include "animation3d.h"
    34 #include "sound_engine.h"
    3534
    3635#include "null_parent.h"
  • branches/powerups/src/world_entities/weapons/turret.cc

    r5819 r5955  
    2626#include "list.h"
    2727#include "animation3d.h"
    28 #include "sound_engine.h"
    2928
    3029#include "factory.h"
  • branches/powerups/src/world_entities/weapons/weapon.cc

    r5750 r5955  
    2828#include "load_param.h"
    2929#include "state.h"
    30 #include "sound_engine.h"
    3130#include "animation3d.h"
    3231#include "vector.h"
     32
     33#include "sound_source.h"
     34#include "sound_buffer.h"
    3335
    3436////////////////////
  • branches/powerups/src/world_entities/weapons/weapon_manager.cc

    r5779 r5955  
    110110  this->crossHairSizeAnim->addKeyFrame(100, .05, ANIM_LINEAR);
    111111  this->crossHairSizeAnim->addKeyFrame(50, .01, ANIM_LINEAR);
    112 
    113   this->targetIterator = NULL;
    114112}
    115113
     
    337335    }
    338336  }
    339 }
    340 
    341 
    342 /**
    343  * Selects an Entity from the NPC-list, and returns the Target
    344  */
    345 PNode* WeaponManager::getSomeTarget()
    346 {
    347    if (this->targetIterator == NULL)
    348    {
    349      std::list<BaseObject*>* npcList = ClassList::getList(CL_NPC);
    350      if (npcList != NULL)
    351      {
    352        this->targetIterator = npcList->begin();
    353      }
    354      else
    355        return NULL;
    356    }
    357 
    358    ///FIXME
    359 //   this->targetIterator++;
    360    PNode* retNode = dynamic_cast<PNode*>((*targetIterator));
    361 //   if (retNode == NULL && this->targetIterator->getList()->getSize() > 0)
    362 //     retNode =  dynamic_cast<PNode*>(targetIterator->firstElement());
    363 
    364    return retNode;
    365 }
    366 
    367 
    368 /**
    369  * Selects an Entity from the Entity-List, that is near of the carrier PNode.
    370  * @param carrier: The PNode from which the distance should be measured
    371  * @param distance: The Maximum Distance to Return.
    372  */
    373 PNode* WeaponManager::getDistanceTarget(const PNode* carrier, float distance)
    374 {
    375   std::list<BaseObject*>* npcList = ClassList::getList(CL_NPC);
    376   if (npcList != NULL)
    377   {
    378     list<BaseObject*>::iterator node;
    379     for (node= npcList->begin(); node != npcList->end(); node++)
    380       if ((carrier->getAbsCoor() - dynamic_cast<PNode*>(*node)->getAbsCoor()).len() < distance)
    381         return dynamic_cast<PNode*>(*node);
    382   }
    383   return this->getFixedTarget();
    384337}
    385338
  • branches/powerups/src/world_entities/weapons/weapon_manager.h

    r5779 r5955  
    8080    /** @returns a fixed target namely the Crosshair's 3D position */
    8181    inline PNode* getFixedTarget() const { return this->crosshair; };
    82     PNode* getSomeTarget();
    83     PNode* getDistanceTarget(const PNode* carrier, float distance);
    8482
    8583    void fire();
     
    109107    Crosshair*              crosshair;                                //!< an aim.
    110108    tAnimation<Crosshair>*  crossHairSizeAnim;                        //!< An animation for the crosshair (scaling)
    111 
    112     std::list<BaseObject*>::iterator  targetIterator;                           //!< An iterator for traversion lists of enemies.
    113109};
Note: See TracChangeset for help on using the changeset viewer.