- Timestamp:
- Mar 9, 2006, 11:35:50 PM (19 years ago)
- Location:
- branches/std/src
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/std/src/lib/graphics/importer/md2Model.cc
r7203 r7207 79 79 this->setClassID(CL_MD2_MODEL, "MD2Model"); 80 80 /* this creates the data container via ressource manager */ 81 this->data = (MD2Data*)ResourceManager::getInstance()->load(modelFileName, MD2, RP_GAME, skinFileName, scale); 81 if (!modelFileName.empty()) 82 this->data = (MD2Data*)ResourceManager::getInstance()->load(modelFileName, MD2, RP_GAME, skinFileName, scale); 82 83 if( unlikely(this->data == NULL)) 83 84 PRINTF(0)("The model was not found, MD2Model Loader finished abnormaly. Update the data-repos\n"); -
branches/std/src/lib/graphics/text_engine/text.cc
r7193 r7207 32 32 * @param type The renderType to display this font in 33 33 */ 34 Text::Text(const char*fontFile, unsigned int textSize)34 Text::Text(const std::string& fontFile, unsigned int textSize) 35 35 { 36 36 this->init(); 37 37 38 if ( fontFile != NULL)38 if (!fontFile.empty()) 39 39 this->setFont(fontFile, FONT_DEFAULT_RENDER_SIZE); 40 40 this->setSizeY2D(textSize); … … 78 78 * @param fontSize the Size of the Font 79 79 */ 80 void Text::setFont(const char*fontFile, unsigned int fontSize)80 void Text::setFont(const std::string& fontFile, unsigned int fontSize) 81 81 { 82 82 Font* tmpFont; … … 90 90 91 91 // load a new Font 92 if ( fontFile != NULL)92 if (!fontFile.empty()) 93 93 { 94 94 tmpFont = (Font*)ResourceManager::getInstance()->load(fontFile, TTF, RP_GAME, (int)fontSize); … … 96 96 this->font = tmpFont; 97 97 else 98 PRINTF(2)("Font %s could not be loaded, probably file not found\n", fontFile );98 PRINTF(2)("Font %s could not be loaded, probably file not found\n", fontFile.c_str()); 99 99 } 100 100 } -
branches/std/src/lib/graphics/text_engine/text.h
r6981 r7207 39 39 { 40 40 public: 41 Text(const char* fontFile = NULL, unsigned int fontSize = TEXT_DEFAULT_SIZE);41 Text(const std::string& fontFile = "", unsigned int fontSize = TEXT_DEFAULT_SIZE); 42 42 virtual ~Text(); 43 43 void init(); 44 44 45 void setFont(const char*fontFile, unsigned int renderSize);45 void setFont(const std::string& fontFile, unsigned int renderSize); 46 46 47 47 void setText(const char* text, bool isExtern = false); -
branches/std/src/lib/shell/shell_input.cc
r6222 r7207 41 41 * this also generates a ShellCompletion automatically. 42 42 */ 43 ShellInput::ShellInput () : Text ( (const char*)NULL)43 ShellInput::ShellInput () : Text ("") 44 44 { 45 45 this->pressedKey = SDLK_FIRST; -
branches/std/src/lib/sound/sound_engine.cc
r7203 r7207 117 117 acctualy this is nothing more than a wrapper around the ResourceManager. 118 118 */ 119 SoundSource* SoundEngine::createSource(const char*fileName, PNode* sourceNode)119 SoundSource* SoundEngine::createSource(const std::string& fileName, PNode* sourceNode) 120 120 { 121 121 return new SoundSource(sourceNode, (SoundBuffer*)ResourceManager::getInstance()->load(fileName, WAV, RP_LEVEL)); -
branches/std/src/lib/sound/sound_engine.h
r6849 r7207 33 33 void loadSettings(IniParser* iniParser); 34 34 35 SoundSource* createSource(const char*fileName, PNode* sourceNode = NULL);35 SoundSource* createSource(const std::string& fileName, PNode* sourceNode = NULL); 36 36 37 37 /** @param listener the listener in the scene */ -
branches/std/src/lib/util/loading/resource_manager.cc
r7206 r7207 486 486 { 487 487 tmpResource->param[0] = param0; 488 tmpResource->pointer = new Shader(fullName, NULL);488 tmpResource->pointer = new Shader(fullName, ""); 489 489 } 490 490 } -
branches/std/src/world_entities/power_ups/power_up.cc
r7193 r7207 33 33 this->respawnStart = 10; 34 34 this->model = NULL; 35 /* if(!PowerUp::sphereModel) {*/35 /* if(!PowerUp::sphereModel) {*/ 36 36 37 37 Model* sphereModel = new PrimitiveModel(PRIM_SPHERE, 7, 5); … … 75 75 76 76 77 void PowerUp::loadPickupSound(const char*pickupSound)77 void PowerUp::loadPickupSound(const std::string& pickupSound) 78 78 { 79 79 if (this->pickupBuffer != NULL) 80 80 ResourceManager::getInstance()->unload(this->pickupBuffer); 81 81 82 else if ( pickupSound != NULL)83 {84 this->pickupBuffer = (SoundBuffer*)ResourceManager::getInstance()->load(pickupSound, WAV);85 if (this->pickupBuffer != NULL)86 {87 PRINTF(4)("Loaded sound %s to Pickup: %s.\n", pickupSound, this->getName());88 }89 else90 {91 PRINTF(2)("Failed to load sound %s to pickup %s.\n.", pickupSound, this->getName());92 }93 }82 else if (!pickupSound.empty()) 83 { 84 this->pickupBuffer = (SoundBuffer*)ResourceManager::getInstance()->load(pickupSound, WAV); 85 if (this->pickupBuffer != NULL) 86 { 87 PRINTF(4)("Loaded sound %s to Pickup: %s.\n", pickupSound.c_str(), this->getName()); 88 } 89 else 90 { 91 PRINTF(2)("Failed to load sound %s to pickup %s.\n.", pickupSound.c_str(), this->getName()); 92 } 93 } 94 94 else 95 95 this->pickupBuffer = NULL; 96 96 } 97 97 98 void PowerUp::loadRespawnSound(const char*respawnSound)98 void PowerUp::loadRespawnSound(const std::string& respawnSound) 99 99 { 100 100 if (this->respawnBuffer != NULL) 101 101 ResourceManager::getInstance()->unload(this->respawnBuffer); 102 102 103 else if ( respawnSound != NULL)103 else if (!respawnSound.empty()) 104 104 { 105 105 this->respawnBuffer = (SoundBuffer*)ResourceManager::getInstance()->load(respawnSound, WAV); 106 106 if (this->respawnBuffer != NULL) 107 107 { 108 PRINTF(4)("Loaded sound %s to Pickup: %s.\n", respawnSound , this->getName());108 PRINTF(4)("Loaded sound %s to Pickup: %s.\n", respawnSound.c_str(), this->getName()); 109 109 } 110 110 else 111 111 { 112 PRINTF(2)("Failed to load sound %s to respawn %s.\n.", respawnSound , this->getName());112 PRINTF(2)("Failed to load sound %s to respawn %s.\n.", respawnSound.c_str(), this->getName()); 113 113 } 114 114 } … … 128 128 this->soundSource.play(this->pickupBuffer); 129 129 130 switch(respawnType) { 131 case RESPAWN_NONE: 132 this->toList(OM_DEAD); 133 break; 134 case RESPAWN_TIME: 135 this->toList(OM_DEAD_TICK); 136 this->respawnTime = this->respawnStart; 137 break; 130 switch(respawnType) 131 { 132 case RESPAWN_NONE: 133 this->toList(OM_DEAD); 134 break; 135 case RESPAWN_TIME: 136 this->toList(OM_DEAD_TICK); 137 this->respawnTime = this->respawnStart; 138 break; 138 139 } 139 140 } … … 141 142 } 142 143 143 void PowerUp::tick(float dt) { 144 if(this->getOMListNumber() != OM_COMMON) { 144 void PowerUp::tick(float dt) 145 { 146 if(this->getOMListNumber() != OM_COMMON) 147 { 145 148 this->respawnTime -= dt; 146 149 if(this->respawnTime <= 0) … … 157 160 void PowerUp::draw() const 158 161 { 159 if(this->model != NULL) { 162 if(this->model != NULL) 163 { 160 164 glMatrixMode(GL_MODELVIEW); 161 165 glPushMatrix(); … … 172 176 } 173 177 174 const char* PowerUp::respawnTypes[] = { 175 "none", 176 "time" 177 }; 178 const char* PowerUp::respawnTypes[] = 179 { 180 "none", 181 "time" 182 }; 178 183 179 184 void PowerUp::setRespawnType(const char* type) 180 185 { 181 for(int i = 0; i < RESPAWN_size; ++i) { 182 if(!strcmp(type, respawnTypes[i])) { 186 for(int i = 0; i < RESPAWN_size; ++i) 187 { 188 if(!strcmp(type, respawnTypes[i])) 189 { 183 190 this->respawnType = (PowerUpRespawn)i; 184 191 break; -
branches/std/src/world_entities/power_ups/power_up.h
r7102 r7207 26 26 void collidesWith (WorldEntity* entity, const Vector& location); 27 27 28 void loadPickupSound(const char*pickupSound);29 void loadRespawnSound(const char* pickupSound);28 void loadPickupSound(const std::string& pickupSound); 29 void loadRespawnSound(const std::string& respawnSound); 30 30 31 31 virtual void draw () const; -
branches/std/src/world_entities/projectiles/projectile.cc
r7193 r7207 61 61 62 62 63 void Projectile::loadExplosionSound(const char*explosionSound)63 void Projectile::loadExplosionSound(const std::string& explosionSound) 64 64 { 65 65 if (this->explosionBuffer != NULL) 66 66 ResourceManager::getInstance()->unload(this->explosionBuffer); 67 67 68 else if ( explosionSound != NULL)68 else if (!explosionSound.empty()) 69 69 { 70 70 this->explosionBuffer = (SoundBuffer*)ResourceManager::getInstance()->load(explosionSound, WAV); 71 71 if (this->explosionBuffer != NULL) 72 72 { 73 PRINTF(4)("Loaded sound %s to Pickup: %s.\n", explosionSound , this->getName());73 PRINTF(4)("Loaded sound %s to Pickup: %s.\n", explosionSound.c_str(), this->getName()); 74 74 } 75 75 else 76 76 { 77 PRINTF(2)("Failed to load sound %s to explosion %s.\n.", explosionSound , this->getName());77 PRINTF(2)("Failed to load sound %s to explosion %s.\n.", explosionSound.c_str(), this->getName()); 78 78 } 79 79 } … … 83 83 84 84 85 void Projectile::loadEngineSound(const char*engineSound)85 void Projectile::loadEngineSound(const std::string& engineSound) 86 86 { 87 87 if (this->engineBuffer != NULL) 88 88 ResourceManager::getInstance()->unload(this->engineBuffer); 89 89 90 else if ( engineSound != NULL)90 else if (!engineSound.empty()) 91 91 { 92 92 this->engineBuffer = (SoundBuffer*)ResourceManager::getInstance()->load(engineSound, WAV); 93 93 if (this->engineBuffer != NULL) 94 94 { 95 PRINTF(4)("Loaded sound %s to Pickup: %s.\n", engineSound , this->getName());95 PRINTF(4)("Loaded sound %s to Pickup: %s.\n", engineSound.c_str(), this->getName()); 96 96 } 97 97 else 98 98 { 99 PRINTF(2)("Failed to load sound %s to engine %s.\n.", engineSound , this->getName());99 PRINTF(2)("Failed to load sound %s to engine %s.\n.", engineSound.c_str(), this->getName()); 100 100 } 101 101 } -
branches/std/src/world_entities/projectiles/projectile.h
r7193 r7207 26 26 void setLifeSpan(float lifeSpan); 27 27 28 void loadExplosionSound(const char*explosionSound);29 void loadEngineSound(const char*engineSound);28 void loadExplosionSound(const std::string& explosionSound); 29 void loadEngineSound(const std::string& engineSound); 30 30 void setMinEnergy(float energyMin); 31 31 /** @returns the minimal charched energy */ -
branches/std/src/world_entities/space_ships/helicopter.cc
r7193 r7207 110 110 this->loadModel("models/ships/helicopter_#.obj", 1.0); 111 111 112 EventHandler::getInstance()->grabEvents(true);112 //EventHandler::getInstance()->grabEvents(true); 113 113 114 114 bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false; -
branches/std/src/world_entities/terrain.cc
r7203 r7207 175 175 176 176 177 void Terrain::loadVegetation(const char*vegetationFile)178 { 179 PRINTF(0)("loadVegetation: %s\n", vegetationFile );177 void Terrain::loadVegetation(const std::string& vegetationFile) 178 { 179 PRINTF(0)("loadVegetation: %s\n", vegetationFile.c_str()); 180 180 if (this->vegetation) 181 181 ResourceManager::getInstance()->unload(this->vegetation, RP_LEVEL); 182 if ( vegetationFile != NULL)182 if (!vegetationFile.empty()) 183 183 { 184 PRINTF(4)("fetching %s\n", vegetationFile );184 PRINTF(4)("fetching %s\n", vegetationFile.c_str()); 185 185 this->vegetation = dynamic_cast<Model*>(ResourceManager::getInstance()->load(vegetationFile, OBJ, RP_CAMPAIGN)); 186 186 } -
branches/std/src/world_entities/terrain.h
r7046 r7207 41 41 virtual void loadParams(const TiXmlElement* root); 42 42 43 void loadVegetation(const char*vegetationFile);43 void loadVegetation(const std::string& vegetationFile); 44 44 45 45 void loadHeightMap(const char* heightMapFile, const char* colorMap = NULL); -
branches/std/src/world_entities/weapons/weapon.cc
r7193 r7207 232 232 * @param soundFile the soundFile's relative position to the data-directory (will be looked for by the ResourceManager) 233 233 */ 234 void Weapon::setActionSound(WeaponAction action, const char*soundFile)234 void Weapon::setActionSound(WeaponAction action, const std::string& soundFile) 235 235 { 236 236 if (action >= WA_ACTION_COUNT) … … 239 239 ResourceManager::getInstance()->unload(this->soundBuffers[action]); 240 240 241 else if ( soundFile != NULL)241 else if (!soundFile.empty()) 242 242 { 243 243 this->soundBuffers[action] = (SoundBuffer*)ResourceManager::getInstance()->load(soundFile, WAV); 244 244 if (this->soundBuffers[action] != NULL) 245 245 { 246 PRINTF(4)("Loaded sound %s to action %s.\n", soundFile , actionToChar(action));246 PRINTF(4)("Loaded sound %s to action %s.\n", soundFile.c_str(), actionToChar(action)); 247 247 } 248 248 else 249 249 { 250 PRINTF(2)("Failed to load sound %s to %s.\n.", soundFile , actionToChar(action));250 PRINTF(2)("Failed to load sound %s to %s.\n.", soundFile.c_str(), actionToChar(action)); 251 251 } 252 252 } -
branches/std/src/world_entities/weapons/weapon.h
r7102 r7207 148 148 inline void setAmmoContainer(const CountPointer<AmmoContainer>& ammoContainer) { this->ammoContainer = ammoContainer;} 149 149 150 void setActionSound(WeaponAction action, const char*soundFile);150 void setActionSound(WeaponAction action, const std::string& soundFile); 151 151 /** @see void setActionSound(WeaponAction action, const char* soundFile); */ 152 152 void setActionSound(const char* action, const char* soundFile) { this->setActionSound(charToAction(action), soundFile); };
Note: See TracChangeset
for help on using the changeset viewer.