Changeset 5955 in orxonox.OLD for branches/powerups/src/lib
- Timestamp:
- Dec 7, 2005, 1:05:10 PM (19 years ago)
- Location:
- branches/powerups/src/lib
- Files:
-
- 3 deleted
- 36 edited
- 16 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/powerups/src/lib/Makefile.am
r5822 r5955 15 15 network/libORXnet.a \ 16 16 graphics/spatial_separation/libORXquadtree.a \ 17 tinyxml/libtinyxml.a \ 17 parser/tinyxml/libtinyxml.a \ 18 parser/ini_parser/libIniParser.a \ 18 19 shell/libORXshell.a 19 20 … … 29 30 network/libORXnet.a \ 30 31 graphics/spatial_separation/libORXquadtree.a \ 31 tinyxml/libtinyxml.a \32 32 shell/libORXshell.a \ 33 33 $(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS) … … 37 37 lang/base_object.cc \ 38 38 lang/class_list.cc \ 39 util/ini_parser.cc \40 39 util/substring.cc \ 41 40 util/color.cc \ … … 53 52 graphics/render2D/render_2d.h \ 54 53 lang/class_list.h \ 55 util/ini_parser.h \56 54 util/substring.h \ 57 55 util/array.h \ … … 75 73 collision_detection \ 76 74 network \ 77 tinyxml\75 parser \ 78 76 shell \ 79 77 gui \ -
branches/powerups/src/lib/collision_detection/cd_engine.cc
r5134 r5955 24 24 #include "world_entity.h" 25 25 #include "terrain.h" 26 #include "player.h"26 // #include "player.h" 27 27 28 28 #include "spatial_separation.h" … … 119 119 Quadtree* q = this->terrain->ssp->getQuadtree(); 120 120 121 QuadtreeNode* n = q->getQuadtreeFromPosition(this->player->getAbsCoor());121 // QuadtreeNode* n = q->getQuadtreeFromPosition(this->player->getAbsCoor()); 122 122 } 123 123 //sTriangleExt* tri = q->getTriangleFromPosition(this->player->getAbsCoor()); -
branches/powerups/src/lib/collision_detection/cd_engine.h
r5039 r5955 17 17 class OBBTree; 18 18 class Terrain; 19 class Player;19 //class Player; 20 20 21 21 … … 51 51 inline void setEntityList(tList<WorldEntity>* entityList) { this->entityList = entityList; } 52 52 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*/ 54 54 55 55 void drawBV(int depth, int drawMode) const; … … 79 79 80 80 Terrain* terrain; //!< this it a ref to the terrain, serving as a ground for all WE 81 Player* player;81 // Player* player; 82 82 }; 83 83 -
branches/powerups/src/lib/coord/p_node.cc
r5819 r5955 428 428 429 429 this->bias = bias; 430 this->bRelDirChanged = true; 430 431 } 431 432 … … 836 837 glEnd(); 837 838 } 839 838 840 /* if we want to draw the children too */ 839 841 if (depth == 0) /* -> all of them */ -
branches/powerups/src/lib/coord/p_node.h
r5770 r5955 76 76 inline const Vector& getRelCoor () const { return this->prevRelCoordinate; }; 77 77 /** @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; }; 79 79 void setAbsCoor (const Vector& absCoord); 80 80 void setAbsCoor (float x, float y, float z); … … 93 93 inline const Quaternion& getRelDir () const { return this->prevRelDirection; }; 94 94 /** @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; }; 96 96 /** @returns a Vector pointing into the relative Direction */ 97 97 inline Vector getRelDirV() const { return this->prevRelDirection.apply(Vector(0,1,0)); }; … … 100 100 void setAbsDirSoft(const Quaternion& absDirSoft, float bias = 1.0); 101 101 void setAbsDirSoft(float x, float y, float z, float bias = 1.0); 102 void shiftDir (const Quaternion& shift); 102 103 /** @returns the absolute Direction */ 103 104 inline const Quaternion& getAbsDir () const { return this->absDirection; }; 104 105 /** @returns a Vector pointing into the absolute Direction */ 105 106 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)); }; 107 113 108 114 /** @returns the Speed of the Node */ -
branches/powerups/src/lib/event/key_mapper.cc
r5474 r5955 21 21 #include "key_mapper.h" 22 22 23 #include "event_def.h" 24 23 25 #include "globals.h" 24 #include " ini_parser.h"26 #include "parser/ini_parser/ini_parser.h" 25 27 #include "key_names.h" 26 28 #include "debug.h" 29 27 30 28 31 using namespace std; … … 129 132 int* index; 130 133 131 iniParser-> getFirstVar();134 iniParser->firstVar(); 132 135 while(iniParser->getCurrentName()) 133 136 { … … 148 151 } 149 152 150 iniParser-> getFirstVar();153 iniParser->firstVar(); 151 154 while(iniParser->getCurrentName()) 152 155 { … … 191 194 { 192 195 if( index[0] == 0) 193 196 { 194 197 *map[i].pValue = index[1]; 195 198 PRINTF(4)("Mapping %s to '%s' (id %i)\n", name, SDLKToKeyname(index[1]), index[1]); 196 199 break; 197 198 else { 200 } 201 else { 199 202 *map[i].pValue = index[1]; 200 203 PRINTF(4)("Mapping %s to '%s' (id %i)\n", name, SDLBToButtonname(index[1]), index[1]); 201 204 break; 202 205 } 203 206 } 204 207 } -
branches/powerups/src/lib/event/key_mapper.h
r5819 r5955 10 10 11 11 #include "base_object.h" 12 #include "event_def.h"12 //#include "event_def.h" 13 13 14 14 class IniParser; … … 66 66 67 67 private: 68 Sint32coord[2]; //!< temp place to save variables in nameToIndex() function68 int coord[2]; //!< temp place to save variables in nameToIndex() function 69 69 }; 70 70 -
branches/powerups/src/lib/graphics/graphics_engine.cc
r5819 r5955 26 26 #include "debug.h" 27 27 28 #include " ini_parser.h"28 #include "parser/ini_parser/ini_parser.h" 29 29 #include "substring.h" 30 30 #include "text.h" 31 31 32 32 #include "globals.h" 33 #include "texture.h" 33 34 34 35 #ifdef __WIN32__ 35 36 #include "class_list.h" 36 #include "texture.h"37 37 #include "list.h" 38 38 #include "model.h" … … 131 131 const char* textures = iniParser->getVar(CONFIG_NAME_TEXTURES, CONFIG_SECTION_VIDEO_ADVANCED, "0"); 132 132 if (strchr(textures, '1') || !strcasecmp(textures, "true")) 133 this->texturesEnabled = true;133 Texture::setTextureEnableState( true); 134 134 else 135 this->texturesEnabled = false;135 Texture::setTextureEnableState(false); 136 136 137 137 // searching for a usefull resolution … … 365 365 366 366 /** 367 * if Textures should be enabled368 */369 bool GraphicsEngine::texturesEnabled = true;370 371 /**372 367 * 373 368 * @param show if The mouse-cursor should be visible -
branches/powerups/src/lib/graphics/graphics_engine.h
r5366 r5955 83 83 84 84 public: 85 static bool texturesEnabled; //!< if textures should be enabled (globally)86 87 85 88 86 private: -
branches/powerups/src/lib/graphics/importer/Makefile.am
r5463 r5955 9 9 md2Model.cc \ 10 10 material.cc \ 11 texture.cc 11 texture.cc \ 12 texture_sequence.cc 12 13 13 14 … … 20 21 material.h \ 21 22 texture.h \ 23 texture_sequence.h \ 22 24 anorms.h \ 23 25 anormtab.h -
branches/powerups/src/lib/graphics/importer/material.h
r5405 r5955 51 51 static void addTexturePath(const char* pathName); 52 52 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. 60 60 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. 64 64 }; 65 65 #endif -
branches/powerups/src/lib/graphics/importer/texture.cc
r5790 r5955 19 19 20 20 #include "debug.h" 21 #include "graphics_engine.h" 22 21 22 // INCLUDING SDL_Image 23 23 #ifdef HAVE_SDL_IMAGE_H 24 24 #include <SDL_image.h> … … 45 45 } 46 46 47 47 48 /** 48 49 * Destructor of a Texture … … 65 66 bool Texture::loadImage(const char* imageName) 66 67 { 67 if ( GraphicsEngine::texturesEnabled)68 if (Texture::texturesEnabled) 68 69 { 69 70 if (this->image != NULL) … … 80 81 { 81 82 SDL_Surface* tmpSurf; 82 if (this->texture )83 if (this->texture != 0 && glIsTexture(this->texture)) 83 84 glDeleteTextures(1, &this->texture); 84 85 // load the new Image to memory … … 87 88 { 88 89 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 91 99 SDL_FreeSurface(tmpSurf); 92 100 return true; … … 108 116 } 109 117 118 119 /** 120 * rebuilds the texture. 121 * reloads the Texture from Memory to OpenGL. 122 */ 110 123 bool Texture::rebuild() 111 124 { 112 125 if (this->texture != 0) 113 126 { 114 glDeleteTextures(1,&this->texture); 115 this->texture = 0; 127 if (glIsTexture(this->texture)) 128 glDeleteTextures(1,&this->texture); 129 this->setTexture(0); 116 130 } 117 131 … … 119 133 { 120 134 PRINTF(3)("Reloading Texture of %s '%s'\n", this->getClassName(), this->getName()); 121 this-> loadTexToGL();135 this->setTexture(loadTexToGL(this->image)); 122 136 } 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 */ 147 bool 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 158 bool Texture::texturesEnabled = true; 159 160 /** 161 * enables, disables textures 162 * @param texturesEnabled true if the textures should be enabled 163 */ 164 void Texture::setTextureEnableState(bool texturesEnabled) 165 { 166 Texture::texturesEnabled = texturesEnabled; 167 } 168 169 170 ////////////////////////////////////// 171 // UTILITY FUNCTIONALITY OF TEXTURE // 172 ////////////////////////////////////// 126 173 /** 127 174 * converts surface to a new SDL_Surface, that is loadable by openGL 128 175 * @param surface the Surface to convert 176 * @param hasAlpha if the newly created Surface has an alpha channel, true is returned otherwise false. 129 177 * @returns a !!new!! Surface, that is loadable by openGL. 130 178 */ 131 bool Texture::prepareSurface(SDL_Surface* surface)179 SDL_Surface* Texture::prepareSurface(SDL_Surface* surface, bool& hasAlpha) 132 180 { 133 181 PRINTF(4)("Loading texture to OpenGL-Environment.\n"); 134 182 135 SDL_Surface* putSurface;183 SDL_Surface* retSurface; 136 184 SDL_Rect area; 137 185 Uint32 saved_flags; 138 186 Uint8 saved_alpha; 139 187 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, 143 192 #if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */ 144 193 0x000000FF, … … 147 196 0xFF000000 148 197 #else 149 0xFF000000,198 0xFF000000, 150 199 0x00FF0000, 151 200 0x0000FF00, 152 201 0x000000FF 153 202 #endif 154 );155 if ( putSurface == NULL )203 ); 204 if ( retSurface == NULL ) 156 205 { 157 this->setSurface(NULL); 158 return false; 206 return NULL; 159 207 } 160 208 … … 171 219 area.w = surface->w; 172 220 area.h = surface->h; 173 SDL_BlitSurface(surface, &area, putSurface, &area);221 SDL_BlitSurface(surface, &area, retSurface, &area); 174 222 175 223 /* Restore the alpha blending attributes */ … … 177 225 { 178 226 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); 193 231 } 194 232 … … 199 237 * @returns The ID of the texture. 200 238 */ 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) 239 GLuint 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) 208 248 return 0; 209 249 210 250 /* Create an OpenGL texture for the image */ 211 glGenTextures(1, &t his->texture);212 glBindTexture(GL_TEXTURE_2D, t his->texture);251 glGenTextures(1, &texture); 252 glBindTexture(GL_TEXTURE_2D, texture); 213 253 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 214 254 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); … … 217 257 0, 218 258 GL_RGBA, 219 this->image->w, this->image->h,259 surface->w, surface->h, 220 260 0, 221 261 GL_RGBA, 222 262 GL_UNSIGNED_BYTE, 223 this->image->pixels);263 surface->pixels); 224 264 // build the MipMaps 225 265 gluBuild2DMipmaps(GL_TEXTURE_2D, 226 266 GL_RGBA, 227 this->image->w,228 this->image->h,267 surface->w, 268 surface->h, 229 269 GL_RGBA, 230 270 GL_UNSIGNED_BYTE, 231 this->image->pixels);271 surface->pixels); 232 272 glBindTexture(GL_TEXTURE_2D, 0); 233 return t his->texture;234 } 273 return texture; 274 } -
branches/powerups/src/lib/graphics/importer/texture.h
r5768 r5955 14 14 struct SDL_Surface; 15 15 16 //! an enumerator for different procedural texture-types17 typedef enum TEXTURE_TYPE { TEXTURE_RADIAL_ALIAS,18 TEXTURE_NOISE };19 20 16 //! A Class, that reads in Textures from different fileformats. 21 17 class Texture : public BaseObject … … 27 23 28 24 bool loadImage(const char* imageName); 29 bool rebuild();25 virtual bool rebuild(); 30 26 31 27 /** @returns The textureID of this texture. */ … … 33 29 /** @returns true if texture has alpha, false otherwise */ 34 30 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); 35 43 36 44 protected: 37 bool prepareSurface(SDL_Surface* input); 45 38 46 bool setSurface(SDL_Surface* newSurface); 47 bool setAlpha(bool hasAlpha) { this->bAlpha = hasAlpha; }; 48 bool setTexture(GLuint texture) { this->texture = texture; }; 39 49 40 GLuint loadTexToGL ();41 50 42 51 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. 46 57 }; 47 58 -
branches/powerups/src/lib/graphics/light.cc
r5750 r5955 22 22 #include "glincl.h" 23 23 #include "vector.h" 24 #include " tinyxml.h"24 #include "parser/tinyxml/tinyxml.h" 25 25 #include "load_param.h" 26 26 #include "factory.h" -
branches/powerups/src/lib/graphics/render2D/element_2d.cc
r5783 r5955 23 23 #include "graphics_engine.h" 24 24 #include "load_param.h" 25 #include " tinyxml.h"25 #include "parser/tinyxml/tinyxml.h" 26 26 #include "class_list.h" 27 27 -
branches/powerups/src/lib/graphics/text_engine/font.cc
r5768 r5955 181 181 this->fontTTF = NULL; 182 182 } 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 } 185 191 186 192 // initializing the Glyphs. … … 491 497 492 498 if (this->setSurface(tmpSurf)) 493 loadTexToGL();499 (this->setTexture(Texture::loadTexToGL(tmpSurf))); 494 500 } 495 501 -
branches/powerups/src/lib/graphics/text_engine/text_engine.cc
r5780 r5955 64 64 { 65 65 // 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); 67 67 if (textList != NULL) 68 68 { … … 71 71 } 72 72 // 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); 74 74 if (fontList != NULL) 75 75 { … … 124 124 void TextEngine::debug() const 125 125 { 126 list<BaseObject*>* textList = ClassList::getList(CL_TEXT);126 const list<BaseObject*>* textList = ClassList::getList(CL_TEXT); 127 127 if (textList != NULL) 128 128 { … … 132 132 PRINT(0)("Reference: %p; Text Counts: %d\n", this, textList->size()); 133 133 134 list<BaseObject*>:: iterator text;134 list<BaseObject*>::const_iterator text; 135 135 for ( text = textList->begin(); text != textList->end(); text++) 136 136 dynamic_cast<Text*>(*text)->debug(); -
branches/powerups/src/lib/gui/gtk_gui/gui_audio.cc
r5298 r5955 42 42 { 43 43 CheckButton* enableSound; //!< A Ckeckbutton for enabling Sound. 44 Slider* audioChannels; //!< A Slider for the count of audio-channels. 44 45 Slider* musicVolume; //!< A Slider for music volume. 45 46 Slider* effectsVolume; //!< A Slider for effects volume. … … 51 52 enableSound->saveability(); 52 53 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 53 64 Label* musicVolumeLabel = new Label(CONFIG_NAME_MUSIC_VOLUME); 54 65 audioBox->fill(musicVolumeLabel); … … 58 69 musicVolume->saveability(); 59 70 audioBox->fill (musicVolume); 71 60 72 Label* effectsVolumeLabel = new Label (CONFIG_NAME_EFFECTS_VOLUME); 61 73 audioBox->fill (effectsVolumeLabel); -
branches/powerups/src/lib/gui/gtk_gui/gui_exec.cc
r5241 r5955 27 27 28 28 #include "resource_manager.h" 29 #include " ini_parser.h"29 #include "parser/ini_parser/ini_parser.h" 30 30 31 31 #include <string.h> … … 254 254 255 255 /** 256 * Reads in Configuration Data.256 * @brief Reads in Configuration Data. 257 257 * @param widget from which Widget on should be saved. 258 258 */ … … 265 265 return; 266 266 267 iniParser. getFirstSection();267 iniParser.firstSection(); 268 268 Widget* groupWidget = widget; 269 269 const char* groupName; … … 272 272 while (groupName = iniParser.getCurrentSection()) 273 273 { 274 printf("GROUP:::%s\n", groupName); 274 275 if((groupWidget = locateGroup(widget, groupName, 1))==NULL) 275 {276 277 278 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 } 280 281 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; 287 290 varInfo.variableValue = iniParser.getCurrentValue(); 288 291 groupWidget->walkThrough(this->readFileText, &varInfo, 0); … … 303 306 { 304 307 VarInfo* info =(VarInfo*)varInfo; 308 if (info == NULL || info->variableName == NULL) 309 return; 310 305 311 if(widget->title && !strcmp(widget->title, info->variableName)) 306 312 { 307 313 PRINT(5)("Located Option %s.\n", widget->title); 308 314 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); 310 317 } 311 318 } … … 323 330 { 324 331 Widget* tmp; 332 if (widget == NULL || groupName == NULL) 333 return NULL; 325 334 326 335 if(widget->optionType < GUI_NOTHING) 327 336 { 328 if(static_cast<Packer*>(widget)->getGroupName() &&337 if(static_cast<Packer*>(widget)->getGroupName() != NULL && 329 338 !strcmp(groupName, static_cast<Packer*>(widget)->getGroupName())) 330 { 331 return widget; 332 } 339 return widget; 333 340 else 334 341 { 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) 336 344 return tmp; 337 345 } -
branches/powerups/src/lib/gui/gtk_gui/gui_keys.cc
r5766 r5955 119 119 pKeysBox->fill(addKey(CONFIG_NAME_PLAYER_LEFT, "LEFT")); 120 120 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")); 122 122 pKeysBox->fill(addKey(CONFIG_NAME_PLAYER_NEXT_WEAPON, "m")); 123 123 pKeysBox->fill(addKey(CONFIG_NAME_PLAYER_PREV_WEAPON, "n")); -
branches/powerups/src/lib/lang/base_object.cc
r5791 r5955 112 112 else if (classID & CL_MASK_SUBSUPER_CLASS) 113 113 { 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_ID 2))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)) 116 116 return true; 117 117 } -
branches/powerups/src/lib/lang/class_list.cc
r5822 r5955 133 133 * @return the List accessed by classID, or NULL if not found 134 134 */ 135 std::list<BaseObject*>* ClassList::getList(ClassID classID)135 const std::list<BaseObject*>* ClassList::getList(ClassID classID) 136 136 { 137 137 ClassList* fl; … … 156 156 * @return the List accessed by classID, or NULL if not found 157 157 */ 158 std::list<BaseObject*>* ClassList::getList(const char* className)158 const std::list<BaseObject*>* ClassList::getList(const char* className) 159 159 { 160 160 ClassList* fl; -
branches/powerups/src/lib/lang/class_list.h
r5821 r5955 40 40 static void removeFromClassList(BaseObject* objectPointer); 41 41 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; }; 44 44 static const std::list<const char*>* getClassNames(); 45 45 static BaseObject* getObject(const char* name, ClassID classID = CL_NULL); 46 46 static bool exists(const BaseObject* object, ClassID classID = CL_NULL); 47 48 void sendBack(std::list<BaseObject*>::const_iterator it); 47 49 48 50 static void whatIs(const BaseObject* object); … … 51 53 static long StringToID(const char* className); 52 54 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); 54 56 55 57 inline bool operator==(ClassID classID) { return (this->classID == classID); }; -
branches/powerups/src/lib/network/network_manager.cc
r5822 r5955 161 161 if (this->netStreamList != NULL || (this->netStreamList = ClassList::getList(CL_NETWORK_STREAM)) != NULL) 162 162 { 163 std::list<BaseObject*>:: iterator stream;163 std::list<BaseObject*>::const_iterator stream; 164 164 for (stream = this->netStreamList->begin(); stream != this->netStreamList->end(); ++stream) 165 165 static_cast<NetworkStream*>(*stream)->processData(); -
branches/powerups/src/lib/network/network_manager.h
r5822 r5955 41 41 42 42 private: 43 std::list<BaseObject*>* netStreamList; // list with refs to all network streams44 std::list<BaseObject*>* syncList; // list of synchronizeables43 const std::list<BaseObject*>* netStreamList; // list with refs to all network streams 44 const std::list<BaseObject*>* syncList; // list of synchronizeables 45 45 46 46 }; -
branches/powerups/src/lib/particles/particle_engine.h
r5447 r5955 12 12 #include "particle_emitter.h" 13 13 14 #include " tinyxml.h"14 #include "parser/tinyxml/tinyxml.h" 15 15 16 16 // FORWARD DECLARATION -
branches/powerups/src/lib/particles/particle_system.cc
r5750 r5955 30 30 #include "shell_command.h" 31 31 32 #include " tinyxml.h"32 #include "parser/tinyxml/tinyxml.h" 33 33 34 34 CREATE_FACTORY(ParticleSystem, CL_PARTICLE_SYSTEM); -
branches/powerups/src/lib/physics/physics_engine.cc
r5779 r5955 20 20 #include "class_list.h" 21 21 #include "list.h" 22 #include " tinyxml.h"22 #include "parser/tinyxml/tinyxml.h" 23 23 #include "factory.h" 24 24 #include "load_param.h" -
branches/powerups/src/lib/shell/shell_command.cc
r5791 r5955 159 159 long classID = CL_NULL; //< the classID retrieved from the Class. 160 160 ShellCommandClass* commandClass = NULL; //< the command class this command applies to. 161 std::list<BaseObject*>* objectList = NULL; //< the list of Objects stored in classID161 const std::list<BaseObject*>* objectList = NULL; //< the list of Objects stored in classID 162 162 BaseObject* objectPointer = NULL; //< a pointer to th Object to Execute the command on 163 163 bool emptyComplete = false; //< if the completion input is empty string. e.g "" -
branches/powerups/src/lib/shell/shell_completion.cc
r5791 r5955 58 58 59 59 long classID; //< the classID retrieved from the Class. 60 std::list<BaseObject*>* objectList; //< the list of Objects stored in classID60 const std::list<BaseObject*>* objectList; //< the list of Objects stored in classID 61 61 bool emptyComplete = false; //< if the completion input is empty string. e.g "" 62 62 long completeType = SHELLC_NONE; //< the Type we'd like to complete. -
branches/powerups/src/lib/sound/sound_buffer.cc
r5422 r5955 20 20 #include "sound_engine.h" 21 21 22 23 22 using namespace std; 24 25 23 26 24 ////////////////// … … 36 34 this->setName(fileName); 37 35 38 SoundEngine::getInstance()->addBuffer(this);39 40 36 ALenum format; 41 37 ALvoid* data; … … 47 43 alGenBuffers(1, &this->bufferID); 48 44 if ((result = alGetError()) != AL_NO_ERROR) 49 SoundEngine::PrintALErrorString(result);45 PRINTF(2)("%s\n", SoundEngine::getALErrorString(result)); 50 46 51 47 // read in the wav data … … 59 55 #endif 60 56 if ((result = alGetError()) != AL_NO_ERROR) 61 SoundEngine::PrintALErrorString(result);57 PRINTF(2)("%s\n", SoundEngine::getALErrorString(result)); 62 58 63 59 // send the loaded wav data to the buffer 64 60 alBufferData(this->bufferID, format, data, this->size, freq); 65 61 if ((result = alGetError()) != AL_NO_ERROR) 66 SoundEngine::PrintALErrorString(result);62 PRINTF(2)("%s\n", SoundEngine::getALErrorString(result)); 67 63 68 64 // remove the wav data (redundant) 69 65 alutUnloadWAV(format, data, this->size, freq); 70 66 if ((result = alGetError()) != AL_NO_ERROR) 71 SoundEngine::PrintALErrorString(result);67 PRINTF(2)("%s\n", SoundEngine::getALErrorString(result)); 72 68 } 73 69 -
branches/powerups/src/lib/sound/sound_engine.cc
r5871 r5955 27 27 #include "resource_manager.h" 28 28 #include "debug.h" 29 #include " ini_parser.h"29 #include "parser/ini_parser/ini_parser.h" 30 30 #include "globals.h" 31 31 … … 47 47 this->bufferList = NULL; 48 48 this->sourceList = NULL; 49 50 this->device = NULL; 51 this->context = NULL; 52 53 this->maxSourceCount = 32; 49 54 } 50 55 … … 64 69 while (this->sourceList->size() > 0) 65 70 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(); 66 77 } 67 78 … … 86 97 void SoundEngine::loadSettings(IniParser* iniParser) 87 98 { 99 const char* channels = iniParser->getVar(CONFIG_NAME_AUDIO_CHANNELS, CONFIG_SECTION_AUDIO, "32"); 100 this->maxSourceCount = atoi(channels); 88 101 const char* musicVolume = iniParser->getVar(CONFIG_NAME_MUSIC_VOLUME, CONFIG_SECTION_AUDIO, "80"); 89 102 this->musicVolume = atof(musicVolume)/100.0; … … 118 131 119 132 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); 133 void 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(); 144 147 } 145 148 } 146 149 } 147 150 148 /**149 * adds a SoundSource to the sourceList of the SoundEngine150 * @param source The source to add to the sourceList151 */152 void SoundEngine::addSource(SoundSource* source)153 {154 this->sourceList = ClassList::getList(CL_SOUND_SOURCE);155 }156 151 157 152 /** … … 180 175 181 176 // 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; 185 180 SoundSource* source; 186 181 for (sourceIT = this->sourceList->begin(); sourceIT != this->sourceList->end(); sourceIT++) 187 182 { 188 183 source = static_cast<SoundSource*>(*sourceIT); 189 if ( likely(source->getNode() != NULL))184 if (source->isPlaying()) 190 185 { 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 } 199 207 } 200 208 } … … 281 289 282 290 // INITIALIZING THE DEVICE: 291 #ifndef AL_VERSION_1_1 283 292 ALubyte deviceName[] = 293 #else 294 ALCchar deviceName[] = 295 #endif 284 296 #ifdef __WIN32__ 285 " native";297 "Direct3D"; 286 298 #else 287 "'( ( devices '( native artsnull ) ) )";299 "'( ( devices '( native null ) ) )"; 288 300 #endif 289 301 // … … 296 308 297 309 if ((result = alGetError()) != AL_NO_ERROR) 298 SoundEngine::PrintALErrorString(result);310 PRINTF(2)("%s\n", SoundEngine::getALErrorString(result)); 299 311 300 312 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 */ 321 bool 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; 301 339 } 302 340 … … 305 343 * @param err The error found 306 344 */ 307 void SoundEngine::PrintALErrorString(ALenum err)345 const char* SoundEngine::getALErrorString(ALenum err) 308 346 { 309 347 switch(err) 310 348 { 311 349 case AL_NO_ERROR: 312 PRINTF(4)("AL_NO_ERROR\n"); 313 break; 314 350 return ("AL_NO_ERROR"); 315 351 case AL_INVALID_NAME: 316 PRINTF(2)("AL_INVALID_NAME\n"); 317 break; 318 352 return ("AL_INVALID_NAME"); 319 353 case AL_INVALID_ENUM: 320 PRINTF(2)("AL_INVALID_ENUM\n"); 321 break; 322 354 return ("AL_INVALID_ENUM"); 323 355 case AL_INVALID_VALUE: 324 PRINTF(2)("AL_INVALID_VALUE\n"); 325 break; 326 356 return ("AL_INVALID_VALUE"); 327 357 case AL_INVALID_OPERATION: 328 PRINTF(2)("AL_INVALID_OPERATION\n"); 329 break; 330 358 return ("AL_INVALID_OPERATION"); 331 359 case AL_OUT_OF_MEMORY: 332 PRINTF(2)("AL_OUT_OF_MEMORY\n"); 333 break; 360 return ("AL_OUT_OF_MEMORY"); 334 361 }; 335 362 } … … 337 364 void SoundEngine::listDevices() 338 365 { 339 340 366 printf("%s\n",(const char*)alcGetString(NULL, ALC_DEVICE_SPECIFIER)); 341 367 } -
branches/powerups/src/lib/sound/sound_engine.h
r5819 r5955 14 14 15 15 #include <list> 16 #include <stack> 16 17 17 18 #define SOUND_DOPPLER_FACTOR 0.001 //!< A factor for the audible doppler effect … … 22 23 class IniParser; 23 24 25 24 26 //! A class that handles audio via the openAudioLibrary 25 27 class SoundEngine : public BaseObject { 26 27 28 public: 28 29 virtual ~SoundEngine(); … … 47 48 48 49 // 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); }; 52 52 53 53 void flushUnusedBuffers(); 54 54 void flushAllBuffers(); 55 55 void flushAllSources(); 56 56 57 bool initAudio(); 58 bool allocateSources(unsigned int count); 57 59 58 60 // error handling: 59 static void PrintALErrorString(ALenum err); 60 // static void PrintALCErrorString(ALenum err); 61 61 static const char* getALErrorString(ALenum err); 62 62 63 63 private: 64 64 SoundEngine(); 65 65 66 void listDevices(); 66 67 67 68 private: 68 static SoundEngine* singletonRef; //!< Reference to this class69 static SoundEngine* singletonRef; //!< Reference to this class 69 70 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. 72 73 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 Scene74 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 76 77 77 std::list<BaseObject*>* bufferList; //!< A list of buffers78 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. 79 80 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. 81 83 }; 82 84 -
branches/powerups/src/lib/sound/sound_source.cc
r5386 r5955 18 18 #include "sound_source.h" 19 19 #include "sound_engine.h" 20 20 21 #include "alincl.h" 21 22 #include "compiler.h" … … 33 34 34 35 // adding the Source to the SourcesList of the SoundEngine 35 SoundEngine::getInstance()->addSource(this);36 37 36 this->buffer = buffer; 38 37 this->sourceNode = sourceNode; 39 38 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; 48 41 } 49 42 … … 53 46 SoundSource::~SoundSource() 54 47 { 55 //SoundEngine::getInstance()->removeSource(this); 56 alDeleteSources(1, &this->sourceID); 48 SoundEngine::getInstance()->pushALSource(this->sourceID); 57 49 } 58 50 … … 62 54 void SoundSource::play() 63 55 { 56 if (this->sourceID == 0) 57 SoundEngine::getInstance()->popALSource(this->sourceID); 64 58 alSourcePlay(this->sourceID); 59 this->bPlay = true; 65 60 } 66 61 … … 71 66 void SoundSource::play(const SoundBuffer* buffer) 72 67 { 68 if (unlikely(this->sourceID == 0)) 69 SoundEngine::getInstance()->popALSource(this->sourceID); 70 71 printf("%d\n",sourceID); 73 72 alSourceStop(this->sourceID); 74 73 alSourcei (this->sourceID, AL_BUFFER, buffer->getID()); … … 77 76 if (unlikely(this->buffer != NULL)) 78 77 alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID()); 78 this->bPlay = true; 79 79 } 80 80 … … 84 84 void SoundSource::stop() 85 85 { 86 this->bPlay = false; 86 87 alSourceStop(this->sourceID); 88 SoundEngine::getInstance()->pushALSource(this->sourceID); 87 89 } 88 90 -
branches/powerups/src/lib/sound/sound_source.h
r5386 r5955 31 31 /** @returns The ID of this Source */ 32 32 inline ALuint getID() const { return this->sourceID; } 33 /** @returns true, if the Source is Playing */ 34 inline bool isPlaying() const { return this->bPlay; }; 33 35 /** @returns the SoundBuffer of this Source */ 34 36 inline const SoundBuffer* getBuffer() const { return this->buffer; } … … 39 41 40 42 private: 43 bool bPlay; //!< If the Source is Playing. 41 44 ALuint sourceID; //!< The ID of the Source 42 45 const SoundBuffer* buffer; //!< The buffer to play in this source. -
branches/powerups/src/lib/util/executor/executor_specials.h
r5754 r5955 10 10 11 11 #include "compiler.h" 12 #include " tinyxml.h"12 #include "parser/tinyxml/tinyxml.h" 13 13 // FORWARD DECLARATION 14 14
Note: See TracChangeset
for help on using the changeset viewer.