Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7221 in orxonox.OLD for trunk/src/world_entities/weapons


Ignore:
Timestamp:
Mar 15, 2006, 3:10:45 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the std-branche back, it runs on windows and Linux

svn merge https://svn.orxonox.net/orxonox/branches/std . -r7202:HEAD

Location:
trunk/src/world_entities/weapons
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/weapons/aim.cc

    r7193 r7221  
    147147 * @param textureFile The texture-file to load onto the crosshair
    148148 */
    149 void Aim::setTexture(const char* textureFile)
     149void Aim::setTexture(const std::string& textureFile)
    150150{
    151151  this->material->setDiffuseMap(textureFile);
  • trunk/src/world_entities/weapons/aim.h

    r6724 r7221  
    4646
    4747  void setSize(float size);
    48   void setTexture(const char* textureFile);
     48  void setTexture(const std::string& textureFile);
    4949  /** @param rotationSpeed the speed at what the crosshair should rotate */
    5050  inline void setRotationSpeed(float rotationSpeed) { this->rotationSpeed = rotationSpeed; };
  • trunk/src/world_entities/weapons/aiming_turret.cc

    r7193 r7221  
    168168  glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    169169
    170   this->getModel()->draw();
     170  if (this->getModel())
     171    this->getModel()->draw();
    171172  glPopMatrix();
    172173}
  • trunk/src/world_entities/weapons/crosshair.cc

    r7193 r7221  
    7979  EventListener::loadParams(root);
    8080
    81   LoadParam(root, "texture", this, Crosshair, setTexture)
     81  LoadParam(root, "texture", this->material, Material, setDiffuseMap)
    8282      .describe("the texture-file to load onto the Crosshair");
    8383
     
    103103 * @param textureFile The texture-file to load onto the crosshair
    104104 */
    105 void Crosshair::setTexture(const char* textureFile)
     105void Crosshair::setTexture(const std::string& textureFile)
    106106{
    107107  this->material->setDiffuseMap(textureFile);
  • trunk/src/world_entities/weapons/crosshair.h

    r6512 r7221  
    3131
    3232  void setSize(float size);
    33   void setTexture(const char* textureFile);
     33  void setTexture(const std::string& textureFile);
    3434  /** @param rotationSpeed the speed at what the crosshair should rotate */
    3535  void setRotationSpeed(float rotationSpeed) { this->rotationSpeed = rotationSpeed; };
  • trunk/src/world_entities/weapons/weapon.cc

    r7193 r7221  
    165165 * @param projectile the Name of the Projectile.
    166166 */
    167 void Weapon::setProjectileTypeC(const char* projectile)
    168 {
    169   if (projectile == NULL)
    170     return;
     167void Weapon::setProjectileTypeC(const std::string& projectile)
     168{
    171169  FastFactory* tmpFac = FastFactory::searchFastFactory(projectile);
    172170  if (tmpFac != NULL)
     
    176174  else
    177175  {
    178     PRINTF(1)("Projectile %s does not exist for weapon %s\n", projectile, this->getName());
     176    PRINTF(1)("Projectile %s does not exist for weapon %s\n", projectile.c_str(), this->getName());
    179177  }
    180178}
     
    232230 * @param soundFile the soundFile's relative position to the data-directory (will be looked for by the ResourceManager)
    233231 */
    234 void Weapon::setActionSound(WeaponAction action, const char* soundFile)
     232void Weapon::setActionSound(WeaponAction action, const std::string& soundFile)
    235233{
    236234  if (action >= WA_ACTION_COUNT)
     
    239237    ResourceManager::getInstance()->unload(this->soundBuffers[action]);
    240238
    241   else if (soundFile != NULL)
     239  else if (!soundFile.empty())
    242240  {
    243241    this->soundBuffers[action] = (SoundBuffer*)ResourceManager::getInstance()->load(soundFile, WAV);
    244242    if (this->soundBuffers[action] != NULL)
    245243    {
    246       PRINTF(4)("Loaded sound %s to action %s.\n", soundFile, actionToChar(action));
     244      PRINTF(4)("Loaded sound %s to action %s.\n", soundFile.c_str(), actionToChar(action));
    247245    }
    248246    else
    249247    {
    250       PRINTF(2)("Failed to load sound %s to %s.\n.", soundFile, actionToChar(action));
     248      PRINTF(2)("Failed to load sound %s to %s.\n.", soundFile.c_str(), actionToChar(action));
    251249    }
    252250  }
     
    613611 * @return The Action if known, WA_NONE otherwise.
    614612 */
    615 WeaponAction Weapon::charToAction(const char* action)
    616 {
    617   if (!strcmp(action, "none"))
     613WeaponAction Weapon::charToAction(const std::string& action)
     614{
     615  if (action == "none")
    618616    return WA_NONE;
    619   else if (!strcmp(action, "shoot"))
     617  else if (action == "shoot")
    620618    return WA_SHOOT;
    621   else if (!strcmp(action, "charge"))
     619  else if (action == "charge")
    622620    return WA_CHARGE;
    623   else if (!strcmp(action, "reload"))
     621  else if (action == "reload")
    624622    return WA_RELOAD;
    625   else if (!strcmp(action, "acitvate"))
     623  else if (action == "acitvate")
    626624    return WA_ACTIVATE;
    627   else if (!strcmp(action, "deactivate"))
     625  else if (action == "deactivate")
    628626    return WA_DEACTIVATE;
    629   else if (!strcmp(action, "special1"))
     627  else if (action == "special1")
    630628    return WA_SPECIAL1;
    631629  else
    632630  {
    633     PRINTF(2)("action %s could not be identified.\n", action);
     631    PRINTF(2)("action %s could not be identified.\n", action.c_str());
    634632    return WA_NONE;
    635633  }
     
    674672 * @return The State if known, WS_NONE otherwise.
    675673 */
    676 WeaponState Weapon::charToState(const char* state)
    677 {
    678   if (!strcmp(state, "none"))
     674WeaponState Weapon::charToState(const std::string& state)
     675{
     676  if (state == "none")
    679677    return WS_NONE;
    680   else if (!strcmp(state, "shooting"))
     678  else if (state == "shooting")
    681679    return WS_SHOOTING;
    682   else if (!strcmp(state, "charging"))
     680  else if (state == "charging")
    683681    return WS_CHARGING;
    684   else if (!strcmp(state, "reloading"))
     682  else if (state == "reloading")
    685683    return WS_RELOADING;
    686   else if (!strcmp(state, "activating"))
     684  else if (state == "activating")
    687685    return WS_ACTIVATING;
    688   else if (!strcmp(state, "deactivating"))
     686  else if (state == "deactivating")
    689687    return WS_DEACTIVATING;
    690   else if (!strcmp(state, "inactive"))
     688  else if (state == "inactive")
    691689    return WS_INACTIVE;
    692   else if (!strcmp(state, "idle"))
     690  else if (state == "idle")
    693691    return WS_IDLE;
    694692  else
    695693  {
    696     PRINTF(2)("state %s could not be identified.\n", state);
     694    PRINTF(2)("state %s could not be identified.\n", state.c_str());
    697695    return WS_NONE;
    698696  }
  • trunk/src/world_entities/weapons/weapon.h

    r7102 r7221  
    111111    inline long getCapability() const { return this->capability; };
    112112    void setProjectileType(ClassID projectile);
    113     void setProjectileTypeC(const char* projectile);
     113    void setProjectileTypeC(const std::string& projectile);
    114114    /** @returns The projectile's classID */
    115115    inline ClassID getProjectileType() { return this->projectile; };
     
    132132    // STATE CHANGES //
    133133    /** @param state the State to time @param duration the duration of the State */
    134     inline void setStateDuration(const char* state, float duration) { setStateDuration(charToState(state), duration); };
     134    inline void setStateDuration(const std::string& state, float duration) { setStateDuration(charToState(state), duration); };
    135135    /** @param state the State to time @param duration the duration of the State */
    136136    inline void setStateDuration(WeaponState state, float duration) { /*(state < WS_STATE_COUNT)?*/this->times[state] = duration; };
     
    148148    inline void setAmmoContainer(const CountPointer<AmmoContainer>& ammoContainer) { this->ammoContainer = ammoContainer;}
    149149
    150     void setActionSound(WeaponAction action, const char* soundFile);
    151     /** @see void setActionSound(WeaponAction action, const char* soundFile); */
    152     void setActionSound(const char* action, const char* soundFile) { this->setActionSound(charToAction(action), soundFile); };
     150    void setActionSound(WeaponAction action, const std::string& soundFile);
     151    /** @see void setActionSound(WeaponAction action, const std::string& soundFile); */
     152    void setActionSound(const std::string& action, const std::string& soundFile) { this->setActionSound(charToAction(action), soundFile); };
    153153
    154154    Animation3D* getAnimation(WeaponState state, PNode* node = NULL);
     
    176176
    177177    // utility:
    178     static WeaponAction  charToAction(const char* action);
     178    static WeaponAction  charToAction(const std::string& action);
    179179    static const char*   actionToChar(WeaponAction action);
    180     static WeaponState   charToState(const char* state);
     180    static WeaponState   charToState(const std::string& state);
    181181    static const char*   stateToChar(WeaponState state);
    182182
Note: See TracChangeset for help on using the changeset viewer.