Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 198


Ignore:
Timestamp:
Nov 13, 2007, 9:25:37 PM (17 years ago)
Author:
rgrieder
Message:
  • added a simple ammo dump
  • created BaseWeapon from WeaponManager
  • created the WeaponStation object
Location:
code/branches/main_reto_vs05
Files:
4 added
2 deleted
12 edited

Legend:

Unmodified
Added
Removed
  • code/branches/main_reto_vs05/bin/Debug

    • Property svn:ignore
      •  

        old new  
        1515Plugin_CgProgramManager_d.dll
        1616Plugin_OctreeSceneManager_d.dll
         17Ogre.log
         18weapon_framework.exe
  • code/branches/main_reto_vs05/bin/Debug/ogre.cfg

    r157 r198  
    33[Direct3D9 Rendering Subsystem]
    44Allow NVPerfHUD=No
    5 Anti aliasing=Level 4
     5Anti aliasing=Level 2
    66Floating-point mode=Fastest
    77Full Screen=No
  • code/branches/main_reto_vs05/bin/Release

    • Property svn:ignore
      •  

        old new  
        1414RenderSystem_Direct3D9.dll
        1515RenderSystem_GL.dll
         16Ogre.log
         17weapon_framework.exe
  • code/branches/main_reto_vs05/scripts/weapon_framework.vcproj

    r195 r198  
    4141                                Name="VCCLCompilerTool"
    4242                                Optimization="0"
    43                                 AdditionalIncludeDirectories="..\src;..\src\weapon;"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Dependencies\include""
     43                                AdditionalIncludeDirectories="..\src;"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Dependencies\include""
    4444                                PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
    4545                                MinimalRebuild="true"
     
    120120                        <Tool
    121121                                Name="VCCLCompilerTool"
    122                                 AdditionalIncludeDirectories="..\src;..\src\weapon;&quot;$(OGRE_HOME)\OgreMain\include&quot;;&quot;$(OGRE_HOME)\Dependencies\include&quot;"
     122                                AdditionalIncludeDirectories="..\src;&quot;$(OGRE_HOME)\OgreMain\include&quot;;&quot;$(OGRE_HOME)\Dependencies\include&quot;"
    123123                                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
    124124                                RuntimeLibrary="2"
     
    223223                                </File>
    224224                                <File
     225                                        RelativePath="..\src\weapon\base_weapon.cpp"
     226                                        >
     227                                </File>
     228                                <File
    225229                                        RelativePath="..\src\weapon\bullet.cc"
    226230                                        >
     
    231235                                </File>
    232236                                <File
    233                                         RelativePath="..\src\weapon\weapon_manager.cc"
     237                                        RelativePath="..\src\weapon\weapon_station.cc"
    234238                                        >
    235239                                </File>
     
    281285                                </File>
    282286                                <File
     287                                        RelativePath="..\src\weapon\base_weapon.h"
     288                                        >
     289                                </File>
     290                                <File
    283291                                        RelativePath="..\src\weapon\bullet.h"
    284292                                        >
     
    293301                                </File>
    294302                                <File
    295                                         RelativePath="..\src\weapon\weapon_manager.h"
     303                                        RelativePath="..\src\weapon\weapon_station.h"
    296304                                        >
    297305                                </File>
  • code/branches/main_reto_vs05/src/orxonox_prerequisites.h

    r189 r198  
    4646    class Bullet;
    4747    class BulletManager;
    48     class Weapon;
    49     class WeaponManager;
     48    class BaseWeapon;
     49    class WeaponStation;
    5050
    5151  }
  • code/branches/main_reto_vs05/src/orxonox_scene.cc

    r169 r198  
    9898  void OrxonoxScene::createScene()
    9999  {
    100           sceneMgr_->setAmbientLight(ColourValue(0.3,0.3,0.3));
     100          sceneMgr_->setAmbientLight(ColourValue(0.3,0.3,0.3)*2);
    101101
    102102          //create first entity
     
    110110
    111111          // set up skybox
    112           sceneMgr_->setSkyBox(true, "Examples/SceneSkyBox2");
     112          sceneMgr_->setSkyBox(true, "Examples/SceneSkyBox1");
    113113
    114114          // set up one light_ source
  • code/branches/main_reto_vs05/src/orxonox_ship.cc

    r194 r198  
    3636#include "weapon/bullet.h"
    3737#include "weapon/bullet_manager.h"
    38 #include "weapon/weapon_manager.h"
     38#include "weapon/weapon_station.h"
     39#include "weapon/base_weapon.h"
     40#include "weapon/ammunition_dump.h"
    3941
    4042#include "orxonox_ship.h"
     
    6870  OrxonoxShip::OrxonoxShip(SceneManager *sceneMgr, SceneNode *node,
    6971        BulletManager *bulletManager)
    70               : sceneMgr_(sceneMgr), //currentSpeed_(Vector3(0, 0, 0)),
     72              : sceneMgr_(sceneMgr),
    7173        baseThrust_(1000), currentThrust_(Vector3::ZERO),
    72         objectCounter_(0), bulletManager_(bulletManager)//, bulletSpeed_(400)
     74        objectCounter_(0), bulletManager_(bulletManager)
    7375  {
    7476    rootNode_ = new InertialNode(node, Vector3::ZERO);
     
    8486    if (mainWeapon_)
    8587      delete mainWeapon_;
     88    if (railGunStation_)
     89      delete railGunStation_;
    8690    if (rootNode_)
    8791      delete rootNode_;
     
    111115
    112116    // initialise weapon(s)
     117    ammoDump_ = new AmmunitionDump(420);
     118    ammoDump_->store(420);
     119
    113120    InertialNode *mainWeaponNode = rootNode_->createChildNode();
    114     mainWeapon_ = new WeaponManager(sceneMgr_, mainWeaponNode,
    115           bulletManager_, 1);
    116     mainWeapon_->addWeapon("Barrel Gun");
     121    mainWeapon_ = new BaseWeapon(sceneMgr_, mainWeaponNode,
     122          bulletManager_, ammoDump_);
     123
     124    railGunStation_ = new WeaponStation(4);
     125    railGunStation_->addWeapon(mainWeapon_);
     126    railGunStation_->selectWeapon(0);
    117127
    118128          return true;
     
    198208  * @return Bullet containing speed and entity.
    199209  */
    200   WeaponManager* OrxonoxShip::getMainWeapon()
     210  BaseWeapon* OrxonoxShip::getMainWeapon()
    201211  {
    202212    return mainWeapon_;
     213  }
     214
     215
     216  int OrxonoxShip::getAmmoStock()
     217  {
     218    return ammoDump_->getStockSize();
    203219  }
    204220
  • code/branches/main_reto_vs05/src/orxonox_ship.h

    r194 r198  
    5454    Ogre::Vector3 getSpeed();
    5555
    56     weapon::WeaponManager* getMainWeapon();
     56    weapon::BaseWeapon* getMainWeapon();
     57
     58    int getAmmoStock();
    5759
    5860          bool tick(unsigned long, Ogre::Real);
     
    7476          //Ogre::Vector3 bulletSpeed_;
    7577
    76     weapon::WeaponManager *mainWeapon_;
     78    weapon::BaseWeapon *mainWeapon_;
     79    weapon::WeaponStation *railGunStation_;
     80
     81    weapon::AmmunitionDump *ammoDump_;
    7782  };
    7883
  • code/branches/main_reto_vs05/src/run_manager.cc

    r194 r198  
    5656#include "weapon/bullet.h"
    5757#include "weapon/bullet_manager.h"
    58 #include "weapon/weapon_manager.h"
     58#include "weapon/base_weapon.h"
    5959
    6060#include "run_manager.h"
     
    108108    // create a bullet manager
    109109    bulletManager_ = new BulletManager(sceneMgr_);
    110     WeaponManager::loadWeapons();
    111110
    112111
     
    213212    if (bulletManager_)
    214213      delete bulletManager_;
    215 
    216     WeaponManager::destroyWeapons();
    217214  }
    218215
     
    352349
    353350    if (keyboard_->isKeyDown(KC_G))
    354       playerShip_->getMainWeapon()->addAction(WeaponManager::RELOAD);
     351      playerShip_->getMainWeapon()->addAction(BaseWeapon::RELOAD);
    355352
    356353    if( keyboard_->isKeyDown(KC_ESCAPE) || keyboard_->isKeyDown(KC_Q) )
     
    421418    if(displayCameraDetails)
    422419      debugText_ = " | Speed = "
    423             + StringConverter::toString(playerShip_->getSpeed());
     420            + StringConverter::toString(playerShip_->getSpeed())
     421            + " | Left Ammo = "
     422            + StringConverter::toString(playerShip_
     423            ->getMainWeapon()->getAmmoState())
     424            + " | Ammo stock = "
     425            + StringConverter::toString(playerShip_->getAmmoStock());
    424426    // debugText_ = "P: " + StringConverter::toString(camera_
    425427    //      ->getDerivedPosition()) + " " + "O: "
  • code/branches/main_reto_vs05/src/weapon/ammunition_dump.cc

    r189 r198  
    3232namespace weapon {
    3333
    34   AmmunitionDump::AmmunitionDump()
     34  AmmunitionDump::AmmunitionDump(int capacity)
     35        : stock_(0), capacity_(capacity)
    3536  {
    3637  }
     
    4142  }
    4243
     44 
     45  void AmmunitionDump::store(int quantity)
     46  {
     47    stock_ += quantity;
     48    if (stock_ > capacity_)
     49      stock_ = capacity_;
     50  }
     51
     52
     53  int AmmunitionDump::getAmmunition(int quantity)
     54  {
     55    if (stock_ >= quantity)
     56    {
     57      stock_ -= quantity;
     58      return quantity;
     59    }
     60    else
     61    {
     62      quantity = stock_;
     63      stock_ = 0;
     64      return quantity;
     65    }
     66  }
     67
     68
     69  int AmmunitionDump::getStockSize()
     70  {
     71    return stock_;
     72  }
    4373}
    4474}
  • code/branches/main_reto_vs05/src/weapon/ammunition_dump.h

    r189 r198  
    4141  {
    4242  public:
    43           AmmunitionDump();
     43          AmmunitionDump(int capacity);
    4444          ~AmmunitionDump();
    4545
     46    void store(int quantiy);
     47
     48    int getAmmunition(int quantity);
     49
     50    int getStockSize();
     51
    4652  protected:
     53    int stock_;
     54    int capacity_;
    4755
    4856  protected:
  • code/branches/main_reto_vs05/src/weapon/weapon.h

    r189 r198  
    2626 */
    2727
     28#if 0
    2829
    2930#ifndef WEAPON_H
     
    4243  public:
    4344    Weapon(const Ogre::String &name, int firePower, int firingRate,
    44       Ogre::Real bulletSpeed)
     45      Ogre::Real bulletSpeed, int magazineSize)
    4546          : name_(name), firePower_(firePower), firingRate_(firingRate),
    46           bulletSpeed_(bulletSpeed) { }
     47          bulletSpeed_(bulletSpeed), magazineSize_(magazineSize) { }
    4748
    4849    virtual ~Weapon() { }
     
    5354    int firingRate_;
    5455    Ogre::Real bulletSpeed_;
     56    int magazineSize_;
    5557  };
    5658
     
    5961
    6062#endif /* WEAPON_H */
     63
     64#endif
Note: See TracChangeset for help on using the changeset viewer.